]> Zhao Yanbai Git Server - minix.git/commitdiff
Improved compatibility with other Unix systems.
authorPhilip Homburg <philip@cs.vu.nl>
Fri, 10 Jun 2005 15:12:03 +0000 (15:12 +0000)
committerPhilip Homburg <philip@cs.vu.nl>
Fri, 10 Jun 2005 15:12:03 +0000 (15:12 +0000)
27 files changed:
include/ansi.h
include/arpa/inet.h [new file with mode: 0644]
include/inttypes.h [new file with mode: 0644]
include/minix/config.h
include/netdb.h [new file with mode: 0644]
include/netinet/in.h [new file with mode: 0644]
include/stdint.h [new file with mode: 0644]
include/sys/asynchio.h
include/sys/socket.h [new file with mode: 0644]
include/sys/stat.h
include/sys/time.h [new file with mode: 0644]
include/sys/types.h
include/time.h
include/unistd.h
lib/ip/gethnmadr.c
lib/ip/res_comp.c
lib/ip/res_mkquery.c
lib/ip/res_query.c
lib/ip/res_send.c
lib/other/Makefile
lib/other/getpagesize.c [new file with mode: 0644]
lib/other/setgroups.c [new file with mode: 0644]
lib/other/settimeofday.c [new file with mode: 0644]
lib/posix/Makefile
lib/posix/gettimeofday.c [new file with mode: 0644]
lib/posix/lstat.c [new file with mode: 0644]
lib/posix/symlink.c [new file with mode: 0644]

index 1e4eac3e1a750f9db543af8a8641ba200603763b..8c1d50faa834fa408137ead9cd863e93bf79d805 100755 (executable)
@@ -55,6 +55,9 @@
 
 #endif /* _ANSI */
 
+/* This should be defined as restrict when a C99 compiler is used. */
+#define _RESTRICT
+
 /* Setting any of _MINIX, _POSIX_C_SOURCE or _POSIX2_SOURCE implies
  * _POSIX_SOURCE.  (Seems wrong to put this here in ANSI space.)
  */
