Made the two OSX platforms work with the new libc layout.
authorDavid Given <dg@cowlark.com>
Sat, 23 Jun 2018 10:55:59 +0000 (12:55 +0200)
committerDavid Given <dg@cowlark.com>
Sat, 23 Jun 2018 10:55:59 +0000 (12:55 +0200)
build.lua
lang/cem/libcc.ansi/headers/sys/ioctl.h [deleted file]
lang/cem/libcc.ansi/headers/unistd.h
plat/linux/include/ack/signal.h
plat/osx/include/ack/fcntl.h [new file with mode: 0644]
plat/osx/include/ack/plat.h
plat/osx/include/ack/signal.h [new file with mode: 0644]
plat/osx/include/build.lua
plat/osx/include/sys/ioctl.h [new file with mode: 0644]
plat/osx/include/sys/types.h
plat/osx/include/unistd.h [deleted file]

index f182020..4019f22 100644 (file)
--- 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 (file)
index 2823d45..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-/* $Source$
- * $State$
- * $Revision$
- */
-
-#ifndef _SYS_IOCTL_H
-#define _SYS_IOCTL_H
-
-#include <unistd.h>
-
-#endif
index 8818fa6..b088f95 100644 (file)
 
     #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 <ack/signal.h>
 #endif
+typedef void (*sighandler_t)(int);
 
 /* Time handling. */
 
index d7ec086..55c0f3a 100644 (file)
@@ -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 (file)
index 0000000..aa07e30
--- /dev/null
@@ -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
index ba64a6d..6d6baa5 100644 (file)
@@ -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 (file)
index 0000000..0eda979
--- /dev/null
@@ -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
index 859a373..78ac324 100644 (file)
@@ -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 (file)
index 0000000..80d2b06
--- /dev/null
@@ -0,0 +1,8 @@
+#ifndef _SYS_IOCTL_H
+#define _SYS_IOCTL_H
+
+#define TIOCGETD        0x4004741a
+
+extern int ioctl(int fd, unsigned long request, ...);
+
+#endif
index b4561b7..e133027 100644 (file)
@@ -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 (file)
index bafa2a6..0000000
+++ /dev/null
@@ -1,137 +0,0 @@
-#ifndef _UNISTD_H
-#define _UNISTD_H
-
-#include <sys/types.h>
-
-/*
- * 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 <time.h> */
-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