From dbb2062d03264444ec6bc39d2872a8552ce961c1 Mon Sep 17 00:00:00 2001 From: David Given Date: Sat, 23 Jun 2018 12:59:40 +0200 Subject: [PATCH] Made pc86 work with the new libc. --- build.lua | 4 +- plat/pc86/include/build.lua | 2 +- plat/pc86/include/sys/types.h | 9 +++++ plat/pc86/include/unistd.h | 73 ----------------------------------- plat/pc86/libsys/read.c | 2 +- plat/pc86/libsys/write.c | 2 +- 6 files changed, 14 insertions(+), 78 deletions(-) create mode 100644 plat/pc86/include/sys/types.h delete mode 100644 plat/pc86/include/unistd.h diff --git a/build.lua b/build.lua index 4019f22ce..8a765c032 100644 --- a/build.lua +++ b/build.lua @@ -13,7 +13,7 @@ vars.plats = { "osx386", "osxppc", -- --"qemuppc", --- "pc86", + "pc86", -- "rpi", -- "pdpv7", -- "em22", @@ -23,7 +23,7 @@ vars.plats_with_tests = { "linux386", "linuxppc", -- --"qemuppc", --- "pc86", + "pc86", } local plat_packages = {} diff --git a/plat/pc86/include/build.lua b/plat/pc86/include/build.lua index cb504b837..3ae81836a 100644 --- a/plat/pc86/include/build.lua +++ b/plat/pc86/include/build.lua @@ -9,7 +9,7 @@ local function addheader(h) end addheader("ack/plat.h") -addheader("unistd.h") +addheader("sys/types.h") acklibrary { name = "headers", diff --git a/plat/pc86/include/sys/types.h b/plat/pc86/include/sys/types.h new file mode 100644 index 000000000..6a0c3d3db --- /dev/null +++ b/plat/pc86/include/sys/types.h @@ -0,0 +1,9 @@ +#ifndef _SYS_TYPES_H +#define _SYS_TYPES_H + +typedef int pid_t; +typedef int mode_t; +typedef long time_t; +typedef long suseconds_t; + +#endif diff --git a/plat/pc86/include/unistd.h b/plat/pc86/include/unistd.h deleted file mode 100644 index 77bdcf10d..000000000 --- a/plat/pc86/include/unistd.h +++ /dev/null @@ -1,73 +0,0 @@ -/* - * unistd.h - standard system calls - */ -/* $Id$ */ - -#ifndef _UNISTD_H -#define _UNISTD_H - -#include - -/* Types */ - -typedef int pid_t; -typedef int mode_t; - -/* Constants for file access (open and friends) */ - -enum -{ - O_ACCMODE = 0x3, - - O_RDONLY = 0, - O_WRONLY = 1, - O_RDWR = 2, - - O_CREAT = 0100, - O_TRUNC = 01000, - O_APPEND = 02000, - O_NONBLOCK = 04000 -}; - -/* Special variables */ - -extern char** environ; - -/* Implemented system calls */ - -extern void _exit(int); -extern pid_t getpid(void); -extern int brk(void* addr); -extern void* sbrk(int increment); -extern int isatty(int d); -extern off_t lseek(int fildes, off_t offset, int whence); -extern int close(int d); -extern int open(const char* path, int access, ...); -extern int creat(const char* path, mode_t mode); -extern int read(int fd, void* buffer, size_t count); -extern int write(int fd, void* buffer, size_t count); -extern int unlink(const char* path); - -/* Unimplemented system calls (these are just prototypes to let the library - * compile). */ - -extern int fcntl(int fd, int op, ...); - -/* Signal handling */ - -typedef int sig_atomic_t; - -#define SIG_ERR ((sighandler_t) -1) /* Error return. */ -#define SIG_DFL ((sighandler_t) 0) /* Default action. */ -#define SIG_IGN ((sighandler_t) 1) /* Ignore signal. */ - -#define SIGABRT 6 /* Abort (ANSI) */ -#define SIGILL 11 /* Illegal instruction */ - -#define _NSIG 32 /* Biggest signal number + 1 - (not including real-time signals). */ -typedef void (*sighandler_t)(int); -extern sighandler_t signal(int signum, sighandler_t handler); -extern int raise(int signum); - -#endif diff --git a/plat/pc86/libsys/read.c b/plat/pc86/libsys/read.c index 968124784..c888660a4 100644 --- a/plat/pc86/libsys/read.c +++ b/plat/pc86/libsys/read.c @@ -8,7 +8,7 @@ #include #include "libsys.h" -int read(int fd, void* buffer, size_t count) +ssize_t read(int fd, void* buffer, size_t count) { char i; diff --git a/plat/pc86/libsys/write.c b/plat/pc86/libsys/write.c index 8d2dd0d74..064e5f487 100644 --- a/plat/pc86/libsys/write.c +++ b/plat/pc86/libsys/write.c @@ -19,7 +19,7 @@ void _sys_write_tty(char c) _sys_rawwrite('\r'); } -int write(int fd, void* buffer, size_t count) +ssize_t write(int fd, void* buffer, size_t count) { int i; char* p = buffer;