diff --git a/include/arpa/inet.h b/include/arpa/inet.h
new file mode 100644 (file)
index 0000000..99516d7
--- /dev/null
@@ -0,0 +1,11 @@
+/*
+arpa/inet.h
+*/
+
+#ifndef _ARPA__INET_H
+#define _ARPA__INET_H
+
+/* Open Group Base Specifications Issue 6 (not complete): */
+char *inet_ntoa(struct in_addr in);
+
+#endif /* _ARPA__INET_H */
diff --git a/include/inttypes.h b/include/inttypes.h
new file mode 100644 (file)
index 0000000..0a3c0c7
--- /dev/null
@@ -0,0 +1,236 @@
+/*     inttypes.h - Format conversions of integer types.
+ *                                                     Author: Kees J. Bot
+ *                                                             4 Oct 2003
+ * Assumptions and bugs the same as for <stdint.h>
+ * Bug: Wide character integer conversion functions missing.
+ */
+
+#ifndef _INTTYPES_H
+#define _INTTYPES_H
+
+#ifndef _STDINT_H
+#include <stdint.h>
+#endif
+
+#if !__cplusplus || defined(__STDC_FORMAT_MACROS)
+
+/* Macros to print integers defined in <stdint.h>.  The first group should
+ * not be used in code, they're merely here to build the second group.
+ * (The standard really went overboard here, only the first group is needed.)
+ */
+#define PRI8           ""
+#define PRILEAST8      ""
+#define PRIFAST8       ""
+#define PRI16          ""
+#define PRILEAST16     ""
+#define PRIFAST16      ""
+#if _WORD_SIZE == 2
+#define PRI32          "l"
+#define PRILEAST32     "l"
+#define PRIFAST32      "l"
+#else
+#define PRI32          ""
+#define PRILEAST32     ""
+#define PRIFAST32      ""
+#endif
+#if _WORD_SIZE > 2 && __L64
+#define PRI64          "l"
+#define PRILEAST64     "l"
+#define PRIFAST64      "l"
+#endif
+
+/* Macros for fprintf, the ones defined by the standard. */
+#define PRId8          PRI8"d"
+#define PRIdLEAST8     PRILEAST8"d"
+#define PRIdFAST8      PRIFAST8"d"
+#define PRId16         PRI16"d"
+#define PRIdLEAST16    PRILEAST16"d"
+#define PRIdFAST16     PRIFAST16"d"
+#define PRId32         PRI32"d"
+#define PRIdLEAST32    PRILEAST32"d"
+#define PRIdFAST32     PRIFAST32"d"
+#if _WORD_SIZE > 2 && __L64
+#define PRId64         PRI64"d"
+#define PRIdLEAST64    PRILEAST64"d"
+#define PRIdFAST64     PRIFAST64"d"
+#endif
+
+#define PRIi8          PRI8"i"
+#define PRIiLEAST8     PRILEAST8"i"
+#define PRIiFAST8      PRIFAST8"i"
+#define PRIi16         PRI16"i"
+#define PRIiLEAST16    PRILEAST16"i"
+#define PRIiFAST16     PRIFAST16"i"
+#define PRIi32         PRI32"i"
+#define PRIiLEAST32    PRILEAST32"i"
+#define PRIiFAST32     PRIFAST32"i"
+#if _WORD_SIZE > 2 && __L64
+#define PRIi64         PRI64"i"
+#define PRIiLEAST64    PRILEAST64"i"
+#define PRIiFAST64     PRIFAST64"i"
+#endif
+
+#define PRIo8          PRI8"o"
+#define PRIoLEAST8     PRILEAST8"o"
+#define PRIoFAST8      PRIFAST8"o"
+#define PRIo16         PRI16"o"
+#define PRIoLEAST16    PRILEAST16"o"
+#define PRIoFAST16     PRIFAST16"o"
+#define PRIo32         PRI32"o"
+#define PRIoLEAST32    PRILEAST32"o"
+#define PRIoFAST32     PRIFAST32"o"
+#if _WORD_SIZE > 2 && __L64
+#define PRIo64         PRI64"o"
+#define PRIoLEAST64    PRILEAST64"o"
+#define PRIoFAST64     PRIFAST64"o"
+#endif
+
+#define PRIu8          PRI8"u"
+#define PRIuLEAST8     PRILEAST8"u"
+#define PRIuFAST8      PRIFAST8"u"
+#define PRIu16         PRI16"u"
+#define PRIuLEAST16    PRILEAST16"u"
+#define PRIuFAST16     PRIFAST16"u"
+#define PRIu32         PRI32"u"
+#define PRIuLEAST32    PRILEAST32"u"
+#define PRIuFAST32     PRIFAST32"u"
+#if _WORD_SIZE > 2 && __L64
+#define PRIu64         PRI64"u"
+#define PRIuLEAST64    PRILEAST64"u"
+#define PRIuFAST64     PRIFAST64"u"
+#endif
+
+#define PRIx8          PRI8"x"
+#define PRIxLEAST8     PRILEAST8"x"
+#define PRIxFAST8      PRIFAST8"x"
+#define PRIx16         PRI16"x"
+#define PRIxLEAST16    PRILEAST16"x"
+#define PRIxFAST16     PRIFAST16"x"
+#define PRIx32         PRI32"x"
+#define PRIxLEAST32    PRILEAST32"x"
+#define PRIxFAST32     PRIFAST32"x"
+#if _WORD_SIZE > 2 && __L64
+#define PRIx64         PRI64"x"
+#define PRIxLEAST64    PRILEAST64"x"
+#define PRIxFAST64     PRIFAST64"x"
+#endif
+
+#define PRIX8          PRI8"X"
+#define PRIXLEAST8     PRILEAST8"X"
+#define PRIXFAST8      PRIFAST8"X"
+#define PRIX16         PRI16"X"
+#define PRIXLEAST16    PRILEAST16"X"
+#define PRIXFAST16     PRIFAST16"X"
+#define PRIX32         PRI32"X"
+#define PRIXLEAST32    PRILEAST32"X"
+#define PRIXFAST32     PRIFAST32"X"
+#if _WORD_SIZE > 2 && __L64
+#define PRIX64         PRI64"X"
+#define PRIXLEAST64    PRILEAST64"X"
+#define PRIXFAST64     PRIFAST64"X"
+#endif
+
+/* Macros to scan integers with fscanf(), nonstandard first group. */
+#define SCN8           "hh"
+#define SCNLEAST8      "hh"
+#define SCNFAST8       ""
+#define SCN16          "h"
+#define SCNLEAST16     "h"
+#define SCNFAST16      ""
+#if _WORD_SIZE == 2
+#define SCN32          "l"
+#define SCNLEAST32     "l"
+#define SCNFAST32      "l"
+#else
+#define SCN32          ""
+#define SCNLEAST32     ""
+#define SCNFAST32      ""
+#endif
+#if _WORD_SIZE > 2 && __L64
+#define SCN64          "l"
+#define SCNLEAST64     "l"
+#define SCNFAST64      "l"
+#endif
+
+/* Macros for fscanf, the ones defined by the standard. */
+#define SCNd8          SCN8"d"
+#define SCNdLEAST8     SCNLEAST8"d"
+#define SCNdFAST8      SCNFAST8"d"
+#define SCNd16         SCN16"d"
+#define SCNdLEAST16    SCNLEAST16"d"
+#define SCNdFAST16     SCNFAST16"d"
+#define SCNd32         SCN32"d"
+#define SCNdLEAST32    SCNLEAST32"d"
+#define SCNdFAST32     SCNFAST32"d"
+#if _WORD_SIZE > 2 && __L64
+#define SCNd64         SCN64"d"
+#define SCNdLEAST64    SCNLEAST64"d"
+#define SCNdFAST64     SCNFAST64"d"
+#endif
+
+#define SCNi8          SCN8"i"
+#define SCNiLEAST8     SCNLEAST8"i"
+#define SCNiFAST8      SCNFAST8"i"
+#define SCNi16         SCN16"i"
+#define SCNiLEAST16    SCNLEAST16"i"
+#define SCNiFAST16     SCNFAST16"i"
+#define SCNi32         SCN32"i"
+#define SCNiLEAST32    SCNLEAST32"i"
+#define SCNiFAST32     SCNFAST32"i"
+#if _WORD_SIZE > 2 && __L64
+#define SCNi64         SCN64"i"
+#define SCNiLEAST64    SCNLEAST64"i"
+#define SCNiFAST64     SCNFAST64"i"
+#endif
+
+#define SCNo8          SCN8"o"
+#define SCNoLEAST8     SCNLEAST8"o"
+#define SCNoFAST8      SCNFAST8"o"
+#define SCNo16         SCN16"o"
+#define SCNoLEAST16    SCNLEAST16"o"
+#define SCNoFAST16     SCNFAST16"o"
+#define SCNo32         SCN32"o"
+#define SCNoLEAST32    SCNLEAST32"o"
+#define SCNoFAST32     SCNFAST32"o"
+#if _WORD_SIZE > 2 && __L64
+#define SCNo64         SCN64"o"
+#define SCNoLEAST64    SCNLEAST64"o"
+#define SCNoFAST64     SCNFAST64"o"
+#endif
+
+#define SCNu8          SCN8"u"
+#define SCNuLEAST8     SCNLEAST8"u"
+#define SCNuFAST8      SCNFAST8"u"
+#define SCNu16         SCN16"u"
+#define SCNuLEAST16    SCNLEAST16"u"
+#define SCNuFAST16     SCNFAST16"u"
+#define SCNu32         SCN32"u"
+#define SCNuLEAST32    SCNLEAST32"u"
+#define SCNuFAST32     SCNFAST32"u"
+#if _WORD_SIZE > 2 && __L64
+#define SCNu64         SCN64"u"
+#define SCNuLEAST64    SCNLEAST64"u"
+#define SCNuFAST64     SCNFAST64"u"
+#endif
+
+#define SCNx8          SCN8"x"
+#define SCNxLEAST8     SCNLEAST8"x"
+#define SCNxFAST8      SCNFAST8"x"
+#define SCNx16         SCN16"x"
+#define SCNxLEAST16    SCNLEAST16"x"
+#define SCNxFAST16     SCNFAST16"x"
+#define SCNx32         SCN32"x"
+#define SCNxLEAST32    SCNLEAST32"x"
+#define SCNxFAST32     SCNFAST32"x"
+#if _WORD_SIZE > 2 && __L64
+#define SCNx64         SCN64"x"
+#define SCNxLEAST64    SCNLEAST64"x"
+#define SCNxFAST64     SCNFAST64"x"
+#endif
+#endif /* !__cplusplus || __STDC_FORMAT_MACROS */
+
+/* Integer conversion functions for [u]intmax_t. */
+#define stroimax(nptr, endptr, base)   strtol(nptr, endptr, base)
+#define stroumax(nptr, endptr, base)   strtoul(nptr, endptr, base)
+
+#endif /* _INTTYPES_H */
index df20c96a72d196d79b395a6e14cea3aeb9770a41..0c86c14c484e4e0596e9d2878859a410306db51c 100755 (executable)
@@ -26,6 +26,7 @@
 /* Word size in bytes (a constant equal to sizeof(int)). */
 #if __ACK__
 #define _WORD_SIZE     _EM_WSIZE
