From b51e36281d9ded2c3a6728b3dae621490639d940 Mon Sep 17 00:00:00 2001 From: "Guillermo J. Rozas" Date: Thu, 18 Feb 1993 05:15:19 +0000 Subject: [PATCH] Add EMULATE_FPATHCONF, EMULATE_SYSCONF, and fix a few prototypes. --- v7/src/microcode/ux.c | 73 +++++++++++++++++++++++++++++++++++++++++-- v7/src/microcode/ux.h | 57 ++++++++++++++++++++++++++++++--- 2 files changed, 124 insertions(+), 6 deletions(-) diff --git a/v7/src/microcode/ux.c b/v7/src/microcode/ux.c index eb9d0cb5e..3d1892013 100644 --- a/v7/src/microcode/ux.c +++ b/v7/src/microcode/ux.c @@ -1,8 +1,8 @@ /* -*-C-*- -$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/microcode/ux.c,v 1.10 1992/02/03 23:44:05 jinx Exp $ +$Id: ux.c,v 1.11 1993/02/18 05:15:19 gjr Exp $ -Copyright (c) 1990-1992 Massachusetts Institute of Technology +Copyright (c) 1990-1993 Massachusetts Institute of Technology This material was developed by the Scheme project at the Massachusetts Institute of Technology, Department of Electrical Engineering and @@ -551,3 +551,72 @@ DEFUN (UX_sigsuspend, (set), CONST sigset_t * set) #endif /* HAVE_BSD_SIGNALS */ #endif /* not _POSIX */ + +#ifdef EMULATE_SYSCONF + +long +DEFUN (sysconf, (parameter), int parameter) +{ + switch (parameter) + { + case _SC_CLK_TCK: +#ifdef CLK_TCK + return ((long) (CLK_TCK)); +#else +#ifdef HZ + return ((long) HZ); +#else + return (60); +#endif /* HZ */ +#endif /* CLK_TCK */ + + case _SC_OPEN_MAX: +#ifdef OPEN_MAX + return ((long) OPEN_MAX); +#else +#ifdef _NFILE + return ((long) _NFILE); +#else + return ((long) 16); +#endif /* _NFILE */ +#endif /* OPEN_MAX */ + + case _SC_CHILD_MAX: +#ifdef CHILD_MAX + return ((long) CHILD_MAX); +#else + return ((long) 6); +#endif /* CHILD_MAX */ + + case _SC_JOB_CONTROL: +#if defined(_POSIX_JOB_CONTROL) || defined(HAVE_BSD_JOB_CONTROL) + return ((long) 1); +#else + return ((long) 0); +#endif + + default: + errno = EINVAL; + return ((long) (-1)); + } +} + +#endif /* EMULATE_SYSCONF */ + +#ifdef EMULATE_FPATHCONF + +long +DEFUN (fpathconf, (filedes, parameter), int filedes AND int parameter) +{ + switch (parameter) + { + case _PC_VDISABLE: + return ((long) '\377'); + + default: + errno = EINVAL; + return ((long) (-1)); + } +} + +#endif /* EMULATE_FPATHCONF */ diff --git a/v7/src/microcode/ux.h b/v7/src/microcode/ux.h index 477cb9d66..02a3f14dd 100644 --- a/v7/src/microcode/ux.h +++ b/v7/src/microcode/ux.h @@ -1,6 +1,6 @@ /* -*-C-*- -$Id: ux.h,v 1.41 1993/02/14 23:03:51 gjr Exp $ +$Id: ux.h,v 1.42 1993/02/18 05:14:28 gjr Exp $ Copyright (c) 1988-1993 Massachusetts Institute of Technology @@ -43,7 +43,9 @@ MIT in each case. */ #include "ansidecl.h" #include "posixtype.h" -#include +#ifndef _POSIX /* Prevent multiple inclusion */ +# include +#endif /* _POSIX */ #include #include #include @@ -60,7 +62,13 @@ MIT in each case. */ extern int errno; /* These seem to be missing from versions of unistd.h */ -extern int EXFUN (ioctl, (int, int, ...)); + +#ifndef _HPUX +/* in HP-UX has mis-matching prototype + The following is as specified by OSF/1 Programmer's reference. + */ +extern int EXFUN (ioctl, (int, unsigned long, ...)); +#endif extern int EXFUN (open, (const char *, int, ...)); extern int EXFUN (kill, (pid_t, int)); @@ -179,6 +187,14 @@ extern void EXFUN (error_system_call, (int code, enum syscall_names name)); #ifdef __osf__ # include # include +# define SYSTEM_VARIANT "OSF" +#endif + +#ifdef __386BSD__ +# include +# define EMULATE_FPATHCONF +# define EMULATE_SYSCONF +# define NO_BAUD_CONVERSION #endif #ifdef sonyrisc @@ -772,7 +788,13 @@ extern char * EXFUN (getlogin, (void)); extern PTR EXFUN (malloc, (unsigned int size)); extern PTR EXFUN (realloc, (PTR ptr, unsigned int size)); extern char * EXFUN (getenv, (CONST char * name)); -extern int EXFUN (gethostname, (char * name, unsigned int size)); + +#ifndef _HPUX +/* in HP-UX has mis-matching prototype + The following is as specified by OSF/1 Programmer's reference. + */ +extern int EXFUN (gethostname, (char * name, int size)); +#endif /* _HPUX */ #ifdef HAVE_FCNTL #define UX_fcntl fcntl @@ -1061,6 +1083,33 @@ extern int EXFUN (UX_sigsuspend, (CONST sigset_t * set)); #ifdef _POSIX +#ifdef EMULATE_FPATHCONF + +/* These values match HP-UX, and the index in the table in the + OSF/1 Programmer's reference. + */ + +extern long EXFUN (fpathconf, (int, int)); + +# define _PC_VDISABLE 8 + +#endif /* EMULATE_FPATHCONF */ + +#ifdef EMULATE_SYSCONF + +extern long EXFUN (sysconf, (int)); + +/* These values match HP-UX, and the index in the table in the + OSF/1 Programmer's reference. + */ + +# define _SC_CHILD_MAX 1 +# define _SC_CLK_TCK 2 +# define _SC_OPEN_MAX 4 +# define _SC_JOB_CONTROL 5 + +#endif /* EMULATE_SYSCONF */ + extern cc_t EXFUN (UX_PC_VDISABLE, (int fildes)); extern clock_t EXFUN (UX_SC_CLK_TCK, (void)); #define UX_SC_OPEN_MAX() ((size_t) (sysconf (_SC_OPEN_MAX))) -- 2.25.1