From 7eaa235fd1d5566cefc06a28713dab9f4d26abeb Mon Sep 17 00:00:00 2001 From: David Given Date: Wed, 13 Jun 2018 21:44:25 +0900 Subject: [PATCH] Bodge the ancient em monitor library into building as a libsys for the em22 plat. It's completely untested, but it builds and makes e.out executables. --- lang/cem/libcc.ansi/stdlib/system.c | 4 +- lang/cem/libcc/mon/cleanup.c | 2 - lang/m2/libm2/init.c | 2 +- {lang/cem/libcc/mon => plat/em/libsys}/LIST | 0 .../cem/libcc/mon => plat/em/libsys}/_alarm.e | 0 {lang/cem/libcc/mon => plat/em/libsys}/_brk.e | 0 .../cem/libcc/mon => plat/em/libsys}/_close.e | 0 .../cem/libcc/mon => plat/em/libsys}/_creat.e | 0 {lang/cem/libcc/mon => plat/em/libsys}/_dup.e | 0 .../cem/libcc/mon => plat/em/libsys}/_dup2.e | 0 .../cem/libcc/mon => plat/em/libsys}/_execl.e | 2 +- .../libcc/mon => plat/em/libsys}/_execve.e | 0 .../cem/libcc/mon => plat/em/libsys}/_exit.e | 0 .../cem/libcc/mon => plat/em/libsys}/_fork.e | 0 .../cem/libcc/mon => plat/em/libsys}/_fstat.e | 0 .../cem/libcc/mon => plat/em/libsys}/_ftime.e | 0 .../libcc/mon => plat/em/libsys}/_getpid.e | 0 .../cem/libcc/mon => plat/em/libsys}/_gtty.c | 0 .../cem/libcc/mon => plat/em/libsys}/_ioctl.e | 0 .../cem/libcc/mon => plat/em/libsys}/_kill.e | 0 .../cem/libcc/mon => plat/em/libsys}/_link.e | 0 .../cem/libcc/mon => plat/em/libsys}/_lseek.e | 0 .../cem/libcc/mon => plat/em/libsys}/_open.e | 0 .../cem/libcc/mon => plat/em/libsys}/_pause.e | 0 .../cem/libcc/mon => plat/em/libsys}/_pipe.e | 0 .../cem/libcc/mon => plat/em/libsys}/_read.e | 0 .../cem/libcc/mon => plat/em/libsys}/_sbrk.e | 0 .../cem/libcc/mon => plat/em/libsys}/_stty.c | 0 .../cem/libcc/mon => plat/em/libsys}/_times.e | 0 .../libcc/mon => plat/em/libsys}/_unlink.e | 0 .../cem/libcc/mon => plat/em/libsys}/_wait.e | 0 .../cem/libcc/mon => plat/em/libsys}/_write.e | 0 .../cem/libcc/mon => plat/em/libsys}/access.e | 0 {lang/cem/libcc/mon => plat/em/libsys}/acct.e | 0 .../cem/libcc/mon => plat/em/libsys}/alarm.e | 0 {lang/cem/libcc/mon => plat/em/libsys}/brk.e | 0 .../cem/libcc/mon => plat/em/libsys}/chdir.e | 0 .../cem/libcc/mon => plat/em/libsys}/chmod.e | 0 .../cem/libcc/mon => plat/em/libsys}/chown.e | 0 .../cem/libcc/mon => plat/em/libsys}/chroot.e | 0 .../cem/libcc/mon => plat/em/libsys}/close.e | 0 .../cem/libcc/mon => plat/em/libsys}/creat.e | 0 {lang/cem/libcc/mon => plat/em/libsys}/dup.e | 0 {lang/cem/libcc/mon => plat/em/libsys}/dup2.e | 0 .../cem/libcc/mon => plat/em/libsys}/errno.e | 0 .../cem/libcc/mon => plat/em/libsys}/execl.e | 2 +- .../cem/libcc/mon => plat/em/libsys}/execle.e | 0 .../cem/libcc/mon => plat/em/libsys}/execv.e | 2 +- .../cem/libcc/mon => plat/em/libsys}/execve.e | 0 {lang/cem/libcc/mon => plat/em/libsys}/fork.e | 0 .../cem/libcc/mon => plat/em/libsys}/fstat.e | 0 .../cem/libcc/mon => plat/em/libsys}/ftime.e | 0 .../libcc/mon => plat/em/libsys}/getegid.e | 0 .../libcc/mon => plat/em/libsys}/geteuid.e | 0 .../cem/libcc/mon => plat/em/libsys}/getgid.e | 0 .../cem/libcc/mon => plat/em/libsys}/getpid.e | 0 .../cem/libcc/mon => plat/em/libsys}/getuid.e | 0 {lang/cem/libcc/mon => plat/em/libsys}/gtty.c | 0 .../cem/libcc/mon => plat/em/libsys}/ioctl.e | 0 plat/em/libsys/isatty.c | 12 ++ {lang/cem/libcc/mon => plat/em/libsys}/kill.e | 0 {lang/cem/libcc/mon => plat/em/libsys}/link.e | 0 {lang/cem/libcc/mon => plat/em/libsys}/lock.e | 0 .../cem/libcc/mon => plat/em/libsys}/lseek.e | 0 .../cem/libcc/mon => plat/em/libsys}/mknod.e | 0 .../cem/libcc/mon => plat/em/libsys}/mount.e | 0 .../libcc/mon => plat/em/libsys}/mpxcall.e | 0 {lang/cem/libcc/mon => plat/em/libsys}/nice.e | 0 {lang/cem/libcc/mon => plat/em/libsys}/open.e | 0 .../cem/libcc/mon => plat/em/libsys}/pause.e | 0 {lang/cem/libcc/mon => plat/em/libsys}/pipe.e | 0 {lang/cem/libcc/mon => plat/em/libsys}/prof.e | 0 .../cem/libcc/mon => plat/em/libsys}/ptrace.e | 0 {lang/cem/libcc/mon => plat/em/libsys}/read.e | 0 {lang/cem/libcc/mon => plat/em/libsys}/sbrk.e | 0 .../cem/libcc/mon => plat/em/libsys}/setgid.e | 0 .../cem/libcc/mon => plat/em/libsys}/setsig.e | 0 .../cem/libcc/mon => plat/em/libsys}/setuid.e | 0 .../cem/libcc/mon => plat/em/libsys}/signal.c | 0 .../cem/libcc/mon => plat/em/libsys}/sigtrp.e | 0 {lang/cem/libcc/mon => plat/em/libsys}/stat.e | 0 .../cem/libcc/mon => plat/em/libsys}/stime.e | 0 {lang/cem/libcc/mon => plat/em/libsys}/stty.c | 0 {lang/cem/libcc/mon => plat/em/libsys}/sync.e | 0 {lang/cem/libcc/mon => plat/em/libsys}/tell.c | 0 {lang/cem/libcc/mon => plat/em/libsys}/time.c | 0 .../cem/libcc/mon => plat/em/libsys}/times.e | 0 {lang/cem/libcc/mon => plat/em/libsys}/types | 0 .../cem/libcc/mon => plat/em/libsys}/umask.e | 0 .../cem/libcc/mon => plat/em/libsys}/umount.e | 0 .../cem/libcc/mon => plat/em/libsys}/unlink.e | 0 .../cem/libcc/mon => plat/em/libsys}/utime.e | 0 {lang/cem/libcc/mon => plat/em/libsys}/wait.e | 0 .../cem/libcc/mon => plat/em/libsys}/write.e | 0 plat/em22/build-pkg.lua | 1 + plat/em22/include/build.lua | 3 + plat/em22/include/sgtty.h | 119 ++++++++++++++++++ .../exit.c => plat/em22/include/sys/timeb.h | 13 +- plat/em22/include/sys/types.h | 18 +++ plat/em22/include/unistd.h | 22 +++- plat/em22/libsys/build.lua | 19 +++ 101 files changed, 202 insertions(+), 19 deletions(-) delete mode 100644 lang/cem/libcc/mon/cleanup.c rename {lang/cem/libcc/mon => plat/em/libsys}/LIST (100%) rename {lang/cem/libcc/mon => plat/em/libsys}/_alarm.e (100%) rename {lang/cem/libcc/mon => plat/em/libsys}/_brk.e (100%) rename {lang/cem/libcc/mon => plat/em/libsys}/_close.e (100%) rename {lang/cem/libcc/mon => plat/em/libsys}/_creat.e (100%) rename {lang/cem/libcc/mon => plat/em/libsys}/_dup.e (100%) rename {lang/cem/libcc/mon => plat/em/libsys}/_dup2.e (100%) rename {lang/cem/libcc/mon => plat/em/libsys}/_execl.e (92%) rename {lang/cem/libcc/mon => plat/em/libsys}/_execve.e (100%) rename {lang/cem/libcc/mon => plat/em/libsys}/_exit.e (100%) rename {lang/cem/libcc/mon => plat/em/libsys}/_fork.e (100%) rename {lang/cem/libcc/mon => plat/em/libsys}/_fstat.e (100%) rename {lang/cem/libcc/mon => plat/em/libsys}/_ftime.e (100%) rename {lang/cem/libcc/mon => plat/em/libsys}/_getpid.e (100%) rename {lang/cem/libcc/mon => plat/em/libsys}/_gtty.c (100%) rename {lang/cem/libcc/mon => plat/em/libsys}/_ioctl.e (100%) rename {lang/cem/libcc/mon => plat/em/libsys}/_kill.e (100%) rename {lang/cem/libcc/mon => plat/em/libsys}/_link.e (100%) rename {lang/cem/libcc/mon => plat/em/libsys}/_lseek.e (100%) rename {lang/cem/libcc/mon => plat/em/libsys}/_open.e (100%) rename {lang/cem/libcc/mon => plat/em/libsys}/_pause.e (100%) rename {lang/cem/libcc/mon => plat/em/libsys}/_pipe.e (100%) rename {lang/cem/libcc/mon => plat/em/libsys}/_read.e (100%) rename {lang/cem/libcc/mon => plat/em/libsys}/_sbrk.e (100%) rename {lang/cem/libcc/mon => plat/em/libsys}/_stty.c (100%) rename {lang/cem/libcc/mon => plat/em/libsys}/_times.e (100%) rename {lang/cem/libcc/mon => plat/em/libsys}/_unlink.e (100%) rename {lang/cem/libcc/mon => plat/em/libsys}/_wait.e (100%) rename {lang/cem/libcc/mon => plat/em/libsys}/_write.e (100%) rename {lang/cem/libcc/mon => plat/em/libsys}/access.e (100%) rename {lang/cem/libcc/mon => plat/em/libsys}/acct.e (100%) rename {lang/cem/libcc/mon => plat/em/libsys}/alarm.e (100%) rename {lang/cem/libcc/mon => plat/em/libsys}/brk.e (100%) rename {lang/cem/libcc/mon => plat/em/libsys}/chdir.e (100%) rename {lang/cem/libcc/mon => plat/em/libsys}/chmod.e (100%) rename {lang/cem/libcc/mon => plat/em/libsys}/chown.e (100%) rename {lang/cem/libcc/mon => plat/em/libsys}/chroot.e (100%) rename {lang/cem/libcc/mon => plat/em/libsys}/close.e (100%) rename {lang/cem/libcc/mon => plat/em/libsys}/creat.e (100%) rename {lang/cem/libcc/mon => plat/em/libsys}/dup.e (100%) rename {lang/cem/libcc/mon => plat/em/libsys}/dup2.e (100%) rename {lang/cem/libcc/mon => plat/em/libsys}/errno.e (100%) rename {lang/cem/libcc/mon => plat/em/libsys}/execl.e (92%) rename {lang/cem/libcc/mon => plat/em/libsys}/execle.e (100%) rename {lang/cem/libcc/mon => plat/em/libsys}/execv.e (91%) rename {lang/cem/libcc/mon => plat/em/libsys}/execve.e (100%) rename {lang/cem/libcc/mon => plat/em/libsys}/fork.e (100%) rename {lang/cem/libcc/mon => plat/em/libsys}/fstat.e (100%) rename {lang/cem/libcc/mon => plat/em/libsys}/ftime.e (100%) rename {lang/cem/libcc/mon => plat/em/libsys}/getegid.e (100%) rename {lang/cem/libcc/mon => plat/em/libsys}/geteuid.e (100%) rename {lang/cem/libcc/mon => plat/em/libsys}/getgid.e (100%) rename {lang/cem/libcc/mon => plat/em/libsys}/getpid.e (100%) rename {lang/cem/libcc/mon => plat/em/libsys}/getuid.e (100%) rename {lang/cem/libcc/mon => plat/em/libsys}/gtty.c (100%) rename {lang/cem/libcc/mon => plat/em/libsys}/ioctl.e (100%) create mode 100644 plat/em/libsys/isatty.c rename {lang/cem/libcc/mon => plat/em/libsys}/kill.e (100%) rename {lang/cem/libcc/mon => plat/em/libsys}/link.e (100%) rename {lang/cem/libcc/mon => plat/em/libsys}/lock.e (100%) rename {lang/cem/libcc/mon => plat/em/libsys}/lseek.e (100%) rename {lang/cem/libcc/mon => plat/em/libsys}/mknod.e (100%) rename {lang/cem/libcc/mon => plat/em/libsys}/mount.e (100%) rename {lang/cem/libcc/mon => plat/em/libsys}/mpxcall.e (100%) rename {lang/cem/libcc/mon => plat/em/libsys}/nice.e (100%) rename {lang/cem/libcc/mon => plat/em/libsys}/open.e (100%) rename {lang/cem/libcc/mon => plat/em/libsys}/pause.e (100%) rename {lang/cem/libcc/mon => plat/em/libsys}/pipe.e (100%) rename {lang/cem/libcc/mon => plat/em/libsys}/prof.e (100%) rename {lang/cem/libcc/mon => plat/em/libsys}/ptrace.e (100%) rename {lang/cem/libcc/mon => plat/em/libsys}/read.e (100%) rename {lang/cem/libcc/mon => plat/em/libsys}/sbrk.e (100%) rename {lang/cem/libcc/mon => plat/em/libsys}/setgid.e (100%) rename {lang/cem/libcc/mon => plat/em/libsys}/setsig.e (100%) rename {lang/cem/libcc/mon => plat/em/libsys}/setuid.e (100%) rename {lang/cem/libcc/mon => plat/em/libsys}/signal.c (100%) rename {lang/cem/libcc/mon => plat/em/libsys}/sigtrp.e (100%) rename {lang/cem/libcc/mon => plat/em/libsys}/stat.e (100%) rename {lang/cem/libcc/mon => plat/em/libsys}/stime.e (100%) rename {lang/cem/libcc/mon => plat/em/libsys}/stty.c (100%) rename {lang/cem/libcc/mon => plat/em/libsys}/sync.e (100%) rename {lang/cem/libcc/mon => plat/em/libsys}/tell.c (100%) rename {lang/cem/libcc/mon => plat/em/libsys}/time.c (100%) rename {lang/cem/libcc/mon => plat/em/libsys}/times.e (100%) rename {lang/cem/libcc/mon => plat/em/libsys}/types (100%) rename {lang/cem/libcc/mon => plat/em/libsys}/umask.e (100%) rename {lang/cem/libcc/mon => plat/em/libsys}/umount.e (100%) rename {lang/cem/libcc/mon => plat/em/libsys}/unlink.e (100%) rename {lang/cem/libcc/mon => plat/em/libsys}/utime.e (100%) rename {lang/cem/libcc/mon => plat/em/libsys}/wait.e (100%) rename {lang/cem/libcc/mon => plat/em/libsys}/write.e (100%) create mode 100644 plat/em22/include/sgtty.h rename lang/cem/libcc/mon/exit.c => plat/em22/include/sys/timeb.h (66%) create mode 100644 plat/em22/include/sys/types.h create mode 100644 plat/em22/libsys/build.lua diff --git a/lang/cem/libcc.ansi/stdlib/system.c b/lang/cem/libcc.ansi/stdlib/system.c index efdb5c86c..313ee32f5 100644 --- a/lang/cem/libcc.ansi/stdlib/system.c +++ b/lang/cem/libcc.ansi/stdlib/system.c @@ -18,7 +18,7 @@ extern void _close(int); #define FAIL 127 -extern const char **_penvp; +extern const char **environ; static const char *exec_tab[] = { "sh", /* argv[0] */ "-c", /* argument to the shell */ @@ -39,7 +39,7 @@ system(const char *str) _close(i); if (!str) str = "cd ."; /* just testing for a shell */ exec_tab[2] = str; /* fill in command */ - _execve("/bin/sh", exec_tab, _penvp); + _execve("/bin/sh", exec_tab, environ); /* get here if execve fails ... */ _exit(FAIL); /* see manual page */ } diff --git a/lang/cem/libcc/mon/cleanup.c b/lang/cem/libcc/mon/cleanup.c deleted file mode 100644 index b19a5a06a..000000000 --- a/lang/cem/libcc/mon/cleanup.c +++ /dev/null @@ -1,2 +0,0 @@ -/* $Id$ */ -_cleanup(){} diff --git a/lang/m2/libm2/init.c b/lang/m2/libm2/init.c index c9fe9fbf4..d3c60bcea 100644 --- a/lang/m2/libm2/init.c +++ b/lang/m2/libm2/init.c @@ -93,6 +93,6 @@ killbss() extern int catch(); int (*handler)() = catch; -char **argv = 0, **environ = 0; +char **argv = 0; int argc = 0; char *MainLB = 0; diff --git a/lang/cem/libcc/mon/LIST b/plat/em/libsys/LIST similarity index 100% rename from lang/cem/libcc/mon/LIST rename to plat/em/libsys/LIST diff --git a/lang/cem/libcc/mon/_alarm.e b/plat/em/libsys/_alarm.e similarity index 100% rename from lang/cem/libcc/mon/_alarm.e rename to plat/em/libsys/_alarm.e diff --git a/lang/cem/libcc/mon/_brk.e b/plat/em/libsys/_brk.e similarity index 100% rename from lang/cem/libcc/mon/_brk.e rename to plat/em/libsys/_brk.e diff --git a/lang/cem/libcc/mon/_close.e b/plat/em/libsys/_close.e similarity index 100% rename from lang/cem/libcc/mon/_close.e rename to plat/em/libsys/_close.e diff --git a/lang/cem/libcc/mon/_creat.e b/plat/em/libsys/_creat.e similarity index 100% rename from lang/cem/libcc/mon/_creat.e rename to plat/em/libsys/_creat.e diff --git a/lang/cem/libcc/mon/_dup.e b/plat/em/libsys/_dup.e similarity index 100% rename from lang/cem/libcc/mon/_dup.e rename to plat/em/libsys/_dup.e diff --git a/lang/cem/libcc/mon/_dup2.e b/plat/em/libsys/_dup2.e similarity index 100% rename from lang/cem/libcc/mon/_dup2.e rename to plat/em/libsys/_dup2.e diff --git a/lang/cem/libcc/mon/_execl.e b/plat/em/libsys/_execl.e similarity index 92% rename from lang/cem/libcc/mon/_execl.e rename to plat/em/libsys/_execl.e index 1fcdfd7a3..3ce7ed5c8 100644 --- a/lang/cem/libcc/mon/_execl.e +++ b/plat/em/libsys/_execl.e @@ -2,7 +2,7 @@ mes 2,EM_WSIZE,EM_PSIZE exp $_execl pro $_execl,0 - lae _penvp + lae environ loi EM_PSIZE lal EM_PSIZE lal 0 diff --git a/lang/cem/libcc/mon/_execve.e b/plat/em/libsys/_execve.e similarity index 100% rename from lang/cem/libcc/mon/_execve.e rename to plat/em/libsys/_execve.e diff --git a/lang/cem/libcc/mon/_exit.e b/plat/em/libsys/_exit.e similarity index 100% rename from lang/cem/libcc/mon/_exit.e rename to plat/em/libsys/_exit.e diff --git a/lang/cem/libcc/mon/_fork.e b/plat/em/libsys/_fork.e similarity index 100% rename from lang/cem/libcc/mon/_fork.e rename to plat/em/libsys/_fork.e diff --git a/lang/cem/libcc/mon/_fstat.e b/plat/em/libsys/_fstat.e similarity index 100% rename from lang/cem/libcc/mon/_fstat.e rename to plat/em/libsys/_fstat.e diff --git a/lang/cem/libcc/mon/_ftime.e b/plat/em/libsys/_ftime.e similarity index 100% rename from lang/cem/libcc/mon/_ftime.e rename to plat/em/libsys/_ftime.e diff --git a/lang/cem/libcc/mon/_getpid.e b/plat/em/libsys/_getpid.e similarity index 100% rename from lang/cem/libcc/mon/_getpid.e rename to plat/em/libsys/_getpid.e diff --git a/lang/cem/libcc/mon/_gtty.c b/plat/em/libsys/_gtty.c similarity index 100% rename from lang/cem/libcc/mon/_gtty.c rename to plat/em/libsys/_gtty.c diff --git a/lang/cem/libcc/mon/_ioctl.e b/plat/em/libsys/_ioctl.e similarity index 100% rename from lang/cem/libcc/mon/_ioctl.e rename to plat/em/libsys/_ioctl.e diff --git a/lang/cem/libcc/mon/_kill.e b/plat/em/libsys/_kill.e similarity index 100% rename from lang/cem/libcc/mon/_kill.e rename to plat/em/libsys/_kill.e diff --git a/lang/cem/libcc/mon/_link.e b/plat/em/libsys/_link.e similarity index 100% rename from lang/cem/libcc/mon/_link.e rename to plat/em/libsys/_link.e diff --git a/lang/cem/libcc/mon/_lseek.e b/plat/em/libsys/_lseek.e similarity index 100% rename from lang/cem/libcc/mon/_lseek.e rename to plat/em/libsys/_lseek.e diff --git a/lang/cem/libcc/mon/_open.e b/plat/em/libsys/_open.e similarity index 100% rename from lang/cem/libcc/mon/_open.e rename to plat/em/libsys/_open.e diff --git a/lang/cem/libcc/mon/_pause.e b/plat/em/libsys/_pause.e similarity index 100% rename from lang/cem/libcc/mon/_pause.e rename to plat/em/libsys/_pause.e diff --git a/lang/cem/libcc/mon/_pipe.e b/plat/em/libsys/_pipe.e similarity index 100% rename from lang/cem/libcc/mon/_pipe.e rename to plat/em/libsys/_pipe.e diff --git a/lang/cem/libcc/mon/_read.e b/plat/em/libsys/_read.e similarity index 100% rename from lang/cem/libcc/mon/_read.e rename to plat/em/libsys/_read.e diff --git a/lang/cem/libcc/mon/_sbrk.e b/plat/em/libsys/_sbrk.e similarity index 100% rename from lang/cem/libcc/mon/_sbrk.e rename to plat/em/libsys/_sbrk.e diff --git a/lang/cem/libcc/mon/_stty.c b/plat/em/libsys/_stty.c similarity index 100% rename from lang/cem/libcc/mon/_stty.c rename to plat/em/libsys/_stty.c diff --git a/lang/cem/libcc/mon/_times.e b/plat/em/libsys/_times.e similarity index 100% rename from lang/cem/libcc/mon/_times.e rename to plat/em/libsys/_times.e diff --git a/lang/cem/libcc/mon/_unlink.e b/plat/em/libsys/_unlink.e similarity index 100% rename from lang/cem/libcc/mon/_unlink.e rename to plat/em/libsys/_unlink.e diff --git a/lang/cem/libcc/mon/_wait.e b/plat/em/libsys/_wait.e similarity index 100% rename from lang/cem/libcc/mon/_wait.e rename to plat/em/libsys/_wait.e diff --git a/lang/cem/libcc/mon/_write.e b/plat/em/libsys/_write.e similarity index 100% rename from lang/cem/libcc/mon/_write.e rename to plat/em/libsys/_write.e diff --git a/lang/cem/libcc/mon/access.e b/plat/em/libsys/access.e similarity index 100% rename from lang/cem/libcc/mon/access.e rename to plat/em/libsys/access.e diff --git a/lang/cem/libcc/mon/acct.e b/plat/em/libsys/acct.e similarity index 100% rename from lang/cem/libcc/mon/acct.e rename to plat/em/libsys/acct.e diff --git a/lang/cem/libcc/mon/alarm.e b/plat/em/libsys/alarm.e similarity index 100% rename from lang/cem/libcc/mon/alarm.e rename to plat/em/libsys/alarm.e diff --git a/lang/cem/libcc/mon/brk.e b/plat/em/libsys/brk.e similarity index 100% rename from lang/cem/libcc/mon/brk.e rename to plat/em/libsys/brk.e diff --git a/lang/cem/libcc/mon/chdir.e b/plat/em/libsys/chdir.e similarity index 100% rename from lang/cem/libcc/mon/chdir.e rename to plat/em/libsys/chdir.e diff --git a/lang/cem/libcc/mon/chmod.e b/plat/em/libsys/chmod.e similarity index 100% rename from lang/cem/libcc/mon/chmod.e rename to plat/em/libsys/chmod.e diff --git a/lang/cem/libcc/mon/chown.e b/plat/em/libsys/chown.e similarity index 100% rename from lang/cem/libcc/mon/chown.e rename to plat/em/libsys/chown.e diff --git a/lang/cem/libcc/mon/chroot.e b/plat/em/libsys/chroot.e similarity index 100% rename from lang/cem/libcc/mon/chroot.e rename to plat/em/libsys/chroot.e diff --git a/lang/cem/libcc/mon/close.e b/plat/em/libsys/close.e similarity index 100% rename from lang/cem/libcc/mon/close.e rename to plat/em/libsys/close.e diff --git a/lang/cem/libcc/mon/creat.e b/plat/em/libsys/creat.e similarity index 100% rename from lang/cem/libcc/mon/creat.e rename to plat/em/libsys/creat.e diff --git a/lang/cem/libcc/mon/dup.e b/plat/em/libsys/dup.e similarity index 100% rename from lang/cem/libcc/mon/dup.e rename to plat/em/libsys/dup.e diff --git a/lang/cem/libcc/mon/dup2.e b/plat/em/libsys/dup2.e similarity index 100% rename from lang/cem/libcc/mon/dup2.e rename to plat/em/libsys/dup2.e diff --git a/lang/cem/libcc/mon/errno.e b/plat/em/libsys/errno.e similarity index 100% rename from lang/cem/libcc/mon/errno.e rename to plat/em/libsys/errno.e diff --git a/lang/cem/libcc/mon/execl.e b/plat/em/libsys/execl.e similarity index 92% rename from lang/cem/libcc/mon/execl.e rename to plat/em/libsys/execl.e index e958d65ae..706ce370b 100644 --- a/lang/cem/libcc/mon/execl.e +++ b/plat/em/libsys/execl.e @@ -2,7 +2,7 @@ mes 2,EM_WSIZE,EM_PSIZE exp $execl pro $execl,0 - lae _penvp + lae environ loi EM_PSIZE lal EM_PSIZE lal 0 diff --git a/lang/cem/libcc/mon/execle.e b/plat/em/libsys/execle.e similarity index 100% rename from lang/cem/libcc/mon/execle.e rename to plat/em/libsys/execle.e diff --git a/lang/cem/libcc/mon/execv.e b/plat/em/libsys/execv.e similarity index 91% rename from lang/cem/libcc/mon/execv.e rename to plat/em/libsys/execv.e index 5cbaa3444..7b127eeb9 100644 --- a/lang/cem/libcc/mon/execv.e +++ b/plat/em/libsys/execv.e @@ -2,7 +2,7 @@ mes 2,EM_WSIZE,EM_PSIZE exp $execv pro $execv,0 - lae _penvp + lae environ loi EM_PSIZE lal 0 loi 2*EM_PSIZE diff --git a/lang/cem/libcc/mon/execve.e b/plat/em/libsys/execve.e similarity index 100% rename from lang/cem/libcc/mon/execve.e rename to plat/em/libsys/execve.e diff --git a/lang/cem/libcc/mon/fork.e b/plat/em/libsys/fork.e similarity index 100% rename from lang/cem/libcc/mon/fork.e rename to plat/em/libsys/fork.e diff --git a/lang/cem/libcc/mon/fstat.e b/plat/em/libsys/fstat.e similarity index 100% rename from lang/cem/libcc/mon/fstat.e rename to plat/em/libsys/fstat.e diff --git a/lang/cem/libcc/mon/ftime.e b/plat/em/libsys/ftime.e similarity index 100% rename from lang/cem/libcc/mon/ftime.e rename to plat/em/libsys/ftime.e diff --git a/lang/cem/libcc/mon/getegid.e b/plat/em/libsys/getegid.e similarity index 100% rename from lang/cem/libcc/mon/getegid.e rename to plat/em/libsys/getegid.e diff --git a/lang/cem/libcc/mon/geteuid.e b/plat/em/libsys/geteuid.e similarity index 100% rename from lang/cem/libcc/mon/geteuid.e rename to plat/em/libsys/geteuid.e diff --git a/lang/cem/libcc/mon/getgid.e b/plat/em/libsys/getgid.e similarity index 100% rename from lang/cem/libcc/mon/getgid.e rename to plat/em/libsys/getgid.e diff --git a/lang/cem/libcc/mon/getpid.e b/plat/em/libsys/getpid.e similarity index 100% rename from lang/cem/libcc/mon/getpid.e rename to plat/em/libsys/getpid.e diff --git a/lang/cem/libcc/mon/getuid.e b/plat/em/libsys/getuid.e similarity index 100% rename from lang/cem/libcc/mon/getuid.e rename to plat/em/libsys/getuid.e diff --git a/lang/cem/libcc/mon/gtty.c b/plat/em/libsys/gtty.c similarity index 100% rename from lang/cem/libcc/mon/gtty.c rename to plat/em/libsys/gtty.c diff --git a/lang/cem/libcc/mon/ioctl.e b/plat/em/libsys/ioctl.e similarity index 100% rename from lang/cem/libcc/mon/ioctl.e rename to plat/em/libsys/ioctl.e diff --git a/plat/em/libsys/isatty.c b/plat/em/libsys/isatty.c new file mode 100644 index 000000000..f0ccbdcf0 --- /dev/null +++ b/plat/em/libsys/isatty.c @@ -0,0 +1,12 @@ +/* $Id$ */ +isatty(f) +{ + char buf[128]; + /* not a sgttyb struct; it might not be large enough; + I know for a fact that it is'nt large enough on PC/IX, + where gtty is an ioctl(..., TCGETA, ...) + */ + + if (gtty(f, buf) < 0) return 0; + return 1; +} diff --git a/lang/cem/libcc/mon/kill.e b/plat/em/libsys/kill.e similarity index 100% rename from lang/cem/libcc/mon/kill.e rename to plat/em/libsys/kill.e diff --git a/lang/cem/libcc/mon/link.e b/plat/em/libsys/link.e similarity index 100% rename from lang/cem/libcc/mon/link.e rename to plat/em/libsys/link.e diff --git a/lang/cem/libcc/mon/lock.e b/plat/em/libsys/lock.e similarity index 100% rename from lang/cem/libcc/mon/lock.e rename to plat/em/libsys/lock.e diff --git a/lang/cem/libcc/mon/lseek.e b/plat/em/libsys/lseek.e similarity index 100% rename from lang/cem/libcc/mon/lseek.e rename to plat/em/libsys/lseek.e diff --git a/lang/cem/libcc/mon/mknod.e b/plat/em/libsys/mknod.e similarity index 100% rename from lang/cem/libcc/mon/mknod.e rename to plat/em/libsys/mknod.e diff --git a/lang/cem/libcc/mon/mount.e b/plat/em/libsys/mount.e similarity index 100% rename from lang/cem/libcc/mon/mount.e rename to plat/em/libsys/mount.e diff --git a/lang/cem/libcc/mon/mpxcall.e b/plat/em/libsys/mpxcall.e similarity index 100% rename from lang/cem/libcc/mon/mpxcall.e rename to plat/em/libsys/mpxcall.e diff --git a/lang/cem/libcc/mon/nice.e b/plat/em/libsys/nice.e similarity index 100% rename from lang/cem/libcc/mon/nice.e rename to plat/em/libsys/nice.e diff --git a/lang/cem/libcc/mon/open.e b/plat/em/libsys/open.e similarity index 100% rename from lang/cem/libcc/mon/open.e rename to plat/em/libsys/open.e diff --git a/lang/cem/libcc/mon/pause.e b/plat/em/libsys/pause.e similarity index 100% rename from lang/cem/libcc/mon/pause.e rename to plat/em/libsys/pause.e diff --git a/lang/cem/libcc/mon/pipe.e b/plat/em/libsys/pipe.e similarity index 100% rename from lang/cem/libcc/mon/pipe.e rename to plat/em/libsys/pipe.e diff --git a/lang/cem/libcc/mon/prof.e b/plat/em/libsys/prof.e similarity index 100% rename from lang/cem/libcc/mon/prof.e rename to plat/em/libsys/prof.e diff --git a/lang/cem/libcc/mon/ptrace.e b/plat/em/libsys/ptrace.e similarity index 100% rename from lang/cem/libcc/mon/ptrace.e rename to plat/em/libsys/ptrace.e diff --git a/lang/cem/libcc/mon/read.e b/plat/em/libsys/read.e similarity index 100% rename from lang/cem/libcc/mon/read.e rename to plat/em/libsys/read.e diff --git a/lang/cem/libcc/mon/sbrk.e b/plat/em/libsys/sbrk.e similarity index 100% rename from lang/cem/libcc/mon/sbrk.e rename to plat/em/libsys/sbrk.e diff --git a/lang/cem/libcc/mon/setgid.e b/plat/em/libsys/setgid.e similarity index 100% rename from lang/cem/libcc/mon/setgid.e rename to plat/em/libsys/setgid.e diff --git a/lang/cem/libcc/mon/setsig.e b/plat/em/libsys/setsig.e similarity index 100% rename from lang/cem/libcc/mon/setsig.e rename to plat/em/libsys/setsig.e diff --git a/lang/cem/libcc/mon/setuid.e b/plat/em/libsys/setuid.e similarity index 100% rename from lang/cem/libcc/mon/setuid.e rename to plat/em/libsys/setuid.e diff --git a/lang/cem/libcc/mon/signal.c b/plat/em/libsys/signal.c similarity index 100% rename from lang/cem/libcc/mon/signal.c rename to plat/em/libsys/signal.c diff --git a/lang/cem/libcc/mon/sigtrp.e b/plat/em/libsys/sigtrp.e similarity index 100% rename from lang/cem/libcc/mon/sigtrp.e rename to plat/em/libsys/sigtrp.e diff --git a/lang/cem/libcc/mon/stat.e b/plat/em/libsys/stat.e similarity index 100% rename from lang/cem/libcc/mon/stat.e rename to plat/em/libsys/stat.e diff --git a/lang/cem/libcc/mon/stime.e b/plat/em/libsys/stime.e similarity index 100% rename from lang/cem/libcc/mon/stime.e rename to plat/em/libsys/stime.e diff --git a/lang/cem/libcc/mon/stty.c b/plat/em/libsys/stty.c similarity index 100% rename from lang/cem/libcc/mon/stty.c rename to plat/em/libsys/stty.c diff --git a/lang/cem/libcc/mon/sync.e b/plat/em/libsys/sync.e similarity index 100% rename from lang/cem/libcc/mon/sync.e rename to plat/em/libsys/sync.e diff --git a/lang/cem/libcc/mon/tell.c b/plat/em/libsys/tell.c similarity index 100% rename from lang/cem/libcc/mon/tell.c rename to plat/em/libsys/tell.c diff --git a/lang/cem/libcc/mon/time.c b/plat/em/libsys/time.c similarity index 100% rename from lang/cem/libcc/mon/time.c rename to plat/em/libsys/time.c diff --git a/lang/cem/libcc/mon/times.e b/plat/em/libsys/times.e similarity index 100% rename from lang/cem/libcc/mon/times.e rename to plat/em/libsys/times.e diff --git a/lang/cem/libcc/mon/types b/plat/em/libsys/types similarity index 100% rename from lang/cem/libcc/mon/types rename to plat/em/libsys/types diff --git a/lang/cem/libcc/mon/umask.e b/plat/em/libsys/umask.e similarity index 100% rename from lang/cem/libcc/mon/umask.e rename to plat/em/libsys/umask.e diff --git a/lang/cem/libcc/mon/umount.e b/plat/em/libsys/umount.e similarity index 100% rename from lang/cem/libcc/mon/umount.e rename to plat/em/libsys/umount.e diff --git a/lang/cem/libcc/mon/unlink.e b/plat/em/libsys/unlink.e similarity index 100% rename from lang/cem/libcc/mon/unlink.e rename to plat/em/libsys/unlink.e diff --git a/lang/cem/libcc/mon/utime.e b/plat/em/libsys/utime.e similarity index 100% rename from lang/cem/libcc/mon/utime.e rename to plat/em/libsys/utime.e diff --git a/lang/cem/libcc/mon/wait.e b/plat/em/libsys/wait.e similarity index 100% rename from lang/cem/libcc/mon/wait.e rename to plat/em/libsys/wait.e diff --git a/lang/cem/libcc/mon/write.e b/plat/em/libsys/write.e similarity index 100% rename from lang/cem/libcc/mon/write.e rename to plat/em/libsys/write.e diff --git a/plat/em22/build-pkg.lua b/plat/em22/build-pkg.lua index d69a0f0d9..5d65ed707 100644 --- a/plat/em22/build-pkg.lua +++ b/plat/em22/build-pkg.lua @@ -12,6 +12,7 @@ installable { map = { "+libs", "./include+pkg", + ["$(PLATIND)/em22/libsys.a"] = "./libsys+lib", } } diff --git a/plat/em22/include/build.lua b/plat/em22/include/build.lua index a6f60c4c5..298f9b033 100644 --- a/plat/em22/include/build.lua +++ b/plat/em22/include/build.lua @@ -9,7 +9,10 @@ local function addheader(h) end addheader("ack/config.h") +addheader("sys/types.h") +addheader("sys/timeb.h") addheader("unistd.h") +addheader("sgtty.h") acklibrary { name = "headers", diff --git a/plat/em22/include/sgtty.h b/plat/em22/include/sgtty.h new file mode 100644 index 000000000..547a4ee6d --- /dev/null +++ b/plat/em22/include/sgtty.h @@ -0,0 +1,119 @@ +/* $Id$ */ +/* + * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands. + * See the copyright notice in the ACK home directory, in the file "Copyright". + */ +/* Data structures for ioctl/stty/gtty, sufficient for ACK libraries */ + +#ifndef _SGTTY_H +#define _SGTTY_H + +struct sgttyb { + char sg_ispeed; /* input speed (not used) */ + char sg_ospeed; /* output speed (not used) */ + char sg_erase; /* erase character */ + char sg_kill; /* kill character */ +#if defined(__USG) && !defined(_XENIX) + int sg_flags; /* mode flags */ +#else + short sg_flags; /* mode flags */ +#endif +}; + +struct tchars { + char t_intrc; /* SIGINT char */ + char t_quitc; /* SIGQUIT char */ + char t_startc; /* start output (initially CTRL-Q) */ + char t_stopc; /* stop output (initially CTRL-S) */ + char t_eofc; /* EOF (initially CTRL-D) */ + char t_brkc; /* input delimiter (like nl) */ +}; + +/* Fields in t_flags. */ +#define ALLDELAY 0177400 + +#define BSDELAY 0100000 +# define BS0 0000000 +# define BS1 0100000 + +#define VTDELAY 0040000 +# define FF0 0000000 +# define FF1 0040000 + +#define CRDELAY 0030000 +# define CR0 0000000 +# define CR1 0010000 +# define CR2 0020000 +# define CR3 0030000 + +#if defined(__USG) && !defined(_XENIX) +#define XTABS 0000002 /* do tab expansion */ +#else +#define XTABS 0006000 /* do tab expansion */ +#endif + +#define TBDELAY 0006000 +# define TAB0 0000000 +# define TAB1 0002000 +# define TAB2 0004000 + +#define NLDELAY 0001400 +# define NL0 0000000 +# define NL1 0000400 +# define NL2 0001000 +# define NL3 0001400 + +#define ANYP 0000300 +#define EVENP 0000200 +#define ODDP 0000100 + +#define RAW 0000040 /* enable raw mode */ +#define CRMOD 0000020 /* map lf to cr + lf */ +#define ECHO 0000010 /* echo input */ +#define LCASE 0000004 +#define CBREAK 0000002 /* enable cbreak mode */ +#if defined(__BSD4_2) || defined(_XENIX) +#define TANDEM 0000001 +#else +#define HUPCL 0000001 /* unused ??? */ +#endif +/*#define COOKED 0000000 */ /* neither CBREAK nor RAW */ + +#ifdef __BDS4_2 +#define TIOCGETP (('t'<<8) | 8 | (6 << 16) | 0x40000000) +#define TIOCSETP (('t'<<8) | 9 | (6 << 16) | 0x80000000) +#define TIOCSETN (('t'<<8) | 10 | (6 << 16) | 0x80000000) +#define TIOCEXCL (('t'<<8) | 13 | 0x20000000) +#define TIOCNXCL (('t'<<8) | 14 | 0x20000000) +#define TIOCHPCL (('t'<<8) | 2 | 0x20000000) +#define TIOCGETC (('t'<<8) | 18 | (6 << 16) | 0x40000000) +#define TIOCSETC (('t'<<8) | 17 | (6 << 16) | 0x80000000) +#else +#define TIOCGETP (('t'<<8) | 8) +#define TIOCSETP (('t'<<8) | 9) +#define TIOCSETN (('t'<<8) | 10) +#define TIOCEXCL (('t'<<8) | 13) +#define TIOCNXCL (('t'<<8) | 14) +#define TIOCHPCL (('t'<<8) | 2) +#define TIOCGETC (('t'<<8) | 18) +#define TIOCSETC (('t'<<8) | 17) +#endif + +#define B0 0 +#define B50 1 +#define B75 2 +#define B110 3 +#define B134 4 +#define B150 5 +#define B200 6 +#define B300 7 +#define B600 8 +#define B1200 9 +#define B1800 10 +#define B2400 11 +#define B4800 12 +#define B9600 13 +#define EXTA 14 +#define EXTB 15 + +#endif /* _SGTTY_H */ diff --git a/lang/cem/libcc/mon/exit.c b/plat/em22/include/sys/timeb.h similarity index 66% rename from lang/cem/libcc/mon/exit.c rename to plat/em22/include/sys/timeb.h index a73ec4daa..92f48ed9d 100644 --- a/lang/cem/libcc/mon/exit.c +++ b/plat/em22/include/sys/timeb.h @@ -1,12 +1,11 @@ /* $Id$ */ - /* * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands. * See the copyright notice in the ACK home directory, in the file "Copyright". */ - -exit(code) -{ - _cleanup() ; - _exit(code) ; -} +struct timeb { + time_t time; + unsigned short millitm; + short timezone; + short dstflag; +}; diff --git a/plat/em22/include/sys/types.h b/plat/em22/include/sys/types.h new file mode 100644 index 000000000..8d431b051 --- /dev/null +++ b/plat/em22/include/sys/types.h @@ -0,0 +1,18 @@ +#ifndef _SYS_TYPES_H +#define _SYS_TYPES_H + +#include /* for off_t, ptrdiff_t, size_t */ + +typedef int blkcnt_t; /* XXX should have 64 bits */ +typedef int blksize_t; +typedef int dev_t; +typedef unsigned int gid_t; +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 unsigned long time_t; + +#endif diff --git a/plat/em22/include/unistd.h b/plat/em22/include/unistd.h index 30f13d994..7b455738f 100644 --- a/plat/em22/include/unistd.h +++ b/plat/em22/include/unistd.h @@ -59,11 +59,25 @@ typedef int sig_atomic_t; #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 16 /* number of signals used */ + +#define SIGHUP 1 /* hangup */ +#define SIGINT 2 /* interrupt (DEL) */ +#define SIGQUIT 3 /* quit (ASCII FS) */ +#define SIGILL 4 /* illegal instruction */ +#define SIGTRAP 5 /* trace trap (not reset when caught) */ +#define SIGABRT 6 /* IOT instruction */ +#define SIGIOT 6 /* SIGABRT for people who speak PDP-11 */ +#define SIGEMT 7 /* EMT instruction */ +#define SIGFPE 8 /* floating point exception */ +#define SIGKILL 9 /* kill (cannot be caught or ignored) */ +#define SIGBUS 10 /* bus error */ +#define SIGSEGV 11 /* segmentation violation */ +#define SIGSYS 12 /* bad argument to system call */ +#define SIGPIPE 13 /* write on a pipe with no one to read it */ +#define SIGALRM 14 /* alarm clock */ +#define SIGTERM 15 /* software termination signal from kill */ -#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); diff --git a/plat/em22/libsys/build.lua b/plat/em22/libsys/build.lua new file mode 100644 index 000000000..7fdc388c4 --- /dev/null +++ b/plat/em22/libsys/build.lua @@ -0,0 +1,19 @@ +acklibrary { + name = "lib", + srcs = { + "./*.e", + "./*.c", + "plat/em/libsys/*.c", + "plat/em/libsys/*.e", + }, + deps = { + "plat/em/libsys/*.h", + "lang/cem/libcc.ansi/headers+headers", + "plat/em22/include+pkg", + "h+emheaders", + }, + vars = { + plat = "em22" + } +} +