+#define _PTR_SIZE      _EM_WSIZE
 #endif
 
 /* Number of slots in the process table for non-kernel processes. */
diff --git a/include/netdb.h b/include/netdb.h
new file mode 100644 (file)
index 0000000..1b74239
--- /dev/null
@@ -0,0 +1,6 @@
+/*
+netdb.h
+*/
+
+/* Open Group Base Specifications Issue 6 (not complete) */
+#include <net/gen/netdb.h>
diff --git a/include/netinet/in.h b/include/netinet/in.h
new file mode 100644 (file)
index 0000000..11e33bd
--- /dev/null
@@ -0,0 +1,21 @@
+/*
+netinet/in.h
+*/
+
+#ifndef _NETINET__IN_H
+#define _NETINET__IN_H
+
+/* Can we include <stdint.h> here or do we need an additional header that is
+ * safe to include?
+ */
+#include <stdint.h>
+
+/* Open Group Base Specifications Issue 6 (not complete) */
+typedef uint32_t in_addr_t;
+
+struct in_addr
+{
+       in_addr_t       s_addr;
+};
+
+#endif /* _NETINET__IN_H */
diff --git a/include/stdint.h b/include/stdint.h
new file mode 100644 (file)
index 0000000..0e7a402
--- /dev/null
@@ -0,0 +1,221 @@
+/*     stdint.h - Standard sized integer types.        Author: Kees J. Bot
+ *                                                             4 Oct 2003
+ *
+ * Assumption: Long is the biggest type.
+ * Bug:                C99 requires a 64 bit type, and long isn't 64 bits yet, and
+ *             will never be 64 bits under 16-bits Minix.
+ * Omission:   Limits like PTR_DIFF_MAX not here yet, maybe <limits.h>?
+ */
+
+#ifndef _STDINT_H
+#define _STDINT_H
+
+#ifndef _MINIX__TYPES_H
+#include <sys/types.h>
+#endif
+
+#if (_WORD_SIZE != 2 && _WORD_SIZE != 4) || \
+       (_PTR_SIZE != _WORD_SIZE && _PTR_SIZE != 2*_WORD_SIZE)
+#error Odd word or pointer sizes
+#endif
+
+/* Integer types of precisely the given bitsize. */
+typedef i8_t   int8_t;
+typedef i16_t  int16_t;
+typedef i32_t  int32_t;
+#if _WORD_SIZE > 2 && __L64
+typedef i64_t  int64_t;
+#endif
+
+typedef u8_t   uint8_t;
+typedef u16_t  uint16_t;
+typedef u32_t  uint32_t;
+#if _WORD_SIZE > 2 && __L64
+typedef u64_t  uint64_t;
+#endif
+
+/* Integer types of at least the given bitsize. */
+typedef int8_t         int_least8_t;
+typedef int16_t                int_least16_t;
+typedef int32_t                int_least32_t;
+#if _WORD_SIZE > 2 && __L64
+typedef int64_t                int_least64_t;
+#endif
+
+typedef uint8_t                uint_least8_t;
+typedef uint16_t       uint_least16_t;
+typedef uint32_t       uint_least32_t;
+#if _WORD_SIZE > 2 && __L64
+typedef uint64_t       uint_least64_t;
+#endif
+
+/* Fast integer types of at least the given bitsize. */
+#if _WORD_SIZE == 2
+typedef int16_t                int_fast8_t;
+typedef int16_t                int_fast16_t;
+#else
+typedef int32_t                int_fast8_t;
+typedef int32_t                int_fast16_t;
+#endif
+typedef int32_t                int_fast32_t;
+#if _WORD_SIZE > 2 && __L64
+typedef int64_t                int_fast64_t;
+#endif
+
+#if _WORD_SIZE == 2
+typedef uint16_t       uint_fast8_t;
+typedef uint16_t       uint_fast16_t;
+#else
+typedef uint32_t       uint_fast8_t;
+typedef uint32_t       uint_fast16_t;
+#endif
+typedef uint32_t       uint_fast32_t;
+#if _WORD_SIZE > 2 && __L64
+typedef uint64_t       uint_fast64_t;
+#endif
+
+/* Integer type capable of holding a pointer and the largest integer type. */
+#if _PTR_SIZE == _WORD_SIZE
+typedef int            intptr_t;
+typedef unsigned       uintptr_t;
+#elif _PTR_SIZE == 2*_WORD_SIZE
+typedef long           intptr_t;
+typedef unsigned long  uintptr_t;
+#endif
+typedef long           intmax_t;
+typedef unsigned long  uintmax_t;
+
+#if !__cplusplus || defined(__STDC_LIMIT_MACROS)
+#ifndef _LIMITS_H
+#include <limits.h>
+#endif
+
+/* Range definitions for each of the above types conform <limits.h>. */
+#define INT8_MIN               (-INT8_MAX-1)
+#define INT16_MIN              (-INT16_MAX-1)
+#define INT32_MIN              (-INT32_MAX-1)
+#if _WORD_SIZE > 2 && __L64
+#define INT64_MIN              (-INT64_MAX-1)
+#endif
+
+#define INT8_MAX               127
+#define INT16_MAX              32767
+#define INT32_MAX              2147483647
+#if _WORD_SIZE > 2 && __L64
+#define INT64_MAX              9223372036854775807
+#endif
+
+#define UINT8_MAX              255
+#define UINT16_MAX             65535
+#define UINT32_MAX             4294967295
+#if _WORD_SIZE > 2 && __L64
+#define UINT64_MAX             18446744073709551615
+#endif
+
+#define INT_LEAST8_MIN         INT8_MIN
+#define INT_LEAST16_MIN                INT16_MIN
+#define INT_LEAST32_MIN                INT32_MIN
+#if _WORD_SIZE > 2 && __L64
+#define INT_LEAST64_MIN                INT64_MIN
+#endif
+
+#define INT_LEAST8_MAX         INT8_MAX
+#define INT_LEAST16_MAX                INT16_MAX
+#define INT_LEAST32_MAX                INT32_MAX
+#if _WORD_SIZE > 2 && __L64
+#define INT_LEAST64_MAX                INT64_MAX
+#endif
+
+#define UINT_LEAST8_MAX                UINT8_MAX
+#define UINT_LEAST16_MAX       UINT16_MAX
+#define UINT_LEAST32_MAX       UINT32_MAX
+#if _WORD_SIZE > 2 && __L64
+#define UINT_LEAST64_MAX       UINT64_MAX
+#endif
+
+#define INT_FAST8_MIN          (-INT_FAST8_MAX-1)
+#define INT_FAST16_MIN         (-INT_FAST16_MAX-1)
+#define INT_FAST32_MIN         INT32_MIN
+#if _WORD_SIZE > 2 && __L64
+#define INT_FAST64_MIN         INT64_MIN
+#endif
+
+#if _WORD_SIZE == 2
+#define INT_FAST8_MAX          INT16_MAX
+#define INT_FAST16_MAX         INT16_MAX
+#else
+#define INT_FAST8_MAX          INT32_MAX
+#define INT_FAST16_MAX         INT32_MAX
+#endif
+#define INT_FAST32_MAX         INT32_MAX
+#if _WORD_SIZE > 2 && __L64
+#define INT_FAST64_MAX         INT64_MAX
+#endif
+
+#if _WORD_SIZE == 2
+#define UINT_FAST8_MAX         UINT16_MAX
+#define UINT_FAST16_MAX                UINT16_MAX
+#else
+#define UINT_FAST8_MAX         UINT32_MAX
+#define UINT_FAST16_MAX                UINT32_MAX
+#endif
+#define UINT_FAST32_MAX                UINT32_MAX
+#if _WORD_SIZE > 2 && __L64
+#define UINT_FAST64_MAX                UINT64_MAX
+#endif
+
+#if _PTR_SIZE == _WORD_SIZE
+#define INTPTR_MIN             INT_MIN
+#define INTPTR_MAX             INT_MAX
+#define UINTPTR_MAX            UINT_MAX
+#elif _PTR_SIZE > _WORD_SIZE
+#define INTPTR_MIN             LONG_MIN
+#define INTPTR_MAX             LONG_MAX
+#define UINTPTR_MAX            ULONG_MAX
+#endif
+#define INTMAX_MIN             LONG_MIN
+#define INTMAX_MAX             LONG_MAX
+#define UINTMAX_MAX            ULONG_MAX
+
+#endif /* !__cplusplus || __STDC_LIMIT_MACROS */
+
+#ifndef __CONCAT
+#define __CONCAT(x,y)  x ## y
+#endif
+
+/* Constants of the proper type. */
+#define INT8_C(c)      c
+#define INT16_C(c)     c
+#if _WORD_SIZE == 2
+#define INT32_C(c)     __CONCAT(c,l)
+#else
+#define INT32_C(c)     c
+#endif
+#if _WORD_SIZE > 2 && __L64
+#define INT64_C(c)     __CONCAT(c,l)
+#endif
+
+#define UINT8_C(c)     __CONCAT(c,u)
+#define UINT16_C(c)    __CONCAT(c,u)
+#if _WORD_SIZE == 2
+#define UINT32_C(c)    __CONCAT(c,lu)
+#else
+#define UINT32_C(c)    __CONCAT(c,u)
+#endif
+#if _WORD_SIZE > 2 && __L64
+#define UINT64_C(c)    __CONCAT(c,lu)
+#endif
+
+#if _WORD_SIZE == 2 || !__L64
+#define INTMAX_C(c)    INT32_C(c)
+#define UINTMAX_C(c)   UINT32_C(c)
+#else
+#define INTMAX_C(c)    INT64_C(c)
+#define UINTMAX_C(c)   UINT64_C(c)
+#endif
+
+#endif /* _STDINT_H */
+
+/*
+ * $PchId: stdint.h,v 1.2 2005/01/27 17:32:00 philip Exp $
+ */
index b80ac7d84011afc054ca35dd10cdc6ffd4e3fbf0..06bac33d828b754299e7486959943cf582eee3e7 100755 (executable)
@@ -12,6 +12,8 @@
 #include <ansi.h>
 #endif
 
