about summary refs log tree commit diff
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2000-02-25 09:00:58 +0000
committerUlrich Drepper <drepper@redhat.com>2000-02-25 09:00:58 +0000
commitbba09d234b3cfaa311809278c4252fc906f06de2 (patch)
tree2a372fc7594a100e4be8a6482112aeefd5fa5aca
parent8934380c5b577346635773210336414d80c5d4ba (diff)
downloadglibc-bba09d234b3cfaa311809278c4252fc906f06de2.tar.gz
glibc-bba09d234b3cfaa311809278c4252fc906f06de2.tar.xz
glibc-bba09d234b3cfaa311809278c4252fc906f06de2.zip
Update.
2000-02-25  Ulrich Drepper  <drepper@redhat.com>

	* conform/conformtest.pl (@headers): Add "sys/msg.h", "sys/mman.h",
	"sys/ipc.h", "syslog.h", and "stropts.h".
	Handle / in header names correctly.
	* conform/data/stropts.h-data: New file.
	* conform/data/syslog.h-data: New file.
	* conform/data/sys/ipc.h-data: New file.
	* conform/data/sys/mman.h-data: New file.
	* conform/data/sys/msg.h-data: New file.

	* misc/sys/mman.h: Define off_t and mode_t if not already done.

	* streams/stropts.h: Define gid_t and uid_t if not already done.

	* sysdeps/gnu/bits/ipc.h (IPC_INFO): Only define if __USE_GNU.
	* sysdeps/unix/sysv/linux/alpha/bits/ipc.h: Likewise.
	* sysdeps/unix/sysv/linux/bits/ipc.h: Likewise.
	* sysdeps/unix/sysv/linux/mips/bits/ipc.h: Likewise.
	* sysdeps/unix/sysv/linux/powerpc/bits/ipc.h: Likewise.
	* sysdeps/unix/sysv/linux/sparc/bits/ipc.h: Likewise.

	* sysvipc/sys/msg.h: Don't include sys/types.h.
	Define time_t, pid_t, and ssize_t if not already done.
	(struct msgbuf): Define only if __USE_GNU.

	* sysdeps/generic/bits/msq.h: Include bits/types.h, not sys/types.h.
	(MSG_EXCEPT): Only define if __USE_GNU.
	Define msgqnum_t and msglen_t and use them in struct msqid_ds
	definition.
	* sysdeps/gnu/bits/msq.h: Likewise.
	* sysdeps/unix/sysv/linux/alpha/bits/msq.h: Likewise.
	* sysdeps/unix/sysv/linux/bits/msq.h: Likewise.
	* sysdeps/unix/sysv/linux/sparc/bits/msq.h: Likewise.

	* sysdeps/generic/bits/stropts.h (I_GWROPT): Renamed from I_GWRSET.
	(FLUSHBAND): Only define is __USE_GNU.
	(RPROTMASK): Likewise.
	(SNDPIPE): Likewise.
	(MUXID_ALL): Likewise.
	(struct strrecvfd): Rename fill to __fill.
-rw-r--r--ChangeLog42
-rw-r--r--bits/msq.h12
-rw-r--r--bits/stropts.h30
-rw-r--r--conform/conformtest.pl9
-rw-r--r--conform/data/stropts.h-data123
-rw-r--r--conform/data/sys/ipc.h-data24
-rw-r--r--conform/data/sys/mman.h-data32
-rw-r--r--conform/data/sys/msg.h-data28
-rw-r--r--conform/data/syslog.h-data39
-rw-r--r--misc/sys/mman.h16
-rw-r--r--streams/stropts.h14
-rw-r--r--sysdeps/generic/bits/msq.h12
-rw-r--r--sysdeps/generic/bits/stropts.h30
-rw-r--r--sysdeps/gnu/bits/ipc.h6
-rw-r--r--sysdeps/gnu/bits/msq.h16
-rw-r--r--sysdeps/unix/sysv/linux/alpha/bits/ipc.h4
-rw-r--r--sysdeps/unix/sysv/linux/alpha/bits/msq.h14
-rw-r--r--sysdeps/unix/sysv/linux/bits/ipc.h4
-rw-r--r--sysdeps/unix/sysv/linux/bits/msq.h14
-rw-r--r--sysdeps/unix/sysv/linux/mips/bits/ipc.h28
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/bits/ipc.h30
-rw-r--r--sysdeps/unix/sysv/linux/sparc/bits/ipc.h6
-rw-r--r--sysdeps/unix/sysv/linux/sparc/bits/msq.h14
-rw-r--r--sysvipc/sys/msg.h19
24 files changed, 481 insertions, 85 deletions
diff --git a/ChangeLog b/ChangeLog
index 1e73770452..a17b1e8666 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,45 @@
+2000-02-25  Ulrich Drepper  <drepper@redhat.com>
+
+	* conform/conformtest.pl (@headers): Add "sys/msg.h", "sys/mman.h",
+	"sys/ipc.h", "syslog.h", and "stropts.h".
+	Handle / in header names correctly.
+	* conform/data/stropts.h-data: New file.
+	* conform/data/syslog.h-data: New file.
+	* conform/data/sys/ipc.h-data: New file.
+	* conform/data/sys/mman.h-data: New file.
+	* conform/data/sys/msg.h-data: New file.
+
+	* misc/sys/mman.h: Define off_t and mode_t if not already done.
+
+	* streams/stropts.h: Define gid_t and uid_t if not already done.
+
+	* sysdeps/gnu/bits/ipc.h (IPC_INFO): Only define if __USE_GNU.
+	* sysdeps/unix/sysv/linux/alpha/bits/ipc.h: Likewise.
+	* sysdeps/unix/sysv/linux/bits/ipc.h: Likewise.
+	* sysdeps/unix/sysv/linux/mips/bits/ipc.h: Likewise.
+	* sysdeps/unix/sysv/linux/powerpc/bits/ipc.h: Likewise.
+	* sysdeps/unix/sysv/linux/sparc/bits/ipc.h: Likewise.
+
+	* sysvipc/sys/msg.h: Don't include sys/types.h.
+	Define time_t, pid_t, and ssize_t if not already done.
+	(struct msgbuf): Define only if __USE_GNU.
+
+	* sysdeps/generic/bits/msq.h: Include bits/types.h, not sys/types.h.
+	(MSG_EXCEPT): Only define if __USE_GNU.
+	Define msgqnum_t and msglen_t and use them in struct msqid_ds
+	definition.
+	* sysdeps/gnu/bits/msq.h: Likewise.
+	* sysdeps/unix/sysv/linux/alpha/bits/msq.h: Likewise.
+	* sysdeps/unix/sysv/linux/bits/msq.h: Likewise.
+	* sysdeps/unix/sysv/linux/sparc/bits/msq.h: Likewise.
+
+	* sysdeps/generic/bits/stropts.h (I_GWROPT): Renamed from I_GWRSET.
+	(FLUSHBAND): Only define is __USE_GNU.
+	(RPROTMASK): Likewise.
+	(SNDPIPE): Likewise.
+	(MUXID_ALL): Likewise.
+	(struct strrecvfd): Rename fill to __fill.
+
 2000-02-24  Ulrich Drepper  <drepper@redhat.com>
 
 	* stdlib/stdlib.h: Move definition X/Open compatibility stuff
