From a000c628081eff68ac82b5b935f496b160cfad0a Mon Sep 17 00:00:00 2001 From: George Koehler Date: Sun, 10 Jun 2018 16:29:52 -0400 Subject: [PATCH] Get moncalls.c to compile on OpenBSD. Remove some declarations (not all correct) and #include , , and 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. --- util/int/moncalls.c | 22 +++++++--------------- util/int/sysidf.h | 5 +++++ 2 files changed, 12 insertions(+), 15 deletions(-) diff --git a/util/int/moncalls.c b/util/int/moncalls.c index 4b30b0bb9..9e7b954ea 100644 --- a/util/int/moncalls.c +++ b/util/int/moncalls.c @@ -11,12 +11,10 @@ #include #include -#if __STDC__ -#include -#endif #include - -extern int errno; /* UNIX error number */ +#include +#include +#include extern int running; /* from main.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 */ #ifdef SYS_V -#include -#undef ERANGE /* collision with trap.h */ #include -#include #endif /* SYS_V */ #include @@ -57,13 +52,6 @@ struct timeb { /* non-existing; we use an ad-hoc definition */ #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 INT4SIZE max(wsize, 4L) @@ -548,6 +536,7 @@ moncall() LOG(("@m9 Getpid: succeeded, pid = %d", pid)); break; +#ifdef WANT_MOUNT_UMOUNT case 21: /* Mount */ dsp1 = pop_ptr(); @@ -587,6 +576,7 @@ moncall() LOG(("@m9 Mount: succeeded, dsp1 = %lu", dsp1)); } break; +#endif case 23: /* Setuid */ @@ -612,6 +602,7 @@ moncall() LOG(("@m9 Getuid(part 2): eff uid = %d", userid)); break; +#ifdef WANT_STIME case 25: /* Stime */ tm = pop_int4(); @@ -632,6 +623,7 @@ moncall() LOG(("@m9 Stime: succeeded, tm = %ld", tm)); } break; +#endif case 26: /* Ptrace */ diff --git a/util/int/sysidf.h b/util/int/sysidf.h index 8297f12ac..ed385b189 100644 --- a/util/int/sysidf.h +++ b/util/int/sysidf.h @@ -25,3 +25,8 @@ * seems to be the standard that won. --- dtrg */ //#define WANT_SGTTY + +/* FIXME: Uncomment to enable these calls in moncalls.c */ + +//#define WANT_MOUNT_UMOUNT +//#define WANT_STIME