Small changes to Magenta sys files

This commit is contained in:
Max Wash
2020-05-01 20:39:22 +01:00
parent 7acf66de3e
commit f7fc9ef510
5 changed files with 31 additions and 16 deletions

View File

@@ -20,11 +20,6 @@ typedef __intptr_t ptrdiff_t;
typedef __uintptr_t size_t; typedef __uintptr_t size_t;
#endif #endif
#ifndef __ssize_t_defined
#define __ssize_t_defined
typedef __intptr_t ssize_t;
#endif
#if defined(__cplusplus) #if defined(__cplusplus)
} }
#endif /* defined(__cplusplus) */ #endif /* defined(__cplusplus) */

View File

@@ -1,6 +1,6 @@
#include "sys/types.h"
#include "__fio.h" #include "__fio.h"
#include "__syscall.h" #include "__syscall.h"
#include "unistd.h"
struct __io_file __stdin = {}; struct __io_file __stdin = {};
struct __io_file __stdout = {}; struct __io_file __stdout = {};
@@ -38,7 +38,7 @@ unsigned int __fio_write(struct __io_file *f, const char *buf, unsigned int sz)
unsigned int __fio_flush(struct __io_file *f) unsigned int __fio_flush(struct __io_file *f)
{ {
ssize_t res = 0;//write(f->fd, f->buf, f->buf_idx); ssize_t res = 0;//write(f->fd, f->buf, f->buf_idx);
if (res != f->buf_idx) { if ((size_t)res != f->buf_idx) {
f->err = 1; f->err = 1;
} }

View File

@@ -24,9 +24,15 @@ typedef unsigned int uid_t;
typedef unsigned long useconds_t; typedef unsigned long useconds_t;
typedef unsigned long long dev_t; typedef unsigned long long dev_t;
#ifndef __SIZE_T_DEFINED #ifndef __size_t_DEFINED
typedef __uintptr_t size_t; typedef __uintptr_t size_t;
#define __SIZE_T_DEFINED #define __size_t_DEFINED
#endif #endif
#ifndef __ssize_t_defined
#define __ssize_t_defined
typedef __intptr_t ssize_t;
#endif
#endif #endif

View File

@@ -1,7 +1,5 @@
#include "unistd.h"
_Noreturn void __exit(int code) _Noreturn void __exit(int code)
{ {
_exit(code); /* TODO Exit syscall */
while (1) {} while (1) {}
} }

View File

@@ -16,12 +16,28 @@ platform_sys_headers=$(find $source_dir/photon/libc/sys/$platform/sys \
-maxdepth 1 -type f \( -iname "*.h" ! -iname "__*" \)) -maxdepth 1 -type f \( -iname "*.h" ! -iname "__*" \))
platform_sys_arch_headers=$(find $source_dir/photon/libc/sys/$platform/machine/$machine \ platform_sys_arch_headers=$(find $source_dir/photon/libc/sys/$platform/machine/$machine \
-maxdepth 1 -type f \( -iname "*.h" ! -iname "__*" \)) -maxdepth 1 -type f \( -iname "*.h" ! -iname "__*" \))
cp -t $build_dir/sysroot/usr/include $platform_headers
cp -t $build_dir/sysroot/usr/include/sys $platform_sys_headers if [ ! -z "$platform_headers" ]; then
cp -t $build_dir/sysroot/usr/include/sys $platform_sys_arch_headers cp -t $build_dir/sysroot/usr/include $platform_headers
fi
if [ ! -z "$platform_sys_headers" ]; then
cp -t $build_dir/sysroot/usr/include/sys $platform_sys_headers
fi
if [ ! -z "$platform_sys_arch_headers" ]; then
cp -t $build_dir/sysroot/usr/include/sys $platform_sys_arch_headers
fi
machine_arch_headers=$(find $source_dir/photon/libc/machine/$machine/ \ machine_arch_headers=$(find $source_dir/photon/libc/machine/$machine/ \
-type f \( -iname "*.h" ! -iname "__*" \)) -type f \( -iname "*.h" ! -iname "__*" \))
machine_generic_headers=$(find $source_dir/photon/libc/include/machine/ \ machine_generic_headers=$(find $source_dir/photon/libc/include/machine/ \
-type f \( -iname "*.h" ! -iname "__*" \)) -type f \( -iname "*.h" ! -iname "__*" \))
cp -t $build_dir/sysroot/usr/include/machine $machine_generic_headers $machine_arch_headers
if [ ! -z "$machine_generic_headers" ]; then
cp -t $build_dir/sysroot/usr/include/machine $machine_generic_headers
fi
if [ ! -z "$machine_arch_headers" ]; then
cp -t $build_dir/sysroot/usr/include/machine $machine_arch_headers
fi