diff --git a/bits/msq.h b/bits/msq.h
index a263869a0e..131fc48521 100644
--- a/bits/msq.h
+++ b/bits/msq.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1995, 1997 Free Software Foundation, Inc.
+/* Copyright (C) 1995, 1997, 2000 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -20,11 +20,15 @@
 #error "Never use <bits/msq.h> directly; include <sys/msg.h> instead."
 #endif
 
-#include <sys/types.h>
+#include <bits/types.h>
 
 /* Define options for message queue functions.  */
 #define MSG_NOERROR	010000	/* no error if message is too big */
 
+/* Types used in the structure definition.  */
+typedef unsigned short int msgqnum_t;
+typedef unsigned short int msglen_t;
+
 
 /* Structure of record for one message inside the kernel.
    The type `struct __msg' is opaque.  */
@@ -34,8 +38,8 @@ struct msqid_ds
   __time_t msg_stime;		/* time of last msgsnd command */
   __time_t msg_rtime;		/* time of last msgrcv command */
   __time_t msg_ctime;		/* time of last change */
-  unsigned short int msg_qnum;	/* number of messages currently on queue */
-  unsigned short int msg_qbytes;/* max number of bytes allowed on queue */
+  msgqnum_t msg_qnum;		/* number of messages currently on queue */
+  msglen_t msg_qbytes;		/* max number of bytes allowed on queue */
   __pid_t msg_lspid;		/* pid of last msgsnd() */
   __pid_t msg_lrpid;		/* pid of last msgrcv() */
 };
diff --git a/bits/stropts.h b/bits/stropts.h
index ed807473c2..62acfac34e 100644
--- a/bits/stropts.h
+++ b/bits/stropts.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1998, 1999 Free Software Foundation, Inc.
+/* Copyright (C) 1998, 1999, 2000 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -61,7 +61,7 @@
 				   of a STREAMS pipe.  */
 #define I_RECVFD    (__SID |14) /* Non-EFT definition.  */
 #define I_SWROPT    (__SID |19) /* Set the write mode.  */
-#define I_GWRSET    (__SID |20) /* Return the current write mode setting.  */
+#define I_GWROPT    (__SID |20) /* Return the current write mode setting.  */
 #define I_LIST	    (__SID |21) /* List all the module names on the STREAM, up
 				   to and including the topmost driver name. */
 #define I_PLINK	    (__SID |22) /* Connect two STREAMs with a persistent
@@ -91,7 +91,9 @@
 #define FLUSHR		0x01	/* Flush read queues.  */
 #define FLUSHW		0x02	/* Flush write queues.  */
 #define FLUSHRW		0x03	/* Flush read and write queues.  */
-#define FLUSHBAND	0x04	/* Flush only specified band.  */
+#ifdef __USE_GNU
+# define FLUSHBAND	0x04	/* Flush only specified band.  */
+#endif
 
 /* Possible arguments for `I_SETSIG'.  */
 #define S_INPUT		0x0001	/* A message, other than a high-priority
@@ -129,13 +131,17 @@
 #define RPROTNORM	0x0010	/* Fail `read' with EBADMSG if a message
 				   containing a control part is at the front
 				   of the STREAM head read queue.  */
-#define RPROTMASK	0x001C	/* The RPROT bits */
+#ifdef __USE_GNU
+# define RPROTMASK	0x001C	/* The RPROT bits */
+#endif
 
 /* Possible mode for `I_SWROPT'.  */
 #define SNDZERO		0x001	/* Send a zero-length message downstream when a
 				   `write' of 0 bytes occurs.  */
-#define	SNDPIPE		0x002	/* Send SIGPIPE on write and putmsg if
+#ifdef __USE_GNU
+# define SNDPIPE	0x002	/* Send SIGPIPE on write and putmsg if
 				   sd_werror is set.  */
+#endif
 
 /* Arguments for `I_ATMARK'.  */
 #define ANYMARK		0x01	/* Check if the message is marked.  */
@@ -143,8 +149,10 @@
 				   on the queue.  */
 
 /* Argument for `I_UNLINK'.  */
-#define MUXID_ALL	(-1)	/* Unlink all STREAMs linked to the STREAM
+#ifdef __USE_GNU
+# define MUXID_ALL	(-1)	/* Unlink all STREAMs linked to the STREAM
 				   associated with `fildes'.  */
+#endif
 
 
 /* Macros for `getmsg', `getpmsg', `putmsg' and `putpmsg'.  */
