Add EMULATE_FPATHCONF, EMULATE_SYSCONF, and fix a few prototypes.
authorGuillermo J. Rozas <edu/mit/csail/zurich/gjr>
Thu, 18 Feb 1993 05:15:19 +0000 (05:15 +0000)
committerGuillermo J. Rozas <edu/mit/csail/zurich/gjr>
Thu, 18 Feb 1993 05:15:19 +0000 (05:15 +0000)
v7/src/microcode/ux.c
v7/src/microcode/ux.h

index eb9d0cb5e13409d7d8b66ec33e6102cb206cf255..3d18920138ca90ca9c2904fde7a2e6c2404cf4b1 100644 (file)
@@ -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 */
+\f
+#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 */
index 477cb9d665e559132caea3ddba80f4ae95068209..02a3f14dd09edddd43c965fb415695df418db7d4 100644 (file)
@@ -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 <sys/times.h>
+#ifndef _POSIX                 /* Prevent multiple inclusion */
+# include <sys/times.h>
+#endif /* _POSIX */
 #include <sys/file.h>
 #include <sys/param.h>
 #include <sys/stat.h>
@@ -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
+/* <unistd.h> 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 <sys/time.h>
 #  include <sys/ioctl.h>
+#  define SYSTEM_VARIANT "OSF"
+#endif
+
+#ifdef __386BSD__
+#  include <sys/ioctl.h>
+#  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
+/* <unistd.h> 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));
 \f
 #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)))