From: David Given Date: Sat, 23 Jun 2018 10:55:59 +0000 (+0200) Subject: Made the two OSX platforms work with the new libc layout. X-Git-Url: https://git.ndcode.org/public/gitweb.cgi?a=commitdiff_plain;h=680b4071b743b1c167a01083bd399da7fac93ba6;p=ack.git Made the two OSX platforms work with the new libc layout. --- diff --git a/build.lua b/build.lua index f182020b2..4019f22ce 100644 --- a/build.lua +++ b/build.lua @@ -10,8 +10,8 @@ vars.plats = { "linux386", "linux68k", "linuxppc", --- "osx386", --- "osxppc", + "osx386", + "osxppc", -- --"qemuppc", -- "pc86", -- "rpi", diff --git a/lang/cem/libcc.ansi/headers/sys/ioctl.h b/lang/cem/libcc.ansi/headers/sys/ioctl.h deleted file mode 100644 index 2823d4581..000000000 --- a/lang/cem/libcc.ansi/headers/sys/ioctl.h +++ /dev/null @@ -1,11 +0,0 @@ -/* $Source$ - * $State$ - * $Revision$ - */ - -#ifndef _SYS_IOCTL_H -#define _SYS_IOCTL_H - -#include - -#endif diff --git a/lang/cem/libcc.ansi/headers/unistd.h b/lang/cem/libcc.ansi/headers/unistd.h index 8818fa66e..b088f9559 100644 --- a/lang/cem/libcc.ansi/headers/unistd.h +++ b/lang/cem/libcc.ansi/headers/unistd.h @@ -48,13 +48,13 @@ #define _NSIG 16 /* Biggest signal number + 1 (not including real-time signals). */ - typedef void (*sighandler_t)(int); typedef uint16_t sigset_t; struct sigaction; #else #include #endif +typedef void (*sighandler_t)(int); /* Time handling. */ diff --git a/plat/linux/include/ack/signal.h b/plat/linux/include/ack/signal.h index d7ec086b2..55c0f3a04 100644 --- a/plat/linux/include/ack/signal.h +++ b/plat/linux/include/ack/signal.h @@ -54,8 +54,6 @@ typedef int sig_atomic_t; #define SIG_SETMASK 2 typedef unsigned long sigset_t; -typedef void (*sighandler_t)(int); - /* sa_flags */ #define SA_NODEFER 0x40000000UL #define SA_RESETHAND 0x80000000UL diff --git a/plat/osx/include/ack/fcntl.h b/plat/osx/include/ack/fcntl.h new file mode 100644 index 000000000..aa07e30f2 --- /dev/null +++ b/plat/osx/include/ack/fcntl.h @@ -0,0 +1,13 @@ +#ifndef _ACK_FCNTL_H +#define _ACK_FCNTL_H + +#define O_RDONLY 0x0000 +#define O_WRONLY 0x0001 +#define O_RDWR 0x0002 +#define O_NONBLOCK 0x0004 +#define O_APPEND 0x0008 +#define O_CREAT 0x0200 +#define O_TRUNC 0x0400 +#define O_EXCL 0x0800 + +#endif diff --git a/plat/osx/include/ack/plat.h b/plat/osx/include/ack/plat.h index ba64a6d56..6d6baa515 100644 --- a/plat/osx/include/ack/plat.h +++ b/plat/osx/include/ack/plat.h @@ -11,4 +11,7 @@ /* #define ACKCONF_TIME_IS_A_SYSCALL */ +#define ACKCONF_WANT_STANDARD_O 0 +#define ACKCONF_WANT_STANDARD_SIGNALS 0 + #endif diff --git a/plat/osx/include/ack/signal.h b/plat/osx/include/ack/signal.h new file mode 100644 index 000000000..0eda97952 --- /dev/null +++ b/plat/osx/include/ack/signal.h @@ -0,0 +1,60 @@ +#ifndef _ACK_SIGNAL_H +#define _ACK_SIGNAL_H + +#define SIGHUP 1 +#define SIGINT 2 +#define SIGQUIT 3 +#define SIGILL 4 +#define SIGTRAP 5 +#define SIGABRT 6 +#define SIGEMT 7 +#define SIGFPE 8 +#define SIGKILL 9 +#define SIGBUS 10 +#define SIGSEGV 11 +#define SIGSYS 12 +#define SIGPIPE 13 +#define SIGALRM 14 +#define SIGTERM 15 +#define SIGURG 16 +#define SIGSTOP 17 +#define SIGTSTP 18 +#define SIGCONT 19 +#define SIGCHLD 20 +#define SIGTTIN 21 +#define SIGTTOU 22 +#define SIGIO 23 +#define SIGXCPU 24 +#define SIGXFSZ 25 +#define SIGVTALRM 26 +#define SIGPROF 27 +#define SIGWINCH 28 +#define SIGINFO 29 +#define SIGUSR1 30 +#define SIGUSR2 31 +#define _NSIG 32 + +/* sa_flags */ +#define SA_RESTART 0x0002 + +typedef void (*sig_t)(int); +#define SIG_DFL ((sig_t)0) +#define SIG_IGN ((sig_t)1) +#define SIG_ERR ((sig_t)-1) + +typedef unsigned int sigset_t; + +struct __siginfo; + +struct sigaction { + union { + void (*__sa_handler)(int); + void (*__sa_sigaction)(int, struct __siginfo *, void *); + } __sigaction_u; + sigset_t sa_mask; + int sa_flags; +}; +#define sa_handler __sigaction_u.__sa_handler +#define sa_sigaction __sigaction_u.__sa_sigaction + +#endif diff --git a/plat/osx/include/build.lua b/plat/osx/include/build.lua index 859a3730a..78ac3246f 100644 --- a/plat/osx/include/build.lua +++ b/plat/osx/include/build.lua @@ -9,11 +9,13 @@ local function addheader(h) end addheader("ack/plat.h") +addheader("ack/signal.h") +addheader("ack/fcntl.h") addheader("sys/dirent.h") addheader("sys/mman.h") addheader("sys/stat.h") addheader("sys/types.h") -addheader("unistd.h") +addheader("sys/ioctl.h") acklibrary { name = "headers", diff --git a/plat/osx/include/sys/ioctl.h b/plat/osx/include/sys/ioctl.h new file mode 100644 index 000000000..80d2b06c0 --- /dev/null +++ b/plat/osx/include/sys/ioctl.h @@ -0,0 +1,8 @@ +#ifndef _SYS_IOCTL_H +#define _SYS_IOCTL_H + +#define TIOCGETD 0x4004741a + +extern int ioctl(int fd, unsigned long request, ...); + +#endif diff --git a/plat/osx/include/sys/types.h b/plat/osx/include/sys/types.h index b4561b7b3..e1330271f 100644 --- a/plat/osx/include/sys/types.h +++ b/plat/osx/include/sys/types.h @@ -11,7 +11,8 @@ typedef unsigned int ino_t; typedef unsigned short mode_t; typedef unsigned short nlink_t; typedef int pid_t; -typedef ptrdiff_t ssize_t; typedef unsigned int uid_t; +typedef long time_t; +typedef int suseconds_t; #endif diff --git a/plat/osx/include/unistd.h b/plat/osx/include/unistd.h deleted file mode 100644 index bafa2a6c4..000000000 --- a/plat/osx/include/unistd.h +++ /dev/null @@ -1,137 +0,0 @@ -#ifndef _UNISTD_H -#define _UNISTD_H - -#include - -/* - * XXX - The following parts belong in other header files, - * but those headers are including us! - */ - -/* XXX - begin sys/ioctl.h */ - -#define TIOCGETD 0x4004741a - -int ioctl(int, unsigned long, ...); - -/* XXX - end sys/ioctl.h */ - -/* XXX - begin sys/time.h */ - -/* Don't conflict with time_t from */ -typedef long _libsys_time_t; -typedef int suseconds_t; - -struct timespec { - _libsys_time_t tv_sec; - long tv_nsec; -}; - -struct timeval { - _libsys_time_t tv_sec; - suseconds_t tv_usec; -}; - -struct timezone { - int tz_minuteswest; - int tz_dsttime; -}; - -int gettimeofday(struct timeval *, struct timezone *); - -/* XXX - end sys/time.h */ - -/* XXX - begin fcntl.h */ - -/* flags for open() */ -#define O_RDONLY 0x0000 -#define O_WRONLY 0x0001 -#define O_RDWR 0x0002 -#define O_NONBLOCK 0x0004 -#define O_APPEND 0x0008 -#define O_CREAT 0x0200 -#define O_TRUNC 0x0400 -#define O_EXCL 0x0800 - -int creat(const char *, mode_t); -int open(const char *, int, ...); - -/* XXX - end fcntl.h */ - -/* XXX - begin signal.h */ - -#define SIGHUP 1 -#define SIGINT 2 -#define SIGQUIT 3 -#define SIGILL 4 -#define SIGTRAP 5 -#define SIGABRT 6 -#define SIGEMT 7 -#define SIGFPE 8 -#define SIGKILL 9 -#define SIGBUS 10 -#define SIGSEGV 11 -#define SIGSYS 12 -#define SIGPIPE 13 -#define SIGALRM 14 -#define SIGTERM 15 -#define SIGURG 16 -#define SIGSTOP 17 -#define SIGTSTP 18 -#define SIGCONT 19 -#define SIGCHLD 20 -#define SIGTTIN 21 -#define SIGTTOU 22 -#define SIGIO 23 -#define SIGXCPU 24 -#define SIGXFSZ 25 -#define SIGVTALRM 26 -#define SIGPROF 27 -#define SIGWINCH 28 -#define SIGINFO 29 -#define SIGUSR1 30 -#define SIGUSR2 31 -#define _NSIG 32 - -/* sa_flags */ -#define SA_RESTART 0x0002 - -typedef void (*sig_t)(int); -#define SIG_DFL ((sig_t)0) -#define SIG_IGN ((sig_t)1) -#define SIG_ERR ((sig_t)-1) - -typedef unsigned int sigset_t; - -struct __siginfo; - -struct sigaction { - union { - void (*__sa_handler)(int); - void (*__sa_sigaction)(int, struct __siginfo *, void *); - } __sigaction_u; - sigset_t sa_mask; - int sa_flags; -}; -#define sa_handler __sigaction_u.__sa_handler -#define sa_sigaction __sigaction_u.__sa_sigaction - -int kill(pid_t, int); -int sigaction(int, const struct sigaction *, struct sigaction *); -sig_t signal(int, sig_t); - -int raise(int); /* in libc */ - -/* XXX - end signal.h */ - -void _exit(int); -int brk(void *); -int close(int); -pid_t getpid(void); -int isatty(int); -off_t lseek(int, off_t, int); -ssize_t read(int, void *, size_t); -void *sbrk(int); -ssize_t write(int, const void *, size_t); - -#endif