@@ -176,14 +184,14 @@ struct strpeek
   {
     struct strbuf ctlbuf;
     struct strbuf databuf;
-    __t_uscalar_t flags;		/* UnixWare/Solaris compatibility.  */
+    t_uscalar_t flags;			/* UnixWare/Solaris compatibility.  */
   };
 
 struct strfdinsert
   {
     struct strbuf ctlbuf;
     struct strbuf databuf;
-    __t_uscalar_t flags;		/* UnixWare/Solaris compatibility.  */
+    t_uscalar_t flags;			/* UnixWare/Solaris compatibility.  */
     int fildes;
     int offset;
   };
@@ -199,9 +207,9 @@ struct strioctl
 struct strrecvfd
   {
     int fd;
-    __uid_t uid;
-    __gid_t gid;
-    char fill[8];			/* UnixWare/Solaris compatibility */
+    uid_t uid;
+    gid_t gid;
+    char __fill[8];			/* UnixWare/Solaris compatibility */
   };
 
 
diff --git a/conform/conformtest.pl b/conform/conformtest.pl
index 08b46c1bf1..23fff7084d 100644
--- a/conform/conformtest.pl
+++ b/conform/conformtest.pl
@@ -4,7 +4,8 @@ $CC = "gcc";
 $CFLAGS = "-I. '-D__attribute__(x)=' -D_XOPEN_SOURCE=500";
 
 # List of the headers we are testing.