+#include <sys/time.h>
+
 typedef struct {
        char    state;
        char    op;
diff --git a/include/sys/socket.h b/include/sys/socket.h
new file mode 100644 (file)
index 0000000..e2c642e
--- /dev/null
@@ -0,0 +1,6 @@
+/*
+sys/socket.h
+*/
+
+/* Open Group Base Specifications Issue 6 (not complete) */
+#include <net/gen/socket.h>
index f1be28525316a645fdb0acde42998404e8ae3f7d..28dbb5a5cea4feb647eac9e27ceae882a67af07d 100755 (executable)
@@ -29,6 +29,7 @@ struct stat {
  * extensions such as S_IFREG != (mode_t) S_IFREG when ints are 32 bits.
  */
 #define S_IFMT  ((mode_t) 0170000)     /* type of file */
+#define S_IFLNK ((mode_t) 0120000)     /* symbolic link, not implemented */
 #define S_IFREG ((mode_t) 0100000)     /* regular */
 #define S_IFBLK 0060000                /* block special */
 #define S_IFDIR 0040000        /* directory */
@@ -61,7 +62,7 @@ struct stat {
 #define S_ISCHR(m)     (((m) & S_IFMT) == S_IFCHR)     /* is a char spec */
 #define S_ISBLK(m)     (((m) & S_IFMT) == S_IFBLK)     /* is a block spec */
 #define S_ISFIFO(m)    (((m) & S_IFMT) == S_IFIFO)     /* is a pipe/FIFO */
-
+#define S_ISLNK(m)      (((m) & S_IFMT) == S_IFLNK)     /* is a sym link */
 
 /* Function Prototypes. */
 _PROTOTYPE( int chmod, (const char *_path, Mode_t _mode)               );
@@ -71,4 +72,7 @@ _PROTOTYPE( int mkfifo, (const char *_path, Mode_t _mode)             );
 _PROTOTYPE( int stat, (const char *_path, struct stat *_buf)           );
 _PROTOTYPE( mode_t umask, (Mode_t _cmask)                              );
 
+/* Open Group Base Specifications Issue 6 (not complete) */
+_PROTOTYPE( int lstat, (const char *_path, struct stat *_buf)          );
+
 #endif /* _STAT_H */
diff --git a/include/sys/time.h b/include/sys/time.h
new file mode 100644 (file)
index 0000000..e8ce1b0
--- /dev/null
@@ -0,0 +1,22 @@
+/*
+sys/time.h
+*/
+
+#ifndef _SYS__TIME_H
+#define _SYS__TIME_H
+
+#include <ansi.h>
+
+/* Open Group Base Specifications Issue 6 (not complete) */
+struct timeval
+{
+       long /*time_t*/ tv_sec;
+       long /*useconds_t*/ tv_usec;
+};
+
+int gettimeofday(struct timeval *_RESTRICT tp, void *_RESTRICT tzp);
+
+/* Compatibility with other Unix systems */
+int settimeofday(const struct timeval *tp, const void *tzp);
+
+#endif /* _SYS__TIME_H */
index c4a847ce6599e74dc399a0cde999587c5b976572..6bbf5b4cb5084529086c0087c0afdf3220b2afa9 100755 (executable)
@@ -43,6 +43,9 @@ typedef long clock_t;            /* unit for system accounting */
 typedef unsigned long sigset_t;
 #endif
 
+/* Open Group Base Specifications Issue 6 (not complete) */
+typedef long useconds_t;       /* Time in microseconds */
+
 /* Types used in disk, inode, etc. data structures. */
 typedef short          dev_t;     /* holds (major|minor) device pair */
 typedef char           gid_t;     /* group id */
@@ -116,4 +119,10 @@ typedef int           Mode_t;
 /* Signal handler type, e.g. SIG_IGN */
 typedef void _PROTOTYPE( (*sighandler_t), (int) );
 
+/* Compatibility with other systems */
+typedef unsigned char  u_char;
+typedef unsigned short u_short;
+typedef unsigned int   u_int;
+typedef unsigned long  u_long;
+
 #endif /* _TYPES_H */
index bc6022121aae05a8c3d5e8f5d29991d51e56122a..8cb0f3a8cf97b7a1992bf4bc896ecfe94e4508a4 100755 (executable)
@@ -70,7 +70,6 @@ _PROTOTYPE( void tzset, (void)                                                );
 _PROTOTYPE( int stime, (time_t *_top)                                  );
 #endif
 
-struct timeval { long tv_sec, tv_usec; };
 extern long timezone;
 
 #endif /* _TIME_H */
index 0a7c06b9e6e1c7800062f7bf0bade46891a882b1..870ee51e2c88f74a81638a97bf91e5c3065b076d 100755 (executable)
@@ -130,6 +130,9 @@ _PROTOTYPE( char *ttyname, (int _fd)                                        );
 _PROTOTYPE( int unlink, (const char *_path)                            );
 _PROTOTYPE( ssize_t write, (int _fd, const void *_buf, size_t _n)      );
 
+/* Open Group Base Specifications Issue 6 (not complete) */
+_PROTOTYPE( int symlink, (const char *path1, const char *path2)                );
+
 #ifdef _MINIX
 #ifndef _TYPE_H
 #include <minix/type.h>
@@ -156,6 +159,11 @@ _PROTOTYPE( int getprocnr, (int *proc_nr)                          );
 _PROTOTYPE( int findproc, (char *proc_name, int *proc_nr)              );
 _PROTOTYPE( int allocmem, (phys_bytes size, phys_bytes *base)          );
 _PROTOTYPE( int freemem, (phys_bytes size, phys_bytes base)            );
+
+/* For compatibility with other Unix systems */
+_PROTOTYPE( int getpagesize, (void)                                    );
+_PROTOTYPE( int setgroups, (int ngroups, const gid_t *gidset)          );
+
 #endif
 
 _PROTOTYPE( int setcache, (int kb));
index 3f79d1b0c3b73485e75cf77530aac42276143496..5f14875ace66f21568c2c946fd4a072aaf38f1a3 100755 (executable)
@@ -58,9 +58,6 @@ struct in_addr
 {
        ipaddr_t s_addr;
 };
-typedef u32_t u_long;
-typedef u16_t u_short;
-typedef u8_t u_char;
 union querybuf;
 
 extern int dn_skipname _ARGS(( const u_char *comp_dn, const u_char *eom ));
index 36a6b79e999054db8f9998671e8abeaccbfc639d..0b45740270a1431736304bfa0646dc71f3d55975 100755 (executable)
@@ -29,10 +29,6 @@ static char sccsid[] = "@(#)res_comp.c       6.18 (Berkeley) 6/27/90";
 #include <net/gen/nameser.h>
 #include <net/gen/resolv.h>
 
-typedef u8_t u_char;
-typedef u16_t u_short;
-typedef u32_t u_long;
-
 static int dn_find _ARGS(( const u_char *exp_dn, const u_char *msg,
        u_char **dnptrs, u_char **lastdnptr ));
 int dn_skipname _ARGS(( const u_char *comp_dn, const u_char *eom ));
index bf1800091a922b562f045522312a024b0984b7ac..ef6a0ab0f571f7dec9fecbee0cd5c562fe86af94 100755 (executable)
@@ -32,10 +32,6 @@ static char sccsid[] = "@(#)res_mkquery.c    6.12 (Berkeley) 6/1/90";
 #include <net/gen/nameser.h>
 #include <net/gen/resolv.h>
 
-typedef u16_t u_short;
-typedef unsigned u_int;
-typedef u32_t u_long;
-
 #define bzero(b,l) memset(b,0,l)
 #define bcopy(s,d,l) memcpy(d,s,l)
 
index 6f6330d9aceb6c23497ff44ce9f28a62e541f5b6..2fa6ce2acd30dea0f31e57d51d713228264a6c8f 100755 (executable)
@@ -35,8 +35,6 @@ static char sccsid[] = "@(#)res_query.c       5.7 (Berkeley) 6/1/90";
 #include <net/gen/netdb.h>
 #include <net/gen/resolv.h>
 
-typedef u8_t u_char;
-
 #define bcopy(s,d,l) memcpy(d,s,l)
 
 #define hostalias __hostalias
index dd6ac99fc06097d823d77b15fca8c1de2d9be624..1c6dbe4c1f2eefbc86bd79750dc8bea9a57798a4 100755 (executable)
@@ -80,8 +80,6 @@ static char sccsid[] = "@(#)res_send.c        6.27 (Berkeley) 2/24/91";
 #include <net/gen/udp_hdr.h>
 #include <net/gen/udp_io.h>
 
-typedef u16_t u_short;
-
 static int tcp_connect _ARGS(( ipaddr_t host, Tcpport_t port, int *terrno ));
 static int tcpip_writeall _ARGS(( int fd, const char *buf, size_t siz ));
 static int udp_connect _ARGS(( void ));
index 990b6d8ea11a73e1e46b31109d44d9615b8697ac..724448ef5ed893622dcde26490987e795cf13545 100755 (executable)
@@ -33,6 +33,7 @@ OBJECTS       = \
        $(LIBRARY)(getgrent.o) \
        $(LIBRARY)(getlogin.o) \
        $(LIBRARY)(getopt.o) \
+       $(LIBRARY)(getpagesize.o) \
        $(LIBRARY)(getpass.o) \
        $(LIBRARY)(getpwent.o) \
        $(LIBRARY)(getttyent.o) \
@@ -51,6 +52,8 @@ OBJECTS       = \
        $(LIBRARY)(popen.o) \
        $(LIBRARY)(putenv.o) \
        $(LIBRARY)(putw.o) \
+       $(LIBRARY)(setgroups.o) \
+       $(LIBRARY)(settimeofday.o) \
        $(LIBRARY)(stderr.o) \
        $(LIBRARY)(swab.o) \
        $(LIBRARY)(syscall.o) \
@@ -144,6 +147,9 @@ $(LIBRARY)(getlogin.o):     getlogin.c
 $(LIBRARY)(getopt.o):  getopt.c
        $(CC1) getopt.c
 
+$(LIBRARY)(getpagesize.o):     getpagesize.c
+       $(CC1) getpagesize.c
+
 $(LIBRARY)(getpass.o): getpass.c
        $(CC1) getpass.c
 
@@ -204,6 +210,12 @@ $(LIBRARY)(putw.o):        putw.c
 $(LIBRARY)(rindex.o):  rindex.c
        $(CC1) rindex.c
 
+$(LIBRARY)(setgroups.o):       setgroups.c
+       $(CC1) setgroups.c
+
+$(LIBRARY)(settimeofday.o):    settimeofday.c
+       $(CC1) settimeofday.c
+
 $(LIBRARY)(stderr.o):  stderr.c
        $(CC1) stderr.c
 
diff --git a/lib/other/getpagesize.c b/lib/other/getpagesize.c
new file mode 100644 (file)
index 0000000..fd0f625
--- /dev/null
@@ -0,0 +1,11 @@
+/*
+getpagesize.c
+*/
+
+#include <unistd.h>
+
+int getpagesize(void)
+{
+       /* We don't have paging. Pretend that we do. */
+       return 4096;
+}
diff --git a/lib/other/setgroups.c b/lib/other/setgroups.c
new file mode 100644 (file)
index 0000000..23a3644
--- /dev/null
@@ -0,0 +1,15 @@
+/*
+setgroups.c
+*/
+
+#include <errno.h>
+#include <unistd.h>
+
+int setgroups(int ngroups, const gid_t *gidset)
+{
+       /* Not implemented */
+
+       errno= ENOSYS;
+       return -1;
+}
+
diff --git a/lib/other/settimeofday.c b/lib/other/settimeofday.c
new file mode 100644 (file)
index 0000000..956135a
--- /dev/null
@@ -0,0 +1,14 @@
+/*
+settimeofday.c
+*/
+
+#define stime _stime
+
+#include <sys/time.h>
+#include <time.h>
+
+int settimeofday(const struct timeval *tp, const void *tzp)
+{
+       /* Ignore time zones */
+       return stime(&tp->tv_sec);
+}
index 638ac71aca0f6e57f7466bcc1bcf9490bb162140..cd8f68f8b141be5e2cd71d4a79251c5e24a6f148 100755 (executable)
@@ -95,6 +95,9 @@ OBJECTS       = \
        $(LIBRARY)(_wait.o) \
        $(LIBRARY)(_waitpid.o) \
        $(LIBRARY)(_write.o) \
+       $(LIBRARY)(gettimeofday.o) \
+       $(LIBRARY)(lstat.o) \
+       $(LIBRARY)(symlink.o) \
 
 $(LIBRARY):    $(OBJECTS)
        aal cr $@ *.o
@@ -363,3 +366,13 @@ $(LIBRARY)(_waitpid.o):    _waitpid.c
 
 $(LIBRARY)(_write.o):  _write.c
        $(CC1) _write.c
+
+$(LIBRARY)(gettimeofday.o):    gettimeofday.c
+       $(CC1) gettimeofday.c
+
+$(LIBRARY)(lstat.o):   lstat.c
+       $(CC1) lstat.c
+
+$(LIBRARY)(symlink.o): symlink.c
+       $(CC1) symlink.c
+
diff --git a/lib/posix/gettimeofday.c b/lib/posix/gettimeofday.c
new file mode 100644 (file)
index 0000000..6ec5636
--- /dev/null
@@ -0,0 +1,18 @@
+/*
+gettimeofday.c
+*/
+
+#include <sys/time.h>
+#include <time.h>
+
+int gettimeofday(struct timeval *_RESTRICT tp, void *_RESTRICT tzp)
+{
+       if (time(&tp->tv_sec) == (time_t)-1)
+               return -1;
+       tp->tv_usec= 0;
+
+       /* tzp has to be a nul pointer according to the standard. Otherwise
+        * behavior is undefined. We can just ignore tzp.
+        */
+       return 0;
+}
diff --git a/lib/posix/lstat.c b/lib/posix/lstat.c
new file mode 100644 (file)
index 0000000..b96fa6f
--- /dev/null
@@ -0,0 +1,13 @@
+/*
+lstat.c
+*/
+
+#define stat _stat
+
+#include <sys/stat.h>
+
+int lstat(const char *path, struct stat *sb)
+{
+       /* Without symlinks, lstat is equal to stat */
+       return stat(path, sb);
+}
diff --git a/lib/posix/symlink.c b/lib/posix/symlink.c
new file mode 100644 (file)
index 0000000..3e918fe
--- /dev/null
@@ -0,0 +1,12 @@
+/*
+symlink.c
+*/
+
+#include <errno.h>
+#include <unistd.h>
+
+int symlink(const char *path1, const char *path2)
+{
+       errno= ENOSYS;
+       return -1;
+}