Get moncalls.c to compile on OpenBSD.

Remove some declarations (not all correct) and #include <errno.h>,
<time.h>, and <unistd.h> to get the correct declarations.

Disable mount(2), umount(2), and stime(2) because BSD (around
4.3BSD-Reno) lost compatibility with these Unix v7 functions.
This commit is contained in:
George Koehler 2018-06-10 16:29:52 -04:00
parent 250777d1ca
commit a000c62808
2 changed files with 12 additions and 15 deletions

View file

@ -11,12 +11,10 @@
#include <sys/types.h> #include <sys/types.h>
#include <sys/stat.h> #include <sys/stat.h>
#if __STDC__
#include <time.h>
#endif
#include <sys/times.h> #include <sys/times.h>
#include <errno.h>
extern int errno; /* UNIX error number */ #include <time.h>
#include <unistd.h>
extern int running; /* from main.c */ extern int running; /* from main.c */
extern int fd_limit; /* from io.c */ extern int fd_limit; /* from io.c */
@ -39,10 +37,7 @@ struct timeb { /* non-existing; we use an ad-hoc definition */
#endif /* BSD4_2 */ #endif /* BSD4_2 */
#ifdef SYS_V #ifdef SYS_V
#include <sys/errno.h>
#undef ERANGE /* collision with trap.h */
#include <fcntl.h> #include <fcntl.h>
#include <time.h>
#endif /* SYS_V */ #endif /* SYS_V */
#include <em_abs.h> #include <em_abs.h>
@ -57,13 +52,6 @@ struct timeb { /* non-existing; we use an ad-hoc definition */
#define DUPMASK 0x40 #define DUPMASK 0x40
extern long lseek();
#ifdef SYS_V
extern unsigned int alarm();
extern long time();
extern void sync();
#endif /* SYS_V */
#define INT2SIZE max(wsize, 2L) #define INT2SIZE max(wsize, 2L)
#define INT4SIZE max(wsize, 4L) #define INT4SIZE max(wsize, 4L)
@ -548,6 +536,7 @@ moncall()
LOG(("@m9 Getpid: succeeded, pid = %d", pid)); LOG(("@m9 Getpid: succeeded, pid = %d", pid));
break; break;
#ifdef WANT_MOUNT_UMOUNT
case 21: /* Mount */ case 21: /* Mount */
dsp1 = pop_ptr(); dsp1 = pop_ptr();
@ -587,6 +576,7 @@ moncall()
LOG(("@m9 Mount: succeeded, dsp1 = %lu", dsp1)); LOG(("@m9 Mount: succeeded, dsp1 = %lu", dsp1));
} }
break; break;
#endif
case 23: /* Setuid */ case 23: /* Setuid */
@ -612,6 +602,7 @@ moncall()
LOG(("@m9 Getuid(part 2): eff uid = %d", userid)); LOG(("@m9 Getuid(part 2): eff uid = %d", userid));
break; break;
#ifdef WANT_STIME
case 25: /* Stime */ case 25: /* Stime */
tm = pop_int4(); tm = pop_int4();
@ -632,6 +623,7 @@ moncall()
LOG(("@m9 Stime: succeeded, tm = %ld", tm)); LOG(("@m9 Stime: succeeded, tm = %ld", tm));
} }
break; break;
#endif
case 26: /* Ptrace */ case 26: /* Ptrace */

View file

@ -25,3 +25,8 @@
* seems to be the standard that won. --- dtrg */ * seems to be the standard that won. --- dtrg */
//#define WANT_SGTTY //#define WANT_SGTTY
/* FIXME: Uncomment to enable these calls in moncalls.c */
//#define WANT_MOUNT_UMOUNT
//#define WANT_STIME