-@headers = ("strings.h", "string.h", "stdlib.h", "stdio.h",
+@headers = ("sys/msg.h", "sys/mman.h", "sys/ipc.h", "syslog.h",
+	    "stropts.h", "strings.h", "string.h", "stdlib.h", "stdio.h",
 	    "stddef.h", "stdarg.h", "signal.h", "setjmp.h", "semaphore.h",
 	    "search.h", "sched.h", "regex.h", "pwd.h", "pthread.h",
 	    "poll.h", "nl_types.h", "ndbm.h", "mqueue.h", "monetary.h",
@@ -13,7 +14,7 @@ $CFLAGS = "-I. '-D__attribute__(x)=' -D_XOPEN_SOURCE=500";
 	    "fmtmsg.h", "float.h", "fcntl.h", "errno.h", "dlfcn.h", "dirent.h",
 	    "ctype.h", "cpio.h", "assert.h", "aio.h");
 
-# These are the ISO C9x keywords.
+# These are the ISO C99 keywords.
 @keywords = ('auto', 'break', 'case', 'char', 'const', 'continue', 'default',
 	     'do', 'double', 'else', 'enum', 'extern', 'float', 'for', 'goto',
 	     'if', 'inline', 'int', 'long', 'register', 'restrict', 'return',
@@ -234,7 +235,9 @@ sub checknamespace {
 
 while ($#headers >= 0) {
   my($h) = pop (@headers);
-  my($fnamebase) = "$tmpdir/$h-test";
+  my($hf) = $h;
+  $hf =~ s|/|-|;
+  my($fnamebase) = "$tmpdir/$hf-test";
   my($missing);
   my(@allow) = ();
   my($prepend) = $mustprepend{$h};
diff --git a/conform/data/stropts.h-data b/conform/data/stropts.h-data
new file mode 100644
index 0000000000..318dc11b32
--- /dev/null
+++ b/conform/data/stropts.h-data
@@ -0,0 +1,123 @@
+type {struct bandinfo}
+
+element {struct bandinfo} {unsigned char} bi_pri
+element {struct bandinfo} int bi_flag
+
+type {struct strpeek}
+
+element {struct strpeek} {struct strbuf} ctlbuf
+element {struct strpeek} {struct strbuf} databuf
+element {struct strpeek} t_uscalar_t flags
+
+type {struct strbuf}
+
+element {struct strbuf} int maxlen
+element {struct strbuf} int len
+element {struct strbuf} {char*} buf
+
+type {struct strfdinsert}
+
+element {struct strfdinsert} {struct strbuf} ctlbuf
+element {struct strfdinsert} {struct strbuf} databuf
+element {struct strfdinsert} t_uscalar_t flags
+element {struct strfdinsert} int fildes
+element {struct strfdinsert} int offset
+
+type {struct strioctl}
+
+element {struct strioctl} int ic_cmd
+element {struct strioctl} int ic_timout
+element {struct strioctl} int ic_len
+element {struct strioctl} {char*} ic_dp
+
+type {struct strrecvfd}
+
+element {struct strrecvfd} int fd
+element {struct strrecvfd} uid_t uid
+element {struct strrecvfd} gid_t gid
+
+type uid_t
+type gid_t
+
+type t_uscalar_t
+
+type {struct str_list}
+
+element {struct str_list} int sl_nmods
+element {struct str_list} {struct str_mlist*} sl_modlist
+
+type {struct str_mlist}
+
+element {struct str_mlist} char l_name [FMNAMESZ+1]
+
+macro I_PUSH
+macro I_POP
+macro I_LOOK
+macro FMNAMESZ
+macro I_FLUSH
+macro FLUSHR
+macro FLUSHW
+macro FLUSHRW
+macro I_FLUSHBAND
+macro I_SETSIG
+macro S_RDNORM
+macro S_RDBAND
+macro S_INPUT
+macro S_HIPRI
+macro S_OUTPUT
+macro S_WRNORM
+macro S_WRBAND
+macro S_MSG
+macro S_ERROR
+macro S_HANGUP
+macro S_BANDURG
+macro I_GETSIG
+macro I_FIND
+macro I_PEEK
+macro RS_HIPRI
+macro I_SRDOPT
+macro RNORM
+macro RMSGD
+macro RMSGN
+macro RPROTNORM
+macro RPROTDAT
+macro RPROTDIS
+macro I_GRDOPT
+macro I_NREAD
+macro I_FDINSERT
+macro I_STR
+macro I_SWROPT
+macro SNDZERO
+macro I_GWROPT
+macro I_SENDFD
+macro I_RECVFD
+macro I_LIST
+macro I_ATMARK
+macro ANYMARK
+macro LASTMARK
+macro I_CKBAND
+macro I_GETBAND
+macro I_CANPUT
+macro I_SETCLTIME
+macro I_GETCLTIME
+macro I_LINK
+macro I_UNLINK
+macro I_PLINK
+macro I_PUNLINK
+
+macro MSG_ANY
+macro MSG_BAND
+macro MSG_HIPRI
+macro MORECTL
+macro MOREDATA
+
+function int isastream (int)
+function int getmsg (int, struct strbuf*, struct strbuf*, int*)
+function int getpmsg (int, struct strbuf*, struct strbuf*, int*, int*)
+function int ioctl (int, int, ...)
+function int putmsg (int, const struct strbuf*, const struct strbuf*, int)
+function int putpmsg (int, const struct strbuf*, const struct strbuf*, int, int)
+function int fattach (int, const char*)
+function int fdetach (const char*)
+
+allow-header unistd.h
diff --git a/conform/data/sys/ipc.h-data b/conform/data/sys/ipc.h-data
new file mode 100644
index 0000000000..0bfd22bad2
--- /dev/null
+++ b/conform/data/sys/ipc.h-data
@@ -0,0 +1,24 @@
+type {struct ipc_perm}
+
+element {struct ipc_perm} uid_t uid
+element {struct ipc_perm} gid_t gid
+element {struct ipc_perm} uid_t cuid
+element {struct ipc_perm} gid_t cgid
+element {struct ipc_perm} mode_t mode
+
+type uid_t
+type gid_t
+type mode_t
+type key_t
+
+constant IPC_CREAT
+constant IPC_EXCL
+constant IPC_NOWAIT
+
+constant IPC_PRIVATE
+
+constant IPC_RMID
+constant IPC_SET
+constant IPC_STAT
+
+function key_t ftok (const char*, int)
diff --git a/conform/data/sys/mman.h-data b/conform/data/sys/mman.h-data
new file mode 100644
index 0000000000..f45ea0c8c3
--- /dev/null
+++ b/conform/data/sys/mman.h-data
@@ -0,0 +1,32 @@
+constant PROT_READ
+constant PROT_WRITE
+constant PROT_EXEC
+constant PROT_NONE
+
+constant MAP_SHARED
+constant MAP_PRIVATE
+constant MAP_FIXED
+
+constant MS_ASYNC
+constant MS_SYNC
+constant MS_INVALIDATE
+
+constant MCL_CURRENT
+constant MCL_FUTURE
+
+constant MAP_FAILED
+
+type size_t
+type off_t
+type mode_t
+
+function int mlock (const void*, size_t)
+function int mlockall (int)
+function {void*} mmap (void*, size_t, int, int, int, off_t)
+function int mprotect (void*, size_t, int)
+function int msync (void*, size_t, int)
+function int munlock (const void*, size_t)
+function int munlockall (void)
+function int munmap (void*, size_t)
+function int shm_open (const char*, int, mode_t)
+function int shm_unlink (const char*)
diff --git a/conform/data/sys/msg.h-data b/conform/data/sys/msg.h-data
new file mode 100644
index 0000000000..69bd82f956
--- /dev/null
+++ b/conform/data/sys/msg.h-data
@@ -0,0 +1,28 @@
+type {struct msqid_ds}
+
+type msgqnum_t
+type msglen_t
+
+constant MSG_NOERROR
+
+element {struct msqid_ds} {struct ipc_perm} msg_perm
+element {struct msqid_ds} msgqnum_t msg_qnum
+element {struct msqid_ds} msglen_t msg_qbytes
+element {struct msqid_ds} pid_t msg_lspid
+element {struct msqid_ds} pid_t msg_lrpid
+element {struct msqid_ds} time_t msg_stime
+element {struct msqid_ds} time_t msg_rtime
+element {struct msqid_ds} time_t msg_ctime
+
+type pid_t
+type time_t
+type key_t
+type size_t
+type ssize_t
+
+function int msgctl (int, int, struct msqid_ds*)
+function int msgget (key_t, int)
+function ssize_t msgrcv (int, void*, size_t, long int, int)
+function int msgsnd (int, const void*, size_t, int)
+
+allow-header sys/ipc.h
diff --git a/conform/data/syslog.h-data b/conform/data/syslog.h-data
new file mode 100644
index 0000000000..62ae5512ac
--- /dev/null
+++ b/conform/data/syslog.h-data
@@ -0,0 +1,39 @@
+constant LOG_PID
+constant LOG_CONS
+constant LOG_NDELAY
+constant LOG_ODELAY
+constant LOG_NOWAIT
+
+constant LOG_KERN
+constant LOG_USER
+constant LOG_MAIL
+constant LOG_NEWS
+constant LOG_UUCP
+constant LOG_DAEMON
+constant LOG_AUTH
+constant LOG_CRON
+constant LOG_LPR
+constant LOG_LOCAL0
+constant LOG_LOCAL1
+constant LOG_LOCAL2
+constant LOG_LOCAL3
+constant LOG_LOCAL4
+constant LOG_LOCAL5
+constant LOG_LOCAL6
+constant LOG_LOCAL7
+
+macro LOG_MASK
+
+constant LOG_EMERG
+constant LOG_ALERT
+constant LOG_CRIT
+constant LOG_ERR
+constant LOG_WARNING
+constant LOG_NOTICE
+constant LOG_INFO
+constant LOG_DEBUG
+
+function void closelog (void)
+function void openlog (const char*, int, int)
+function int setlogmask (int)
+function void syslog (int, const char*, ...)
diff --git a/misc/sys/mman.h b/misc/sys/mman.h
index a39639c995..4aa4a52118 100644
--- a/misc/sys/mman.h
+++ b/misc/sys/mman.h
@@ -1,5 +1,5 @@
 /* Definitions for BSD-style memory management.
-   Copyright (C) 1994, 95, 96, 97, 98, 99 Free Software Foundation, Inc.
+   Copyright (C) 1994-1999, 2000 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -25,6 +25,20 @@
 #define __need_size_t
 #include <stddef.h>
 
+#ifndef __off_t_defined
+# ifndef __USE_FILE_OFFSET64
+typedef __off_t off_t;
+# else
+typedef __off64_t off_t;
+# endif
+# define __off_t_defined
+#endif
+
+#ifndef __mode_t_defined
+typedef __mode_t mode_t;
+# define __mode_t_defined
+#endif
+
 #include <bits/mman.h>
 
 /* Return value of `mmap' in case of an error.  */
diff --git a/streams/stropts.h b/streams/stropts.h
index fa5c249831..dda28573e9 100644
--- a/streams/stropts.h
+++ b/streams/stropts.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1998, 1999 Free Software Foundation, Inc.
+/* Copyright (C) 1998, 1999, 2000 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -22,6 +22,18 @@
 #include <features.h>
 #include <bits/types.h>
 
+#ifndef __gid_t_defined
+typedef __gid_t gid_t;
+# define __gid_t_defined
+#endif
+
+#ifndef __uid_t_defined
+typedef __uid_t uid_t;
+# define __uid_t_defined
+#endif
+
+typedef __t_uscalar_t t_uscalar_t;
+
 /* Get system specific contants.  */
 #include <bits/stropts.h>
 
diff --git a/sysdeps/generic/bits/msq.h b/sysdeps/generic/bits/msq.h
index a263869a0e..131fc48521 100644
--- a/sysdeps/generic/bits/msq.h
+++ b/sysdeps/generic/bits/msq.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1995, 1997 Free Software Foundation, Inc.
+/* Copyright (C) 1995, 1997, 2000 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -20,11 +20,15 @@
 #error "Never use <bits/msq.h> directly; include <sys/msg.h> instead."
 #endif
 
-#include <sys/types.h>
+#include <bits/types.h>
 
 /* Define options for message queue functions.  */
 #define MSG_NOERROR	010000	/* no error if message is too big */
 
+/* Types used in the structure definition.  */
+typedef unsigned short int msgqnum_t;
+typedef unsigned short int msglen_t;
+
 
 /* Structure of record for one message inside the kernel.
    The type `struct __msg' is opaque.  */
@@ -34,8 +38,8 @@ struct msqid_ds
   __time_t msg_stime;		/* time of last msgsnd command */
   __time_t msg_rtime;		/* time of last msgrcv command */
   __time_t msg_ctime;		/* time of last change */
-  unsigned short int msg_qnum;	/* number of messages currently on queue */
-  unsigned short int msg_qbytes;/* max number of bytes allowed on queue */
+  msgqnum_t msg_qnum;		/* number of messages currently on queue */
+  msglen_t msg_qbytes;		/* max number of bytes allowed on queue */
   __pid_t msg_lspid;		/* pid of last msgsnd() */
   __pid_t msg_lrpid;		/* pid of last msgrcv() */
 };
diff --git a/sysdeps/generic/bits/stropts.h b/sysdeps/generic/bits/stropts.h
index ed807473c2..62acfac34e 100644
--- a/sysdeps/generic/bits/stropts.h
+++ b/sysdeps/generic/bits/stropts.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1998, 1999 Free Software Foundation, Inc.
+/* Copyright (C) 1998, 1999, 2000 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -61,7 +61,7 @@
 				   of a STREAMS pipe.  */
 #define I_RECVFD    (__SID |14) /* Non-EFT definition.  */
 #define I_SWROPT    (__SID |19) /* Set the write mode.  */
-#define I_GWRSET    (__SID |20) /* Return the current write mode setting.  */
+#define I_GWROPT    (__SID |20) /* Return the current write mode setting.  */
 #define I_LIST	    (__SID |21) /* List all the module names on the STREAM, up
 				   to and including the topmost driver name. */
 #define I_PLINK	    (__SID |22) /* Connect two STREAMs with a persistent
@@ -91,7 +91,9 @@
 #define FLUSHR		0x01	/* Flush read queues.  */
 #define FLUSHW		0x02	/* Flush write queues.  */
 #define FLUSHRW		0x03	/* Flush read and write queues.  */
-#define FLUSHBAND	0x04	/* Flush only specified band.  */
+#ifdef __USE_GNU
+# define FLUSHBAND	0x04	/* Flush only specified band.  */
+#endif
 
 /* Possible arguments for `I_SETSIG'.  */
 #define S_INPUT		0x0001	/* A message, other than a high-priority
@@ -129,13 +131,17 @@
 #define RPROTNORM	0x0010	/* Fail `read' with EBADMSG if a message
 				   containing a control part is at the front
 				   of the STREAM head read queue.  */
-#define RPROTMASK	0x001C	/* The RPROT bits */
+#ifdef __USE_GNU
+# define RPROTMASK	0x001C	/* The RPROT bits */
+#endif
 
 /* Possible mode for `I_SWROPT'.  */
 #define SNDZERO		0x001	/* Send a zero-length message downstream when a
 				   `write' of 0 bytes occurs.  */
-#define	SNDPIPE		0x002	/* Send SIGPIPE on write and putmsg if
+#ifdef __USE_GNU
+# define SNDPIPE	0x002	/* Send SIGPIPE on write and putmsg if
 				   sd_werror is set.  */
+#endif
 
 /* Arguments for `I_ATMARK'.  */
 #define ANYMARK		0x01	/* Check if the message is marked.  */
@@ -143,8 +149,10 @@
 				   on the queue.  */
 
 /* Argument for `I_UNLINK'.  */
-#define MUXID_ALL	(-1)	/* Unlink all STREAMs linked to the STREAM
+#ifdef __USE_GNU
+# define MUXID_ALL	(-1)	/* Unlink all STREAMs linked to the STREAM
 				   associated with `fildes'.  */
+#endif
 
 
 /* Macros for `getmsg', `getpmsg', `putmsg' and `putpmsg'.  */
@@ -176,14 +184,14 @@ struct strpeek
   {
     struct strbuf ctlbuf;
     struct strbuf databuf;
-    __t_uscalar_t flags;		/* UnixWare/Solaris compatibility.  */
+    t_uscalar_t flags;			/* UnixWare/Solaris compatibility.  */
   };
 
 struct strfdinsert
   {
     struct strbuf ctlbuf;
     struct strbuf databuf;
-    __t_uscalar_t flags;		/* UnixWare/Solaris compatibility.  */
+    t_uscalar_t flags;			/* UnixWare/Solaris compatibility.  */
     int fildes;
     int offset;
   };
@@ -199,9 +207,9 @@ struct strioctl
 struct strrecvfd
   {
     int fd;
-    __uid_t uid;
-    __gid_t gid;
-    char fill[8];			/* UnixWare/Solaris compatibility */
+    uid_t uid;
+    gid_t gid;
+    char __fill[8];			/* UnixWare/Solaris compatibility */
   };
 
 
diff --git a/sysdeps/gnu/bits/ipc.h b/sysdeps/gnu/bits/ipc.h
index eb9bcff6a4..ec0dbd86c4 100644
--- a/sysdeps/gnu/bits/ipc.h
+++ b/sysdeps/gnu/bits/ipc.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1995, 1996, 1997, 1998, 1999 Free Software Foundation, Inc.
+/* Copyright (C) 1995-1999, 2000 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -31,7 +31,9 @@
 #define IPC_RMID	0		/* Remove identifier.  */
 #define IPC_SET		1		/* Set `ipc_perm' options.  */
 #define IPC_STAT	2		/* Get `ipc_perm' options.  */
-#define IPC_INFO	3		/* See ipcs.  */
+#ifdef __USE_GNU
+# define IPC_INFO	3		/* See ipcs.  */
+#endif
 
 /* Special key values.  */
 #define IPC_PRIVATE	((__key_t) 0)	/* Private key.  */
diff --git a/sysdeps/gnu/bits/msq.h b/sysdeps/gnu/bits/msq.h
index d7a8e5ee0f..874c369d65 100644
--- a/sysdeps/gnu/bits/msq.h
+++ b/sysdeps/gnu/bits/msq.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
+/* Copyright (C) 1995, 1996, 1997, 2000 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -20,11 +20,17 @@
 # error "Never use <bits/msq.h> directly; include <sys/msg.h> instead."
 #endif
 
-#include <sys/types.h>
+#include <bits/types.h>
 
 /* Define options for message queue functions.  */
 #define MSG_NOERROR	010000	/* no error if message is too big */
-#define MSG_EXCEPT	020000	/* recv any msg except of specified type */
+#ifdef __USE_GNU
+# define MSG_EXCEPT	020000	/* recv any msg except of specified type */
+#endif
+
+/* Types used in the structure definition.  */
+typedef unsigned short int msgqnum_t;
+typedef unsigned short int msglen_t;
 
 
 /* Structure of record for one message inside the kernel.
@@ -40,8 +46,8 @@ struct msqid_ds
   struct wait_queue *__wwait;	/* ??? */
   struct wait_queue *__rwait;	/* ??? */
   unsigned short int __msg_cbytes;/* current number of bytes on queue */
-  unsigned short int msg_qnum;	/* number of messages currently on queue */
-  unsigned short int msg_qbytes;/* max number of bytes allowed on queue */
+  msgqnum_t msg_qnum;		/* number of messages currently on queue */
+  msglen_t msg_qbytes;		/* max number of bytes allowed on queue */
   __ipc_pid_t msg_lspid;	/* pid of last msgsnd() */
   __ipc_pid_t msg_lrpid;	/* pid of last msgrcv() */
 };
diff --git a/sysdeps/unix/sysv/linux/alpha/bits/ipc.h b/sysdeps/unix/sysv/linux/alpha/bits/ipc.h
index 7ad2c7c8e0..004a683112 100644
--- a/sysdeps/unix/sysv/linux/alpha/bits/ipc.h
+++ b/sysdeps/unix/sysv/linux/alpha/bits/ipc.h
@@ -31,7 +31,9 @@
 #define IPC_RMID	0		/* Remove identifier.  */
 #define IPC_SET		1		/* Set `ipc_perm' options.  */
 #define IPC_STAT	2		/* Get `ipc_perm' options.  */
-#define IPC_INFO	3		/* See ipcs.  */
+#ifdef __USE_GNU
+# define IPC_INFO	3		/* See ipcs.  */
+#endif
 
 /* Special key values.  */
 #define IPC_PRIVATE	((__key_t) 0)	/* Private key.  */
diff --git a/sysdeps/unix/sysv/linux/alpha/bits/msq.h b/sysdeps/unix/sysv/linux/alpha/bits/msq.h
index 3e784d9544..3ca076e9f9 100644
--- a/sysdeps/unix/sysv/linux/alpha/bits/msq.h
+++ b/sysdeps/unix/sysv/linux/alpha/bits/msq.h
@@ -20,11 +20,17 @@
 # error "Never use <bits/msq.h> directly; include <sys/msg.h> instead."
 #endif
 
-#include <sys/types.h>
+#include <bits/types.h>
 
 /* Define options for message queue functions.  */
 #define MSG_NOERROR	010000	/* no error if message is too big */
-#define MSG_EXCEPT	020000	/* recv any msg except of specified type */
+#ifdef __USE_GNU
+# define MSG_EXCEPT	020000	/* recv any msg except of specified type */
+#endif
+
+/* Types used in the structure definition.  */
+typedef unsigned long int msgqnum_t;
+typedef unsigned long int msglen_t;
 
 
 /* Structure of record for one message inside the kernel.
@@ -36,8 +42,8 @@ struct msqid_ds
   __time_t msg_rtime;		/* time of last msgrcv command */
   __time_t msg_ctime;		/* time of last change */
   unsigned long int __msg_cbytes; /* current number of bytes on queue */
-  unsigned long int msg_qnum;	/* number of messages currently on queue */
-  unsigned long int msg_qbytes;	/* max number of bytes allowed on queue */
+  msgqnum_t msg_qnum;		/* number of messages currently on queue */
+  msglen_t msg_qbytes;		/* max number of bytes allowed on queue */
   pid_t msg_lspid;		/* pid of last msgsnd() */
   pid_t msg_lrpid;		/* pid of last msgrcv() */
   unsigned long int __unused1;
diff --git a/sysdeps/unix/sysv/linux/bits/ipc.h b/sysdeps/unix/sysv/linux/bits/ipc.h
index 2375e4b6d4..dab0792805 100644
--- a/sysdeps/unix/sysv/linux/bits/ipc.h
+++ b/sysdeps/unix/sysv/linux/bits/ipc.h
@@ -31,7 +31,9 @@
 #define IPC_RMID	0		/* Remove identifier.  */
 #define IPC_SET		1		/* Set `ipc_perm' options.  */
 #define IPC_STAT	2		/* Get `ipc_perm' options.  */
-#define IPC_INFO	3		/* See ipcs.  */
+#ifdef __USE_GNU
+# define IPC_INFO	3		/* See ipcs.  */
+#endif
 
 /* Special key values.  */
 #define IPC_PRIVATE	((__key_t) 0)	/* Private key.  */
diff --git a/sysdeps/unix/sysv/linux/bits/msq.h b/sysdeps/unix/sysv/linux/bits/msq.h
index c5c375a4ab..840ddd6a8f 100644
--- a/sysdeps/unix/sysv/linux/bits/msq.h
+++ b/sysdeps/unix/sysv/linux/bits/msq.h
@@ -20,11 +20,17 @@
 # error "Never use <bits/msq.h> directly; include <sys/msg.h> instead."
 #endif
 
-#include <sys/types.h>
+#include <bits/types.h>
 
 /* Define options for message queue functions.  */
 #define MSG_NOERROR	010000	/* no error if message is too big */
-#define MSG_EXCEPT	020000	/* recv any msg except of specified type */
+#ifdef __USE_GNU
+# define MSG_EXCEPT	020000	/* recv any msg except of specified type */
+#endif
+
+/* Types used in the structure definition.  */
+typedef unsigned long int msgqnum_t;
+typedef unsigned long int msglen_t;
 
 
 /* Structure of record for one message inside the kernel.
@@ -39,8 +45,8 @@ struct msqid_ds
   __time_t msg_ctime;		/* time of last change */
   unsigned long int __unused3;
   unsigned long int __msg_cbytes; /* current number of bytes on queue */
-  unsigned long int msg_qnum;	/* number of messages currently on queue */
-  unsigned long int msg_qbytes;	/* max number of bytes allowed on queue */
+  msgqnum_t msg_qnum;		/* number of messages currently on queue */
+  msglen_t msg_qbytes;		/* max number of bytes allowed on queue */
   pid_t msg_lspid;		/* pid of last msgsnd() */
   pid_t msg_lrpid;		/* pid of last msgrcv() */
   unsigned long int __unused4;
diff --git a/sysdeps/unix/sysv/linux/mips/bits/ipc.h b/sysdeps/unix/sysv/linux/mips/bits/ipc.h
index 3c2e5276b8..8364dca56e 100644
--- a/sysdeps/unix/sysv/linux/mips/bits/ipc.h
+++ b/sysdeps/unix/sysv/linux/mips/bits/ipc.h
@@ -31,7 +31,9 @@
 #define IPC_RMID	0		/* Remove identifier.  */
 #define IPC_SET		1		/* Set `ipc_perm' options.  */
 #define IPC_STAT	2		/* Get `ipc_perm' options.  */
-#define IPC_INFO	3		/* See ipcs.  */
+#ifdef __USE_GNU
+# define IPC_INFO	3		/* See ipcs.  */
+#endif
 
 /* Special key values.  */
 #define IPC_PRIVATE	((__key_t) 0)	/* Private key.  */
@@ -58,15 +60,17 @@ extern int __ipc (int __call, int __first, int __second, int __third,
 
 __END_DECLS
 
+#ifdef __USE_GNU
 /* The codes for the functions to use the multiplexer `__ipc'.  */
-#define IPCOP_semop	 1
-#define IPCOP_semget	 2
-#define IPCOP_semctl	 3
-#define IPCOP_msgsnd	11
-#define IPCOP_msgrcv	12
-#define IPCOP_msgget	13
-#define IPCOP_msgctl	14
-#define IPCOP_shmat	21
-#define IPCOP_shmdt	22
-#define IPCOP_shmget	23
-#define IPCOP_shmctl	24
+# define IPCOP_semop	 1
+# define IPCOP_semget	 2
+# define IPCOP_semctl	 3
+# define IPCOP_msgsnd	11
+# define IPCOP_msgrcv	12
+# define IPCOP_msgget	13
+# define IPCOP_msgctl	14
+# define IPCOP_shmat	21
+# define IPCOP_shmdt	22
+# define IPCOP_shmget	23
+# define IPCOP_shmctl	24
+#endif
diff --git a/sysdeps/unix/sysv/linux/powerpc/bits/ipc.h b/sysdeps/unix/sysv/linux/powerpc/bits/ipc.h
index 58f6d99488..fa96134553 100644
--- a/sysdeps/unix/sysv/linux/powerpc/bits/ipc.h
+++ b/sysdeps/unix/sysv/linux/powerpc/bits/ipc.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1995, 1996, 1997, 1998, 1999 Free Software Foundation, Inc.
+/* Copyright (C) 1995-1999, 2000 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -31,7 +31,9 @@
 #define IPC_RMID	0		/* Remove identifier.  */
 #define IPC_SET		1		/* Set `ipc_perm' options.  */
 #define IPC_STAT	2		/* Get `ipc_perm' options.  */
-#define IPC_INFO	3		/* See ipcs.  */
+#ifdef __USE_GNU
+# define IPC_INFO	3		/* See ipcs.  */
+#endif
 
 /* Special key values.  */
 #define IPC_PRIVATE	((__key_t) 0)	/* Private key.  */
@@ -58,15 +60,17 @@ extern int __ipc __P ((int __call, int __first, int __second, int __third,
 
 __END_DECLS
 
+#ifdef __USE_GNU
 /* The codes for the functions to use the multiplexer `__ipc'.  */
-#define IPCOP_semop	 1
-#define IPCOP_semget	 2
-#define IPCOP_semctl	 3
-#define IPCOP_msgsnd	11
-#define IPCOP_msgrcv	12
-#define IPCOP_msgget	13
-#define IPCOP_msgctl	14
-#define IPCOP_shmat	21
-#define IPCOP_shmdt	22
-#define IPCOP_shmget	23
-#define IPCOP_shmctl	24
+# define IPCOP_semop	 1
+# define IPCOP_semget	 2
+# define IPCOP_semctl	 3
+# define IPCOP_msgsnd	11
+# define IPCOP_msgrcv	12
+# define IPCOP_msgget	13
+# define IPCOP_msgctl	14
+# define IPCOP_shmat	21
+# define IPCOP_shmdt	22
+# define IPCOP_shmget	23
+# define IPCOP_shmctl	24
+#endif
diff --git a/sysdeps/unix/sysv/linux/sparc/bits/ipc.h b/sysdeps/unix/sysv/linux/sparc/bits/ipc.h
index 7ba6d6753f..e5dcd3dda1 100644
--- a/sysdeps/unix/sysv/linux/sparc/bits/ipc.h
+++ b/sysdeps/unix/sysv/linux/sparc/bits/ipc.h
@@ -32,7 +32,9 @@
 #define IPC_RMID	0		/* Remove identifier.  */
 #define IPC_SET		1		/* Set `ipc_perm' options.  */
 #define IPC_STAT	2		/* Get `ipc_perm' options.  */
-#define IPC_INFO	3		/* See ipcs.  */
+#ifdef __USE_GNU
+# define IPC_INFO	3		/* See ipcs.  */
+#endif
 
 /* Special key values.  */
 #define IPC_PRIVATE	((__key_t) 0)	/* Private key.  */
@@ -51,7 +53,7 @@ struct ipc_perm
     unsigned short int mode;		/* Read/write permission.  */
     unsigned short int __pad2;
 #else
-    unsigned int mode;			/* Read/write permission.  */
+    __mode_t mode;			/* Read/write permission.  */
     unsigned short int __pad1;
 #endif
     unsigned short int __seq;		/* Sequence number.  */
diff --git a/sysdeps/unix/sysv/linux/sparc/bits/msq.h b/sysdeps/unix/sysv/linux/sparc/bits/msq.h
index 6bc88ae25f..6b32ef94c4 100644
--- a/sysdeps/unix/sysv/linux/sparc/bits/msq.h
+++ b/sysdeps/unix/sysv/linux/sparc/bits/msq.h
@@ -20,12 +20,18 @@
 # error "Never use <bits/msq.h> directly; include <sys/msg.h> instead."
 #endif
 
-#include <sys/types.h>
+#include <bits/types.h>
 #include <bits/wordsize.h>
 
 /* Define options for message queue functions.  */
 #define MSG_NOERROR	010000	/* no error if message is too big */
-#define MSG_EXCEPT	020000	/* recv any msg except of specified type */
+#ifdef __USE_GNU
+# define MSG_EXCEPT	020000	/* recv any msg except of specified type */
+#endif
+
+/* Types used in the structure definition.  */
+typedef unsigned long int msgqnum_t;
+typedef unsigned long int msglen_t;
 
 
 /* Structure of record for one message inside the kernel.
@@ -46,8 +52,8 @@ struct msqid_ds
 #endif
   __time_t msg_ctime;		/* time of last change */
   unsigned long int __msg_cbytes; /* current number of bytes on queue */
-  unsigned long int msg_qnum;	/* number of messages currently on queue */
-  unsigned long int msg_qbytes;	/* max number of bytes allowed on queue */
+  msgqnum_t msg_qnum;		/* number of messages currently on queue */
+  msglen_t msg_qbytes;		/* max number of bytes allowed on queue */
   pid_t msg_lspid;		/* pid of last msgsnd() */
   pid_t msg_lrpid;		/* pid of last msgrcv() */
   unsigned long int __unused1;
diff --git a/sysvipc/sys/msg.h b/sysvipc/sys/msg.h
index 2a726dc654..967ce0c87d 100644
--- a/sysvipc/sys/msg.h
+++ b/sysvipc/sys/msg.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1995, 1996, 1997, 1999 Free Software Foundation, Inc.
+/* Copyright (C) 1995, 1996, 1997, 1999, 2000 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -20,7 +20,6 @@
 #define _SYS_MSG_H
 
 #include <features.h>
-#include <sys/types.h>
 
 /* Get common definition of System V style IPC.  */
 #include <sys/ipc.h>
@@ -28,15 +27,31 @@
 /* Get system dependent definition of `struct msqid_ds' and more.  */
 #include <bits/msq.h>
 
+/* Define types required by the standard.  */
+#define	__need_time_t
+#include <time.h>
+
+#ifndef __pid_t_defined
+typedef __pid_t pid_t;
+# define __pid_t_defined
+#endif
+
+#ifndef __ssize_t_defined
+typedef __ssize_t ssize_t;
+# define __ssize_t_defined
+#endif
+
 /* The following System V style IPC functions implement a message queue
    system.  The definition is found in XPG2.  */
 
+#ifdef __USE_GNU
 /* Template for struct to be used as argument for `msgsnd' and `msgrcv'.  */
 struct msgbuf
   {
     long int mtype;		/* type of received/sent message */
     char mtext[1];		/* text of the message */
   };
+#endif
 
 
 __BEGIN_DECLS