about summary refs log tree commit diff
path: root/sysdeps
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps')
-rw-r--r--sysdeps/unix/sysv/linux/Versions4
-rw-r--r--sysdeps/unix/sysv/linux/alpha/bits/ipc.h22
-rw-r--r--sysdeps/unix/sysv/linux/alpha/bits/msq.h87
-rw-r--r--sysdeps/unix/sysv/linux/alpha/bits/sem.h99
-rw-r--r--sysdeps/unix/sysv/linux/alpha/bits/shm.h113
-rw-r--r--sysdeps/unix/sysv/linux/bits/ipc.h92
-rw-r--r--sysdeps/unix/sysv/linux/bits/msq.h90
-rw-r--r--sysdeps/unix/sysv/linux/bits/sem.h101
-rw-r--r--sysdeps/unix/sysv/linux/bits/shm.h116
-rw-r--r--sysdeps/unix/sysv/linux/execve.c5
-rw-r--r--sysdeps/unix/sysv/linux/i386/chown.c16
-rw-r--r--sysdeps/unix/sysv/linux/i386/fchown.c4
-rw-r--r--sysdeps/unix/sysv/linux/i386/lchown.c5
-rw-r--r--sysdeps/unix/sysv/linux/i386/setregid.c4
-rw-r--r--sysdeps/unix/sysv/linux/i386/setresgid.c6
-rw-r--r--sysdeps/unix/sysv/linux/i386/setresuid.c8
-rw-r--r--sysdeps/unix/sysv/linux/i386/setreuid.c4
-rw-r--r--sysdeps/unix/sysv/linux/kernel-features.h5
-rw-r--r--sysdeps/unix/sysv/linux/m68k/chown.c31
-rw-r--r--sysdeps/unix/sysv/linux/msgctl.c85
-rw-r--r--sysdeps/unix/sysv/linux/msgget.c3
-rw-r--r--sysdeps/unix/sysv/linux/msgrcv.c3
-rw-r--r--sysdeps/unix/sysv/linux/msgsnd.c5
-rw-r--r--sysdeps/unix/sysv/linux/pwrite64.c4
-rw-r--r--sysdeps/unix/sysv/linux/semctl.c88
-rw-r--r--sysdeps/unix/sysv/linux/semget.c3
-rw-r--r--sysdeps/unix/sysv/linux/semop.c3
-rw-r--r--sysdeps/unix/sysv/linux/shmat.c3
-rw-r--r--sysdeps/unix/sysv/linux/shmctl.c100
-rw-r--r--sysdeps/unix/sysv/linux/shmdt.c3
-rw-r--r--sysdeps/unix/sysv/linux/shmget.c3
-rw-r--r--sysdeps/unix/sysv/linux/sparc/bits/ipc.h98
-rw-r--r--sysdeps/unix/sysv/linux/sparc/bits/msq.h99
-rw-r--r--sysdeps/unix/sysv/linux/sparc/bits/sem.h106
-rw-r--r--sysdeps/unix/sysv/linux/sparc/bits/shm.h123
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sparc32/Dist2
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sparc32/mmap64.c8
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sparc32/setegid.c52
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sparc32/seteuid.c56
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sparc32/setresgid.c1
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sparc32/setresuid.c1
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sparc32/syscalls.list28
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sparc64/msgctl.c36
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sparc64/semctl.c54
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sparc64/shmctl.c35
-rw-r--r--sysdeps/unix/sysv/linux/syscalls.list2
-rw-r--r--sysdeps/unix/sysv/linux/truncate64.c2
47 files changed, 1750 insertions, 68 deletions
diff --git a/sysdeps/unix/sysv/linux/Versions b/sysdeps/unix/sysv/linux/Versions
index 6210830cce..074938c3da 100644
--- a/sysdeps/unix/sysv/linux/Versions
+++ b/sysdeps/unix/sysv/linux/Versions
@@ -82,4 +82,8 @@ libc {
     # u*
     umount2;
   }
+  GLIBC_2.2 {
+    # ipc ctl interface change.
+    semctl; shmctl; msgctl;
+  }
 }
diff --git a/sysdeps/unix/sysv/linux/alpha/bits/ipc.h b/sysdeps/unix/sysv/linux/alpha/bits/ipc.h
index 804e1ee3f7..0196fe490f 100644
--- a/sysdeps/unix/sysv/linux/alpha/bits/ipc.h
+++ b/sysdeps/unix/sysv/linux/alpha/bits/ipc.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1995, 1996, 1997, 1998, 1999 Free Software Foundation, Inc.
+/* Copyright (C) 1995, 1996, 1997, 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
@@ -47,15 +47,29 @@ struct ipc_perm
     unsigned int cgid;			/* Creator's group ID.  */
     unsigned int mode;			/* Read/write permission.  */
     unsigned short int __seq;		/* Sequence number.  */
+    unsigned short int __pad1;
+    unsigned long int __unused1;
+    unsigned long int __unused2;
   };
 
+#ifdef __LIBC_IPC_INTERNAL
 
+struct __old_ipc_perm
+  {
+    __key_t __key;			/* Key.  */
+    unsigned int uid;			/* Owner's user ID.  */
+    unsigned int gid;			/* Owner's group ID.  */
+    unsigned int cuid;			/* Creator's user ID.  */
+    unsigned int cgid;			/* Creator's group ID.  */
+    unsigned int mode;			/* Read/write permission.  */
+    unsigned short int __seq;		/* Sequence number.  */
+  };
 
 __BEGIN_DECLS
 
 /* The actual system call: all functions are multiplexed by this.  */
-extern int __ipc __P ((int __call, int __first, int __second, int __third,
-		       void *__ptr));
+extern int __ipc (int __call, int __first, int __second, int __third,
+		  void *__ptr);
 
 __END_DECLS
 
@@ -71,3 +85,5 @@ __END_DECLS
 #define IPCOP_shmdt	22
 #define IPCOP_shmget	23
 #define IPCOP_shmctl	24
+
+#endif
diff --git a/sysdeps/unix/sysv/linux/alpha/bits/msq.h b/sysdeps/unix/sysv/linux/alpha/bits/msq.h
new file mode 100644
index 0000000000..a8d4cc6711
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/alpha/bits/msq.h
@@ -0,0 +1,87 @@
+/* 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
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+#ifndef _SYS_MSG_H
+# error "Never use <bits/msq.h> directly; include <sys/msg.h> instead."
+#endif
+
+#include <sys/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 */
+
+
+/* Structure of record for one message inside the kernel.
+   The type `struct msg' is opaque.  */
+struct msqid_ds
+{
+  struct ipc_perm msg_perm;	/* structure describing operation permission */
+  __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 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 */
+  pid_t msg_lspid;		/* pid of last msgsnd() */
+  pid_t msg_lrpid;		/* pid of last msgrcv() */
+  unsigned long int __unused1;
+  unsigned long int __unused2;
+};
+
+#ifdef __LIBC_IPC_INTERNAL
+struct __old_msqid_ds
+{
+  struct __old_ipc_perm msg_perm;	/* structure describing operation permission */
+  struct msg *__msg_first;		/* pointer to first message on queue */
+  struct msg *__msg_last;		/* pointer to last message on queue */
+  __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 */
+  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 */
+  __ipc_pid_t msg_lspid;		/* pid of last msgsnd() */
+  __ipc_pid_t msg_lrpid;		/* pid of last msgrcv() */
+};
+#endif
+
+#ifdef __USE_MISC
+
+# define msg_cbytes	__msg_cbytes
+
+/* ipcs ctl commands */
+# define MSG_STAT 11
+# define MSG_INFO 12
+
+/* buffer for msgctl calls IPC_INFO, MSG_INFO */
+struct msginfo
+  {
+    int msgpool;
+    int msgmap;
+    int msgmax;
+    int msgmnb;
+    int msgmni;
+    int msgssz;
+    int msgtql;
+    unsigned short int msgseg;
+  };
+
+#endif /* __USE_MISC */
diff --git a/sysdeps/unix/sysv/linux/alpha/bits/sem.h b/sysdeps/unix/sysv/linux/alpha/bits/sem.h
new file mode 100644
index 0000000000..19a3aa52cc
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/alpha/bits/sem.h
@@ -0,0 +1,99 @@
+/* Copyright (C) 1995, 1996, 1997, 1998, 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
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+#ifndef _SYS_SEM_H
+# error "Never include <bits/sem.h> directly; use <sys/sem.h> instead."
+#endif
+
+#include <sys/types.h>
+
+/* Flags for `semop'.  */
+#define SEM_UNDO	0x1000		/* undo the operation on exit */
+
+/* Commands for `semctl'.  */
+#define GETPID		11		/* get sempid */
+#define GETVAL		12		/* get semval */
+#define GETALL		13		/* get all semval's */
+#define GETNCNT		14		/* get semncnt */
+#define GETZCNT		15		/* get semzcnt */
+#define SETVAL		16		/* set semval */
+#define SETALL		17		/* set all semval's */
+
+
+/* Data structure describing a set of semaphores.  */
+struct semid_ds
+{
+  struct ipc_perm sem_perm;		/* operation permission struct */
+  __time_t sem_otime;			/* last semop() time */
+  __time_t sem_ctime;			/* last time changed by semctl() */
+  unsigned long int sem_nsems;		/* number of semaphores in set */
+  unsigned long int __unused1;
+  unsigned long int __unused2;
+};
+
+#ifdef __LIBC_IPC_INTERNAL
+struct __old_semid_ds
+{
+  struct __old_ipc_perm sem_perm;	/* operation permission struct */
+  __time_t sem_otime;			/* last semop() time */
+  __time_t sem_ctime;			/* last time changed by semctl() */
+  struct sem *__sembase;		/* ptr to first semaphore in array */
+  struct sem_queue *__sem_pending;	/* pending operations */
+  struct sem_queue *__sem_pending_last; /* last pending operation */
+  struct sem_undo *__undo;		/* ondo requests on this array */
+  unsigned short int sem_nsems;		/* number of semaphores in set */
+};
+#endif
+
+/* The user should define a union like the following to use it for arguments
+   for `semctl'.
+
+   union semun
+   {
+     int val;				<= value for SETVAL
+     struct semid_ds *buf;		<= buffer for IPC_STAT & IPC_SET
+     unsigned short int *array;		<= array for GETALL & SETALL
+     struct seminfo *__buf;		<= buffer for IPC_INFO
+   };
+
+   Previous versions of this file used to define this union but this is
+   incorrect.  One can test the macro _SEM_SEMUN_UNDEFINED to see whether
+   one must define the union or not.  */
+#define _SEM_SEMUN_UNDEFINED	1
+
+#ifdef __USE_MISC
+
+/* ipcs ctl cmds */
+# define SEM_STAT 18
+# define SEM_INFO 19
+
+struct  seminfo
+{
+  int semmap;
+  int semmni;
+  int semmns;
+  int semmnu;
+  int semmsl;
+  int semopm;
+  int semume;
+  int semusz;
+  int semvmx;
+  int semaem;
+};
+
+#endif /* __USE_MISC */
diff --git a/sysdeps/unix/sysv/linux/alpha/bits/shm.h b/sysdeps/unix/sysv/linux/alpha/bits/shm.h
new file mode 100644
index 0000000000..4e297647b5
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/alpha/bits/shm.h
@@ -0,0 +1,113 @@
+/* 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
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+#ifndef _SYS_SHM_H
+# error "Never include <bits/shm.h> directly; use <sys/shm.h> instead."
+#endif
+
+#include <sys/types.h>
+
+/* Permission flag for shmget.  */
+#define SHM_R		0400		/* or S_IRUGO from <linux/stat.h> */
+#define SHM_W		0200		/* or S_IWUGO from <linux/stat.h> */
+
+/* Flags for `shmat'.  */
+#define SHM_RDONLY	010000		/* attach read-only else read-write */
+#define SHM_RND		020000		/* round attach address to SHMLBA */
+#define SHM_REMAP	040000		/* take-over region on attach */
+
+/* Commands for `shmctl'.  */
+#define SHM_LOCK	11		/* lock segment (root only) */
+#define SHM_UNLOCK	12		/* unlock segment (root only) */
+
+
+/* Data structure describing a set of semaphores.  */
+struct shmid_ds
+  {
+    struct ipc_perm shm_perm;		/* operation permission struct */
+    size_t shm_segsz;			/* size of segment in bytes */
+    __time_t shm_atime;			/* time of last shmat() */
+    __time_t shm_dtime;			/* time of last shmdt() */
+    __time_t shm_ctime;			/* time of last change by shmctl() */
+    pid_t shm_cpid;			/* pid of creator */
+    pid_t shm_lpid;			/* pid of last shmop */
+    unsigned long int shm_nattch;	/* number of current attaches */
+    unsigned long int __unused1;
+    unsigned long int __unused2;
+  };
+
+#ifdef __LIBC_IPC_INTERNAL
+struct __old_shmid_ds
+  {
+    struct __old_ipc_perm shm_perm;	/* operation permission struct */
+    int shm_segsz;			/* size of segment in bytes */
+    __time_t shm_atime;			/* time of last shmat() */
+    __time_t shm_dtime;			/* time of last shmdt() */
+    __time_t shm_ctime;			/* time of last change by shmctl() */
+    __ipc_pid_t shm_cpid;		/* pid of creator */
+    __ipc_pid_t shm_lpid;		/* pid of last shmop */
+    unsigned short int shm_nattch;	/* number of current attaches */
+    unsigned short int __shm_npages;	/* size of segment (pages) */
+    unsigned long int *__shm_pages;	/* array of ptrs to frames -> SHMMAX */
+    struct vm_area_struct *__attaches;	/* descriptors for attaches */
+  };
+#endif
+
+#ifdef __USE_MISC
+
+/* ipcs ctl commands */
+# define SHM_STAT 	13
+# define SHM_INFO 	14
+
+/* shm_mode upper byte flags */
+# define SHM_DEST	01000	/* segment will be destroyed on last detach */
+# define SHM_LOCKED	02000   /* segment will not be swapped */
+
+struct	shminfo
+  {
+    unsigned long int shmmax;
+    unsigned long int shmmin;
+    unsigned long int shmmni;
+    unsigned long int shmseg;
+    unsigned long int shmall;
+    unsigned long int __unused1;
+    unsigned long int __unused2;
+    unsigned long int __unused3;
+    unsigned long int __unused4;
+  };
+
+struct	__old_shminfo
+  {
+    int shmmax;
+    int shmmin;
+    int shmmni;
+    int shmseg;
+    int shmall;
+  };
+
+struct shm_info
+  {
+    int used_ids;
+    unsigned long int shm_tot;	/* total allocated shm */
+    unsigned long int shm_rss;	/* total resident shm */
+    unsigned long int shm_swp;	/* total swapped shm */
+    unsigned long int swap_attempts;
+    unsigned long int swap_successes;
+  };
+
+#endif /* __USE_MISC */
diff --git a/sysdeps/unix/sysv/linux/bits/ipc.h b/sysdeps/unix/sysv/linux/bits/ipc.h
new file mode 100644
index 0000000000..ef44edaf73
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/bits/ipc.h
@@ -0,0 +1,92 @@
+/* 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
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+#ifndef _SYS_IPC_H
+# error "Never use <bits/ipc.h> directly; include <sys/ipc.h> instead."
+#endif
+
+#include <bits/types.h>
+
+/* Mode bits for `msgget', `semget', and `shmget'.  */
+#define IPC_CREAT	01000		/* Create key if key does not exist. */
+#define IPC_EXCL	02000		/* Fail if key exists.  */
+#define IPC_NOWAIT	04000		/* Return error on wait.  */
+
+/* Control commands for `msgctl', `semctl', and `shmctl'.  */
+#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.  */
+
+/* Special key values.  */
+#define IPC_PRIVATE	((__key_t) 0)	/* Private key.  */
+
+#define __IPC_64	0x100
+
+
+/* Data structure used to pass permission information to IPC operations.  */
+struct ipc_perm
+  {
+    __key_t __key;			/* Key.  */
+    __uid_t uid;			/* Owner's user ID.  */
+    __gid_t gid;			/* Owner's group ID.  */
+    __uid_t cuid;			/* Creator's user ID.  */
+    __gid_t cgid;			/* Creator's group ID.  */
+    unsigned short int mode;		/* Read/write permission.  */
+    unsigned short int __pad1;
+    unsigned short int __seq;		/* Sequence number.  */
+    unsigned short int __pad2;
+    unsigned long int __unused1;
+    unsigned long int __unused2;
+  };
+
+#ifdef __LIBC_IPC_INTERNAL
+struct __old_ipc_perm
+  {
+    __key_t __key;			/* Key.  */
+    unsigned short int uid;		/* Owner's user ID.  */
+    unsigned short int gid;		/* Owner's group ID.  */
+    unsigned short int cuid;		/* Creator's user ID.  */
+    unsigned short int cgid;		/* Creator's group ID.  */
+    unsigned short int mode;		/* Read/write permission.  */
+    unsigned short int __seq;		/* Sequence number.  */
+  };
+
+__BEGIN_DECLS
+
+/* The actual system call: all functions are multiplexed by this.  */
+extern int __syscall_ipc (int __call, int __first, int __second,
+			  int __third, void *__ptr);
+
+__END_DECLS
+
+
+/* The codes for the functions to use the multiplexer `__syscall_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
+
+#endif /* __LIBC_IPC_INTERNAL */
diff --git a/sysdeps/unix/sysv/linux/bits/msq.h b/sysdeps/unix/sysv/linux/bits/msq.h
new file mode 100644
index 0000000000..54582af308
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/bits/msq.h
@@ -0,0 +1,90 @@
+/* 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
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+#ifndef _SYS_MSG_H
+# error "Never use <bits/msq.h> directly; include <sys/msg.h> instead."
+#endif
+
+#include <sys/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 */
+
+
+/* Structure of record for one message inside the kernel.
+   The type `struct msg' is opaque.  */
+struct msqid_ds
+{
+  struct ipc_perm msg_perm;	/* structure describing operation permission */
+  __time_t msg_stime;		/* time of last msgsnd command */
+  unsigned long int __unused1;
+  __time_t msg_rtime;		/* time of last msgrcv command */
+  unsigned long int __unused2;
+  __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 */
+  pid_t msg_lspid;		/* pid of last msgsnd() */
+  pid_t msg_lrpid;		/* pid of last msgrcv() */
+  unsigned long int __unused4;
+  unsigned long int __unused5;
+};
+
+#ifdef __LIBC_IPC_INTERNAL
+struct __old_msqid_ds
+{
+  struct __old_ipc_perm msg_perm;	/* structure describing operation permission */
+  struct msg *__msg_first;		/* pointer to first message on queue */
+  struct msg *__msg_last;		/* pointer to last message on queue */
+  __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 */
+  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 */
+  __ipc_pid_t msg_lspid;		/* pid of last msgsnd() */
+  __ipc_pid_t msg_lrpid;		/* pid of last msgrcv() */
+};
+#endif
+
+#ifdef __USE_MISC
+
+# define msg_cbytes	__msg_cbytes
+
+/* ipcs ctl commands */
+# define MSG_STAT 11
+# define MSG_INFO 12
+
+/* buffer for msgctl calls IPC_INFO, MSG_INFO */
+struct msginfo
+  {
+    int msgpool;
+    int msgmap;
+    int msgmax;
+    int msgmnb;
+    int msgmni;
+    int msgssz;
+    int msgtql;
+    unsigned short int msgseg;
+  };
+
+#endif /* __USE_MISC */
diff --git a/sysdeps/unix/sysv/linux/bits/sem.h b/sysdeps/unix/sysv/linux/bits/sem.h
new file mode 100644
index 0000000000..9ebdfb6887
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/bits/sem.h
@@ -0,0 +1,101 @@
+/* Copyright (C) 1995, 1996, 1997, 1998, 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
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+#ifndef _SYS_SEM_H
+# error "Never include <bits/sem.h> directly; use <sys/sem.h> instead."
+#endif
+
+#include <sys/types.h>
+
+/* Flags for `semop'.  */
+#define SEM_UNDO	0x1000		/* undo the operation on exit */
+
+/* Commands for `semctl'.  */
+#define GETPID		11		/* get sempid */
+#define GETVAL		12		/* get semval */
+#define GETALL		13		/* get all semval's */
+#define GETNCNT		14		/* get semncnt */
+#define GETZCNT		15		/* get semzcnt */
+#define SETVAL		16		/* set semval */
+#define SETALL		17		/* set all semval's */
+
+
+/* Data structure describing a set of semaphores.  */
+struct semid_ds
+{
+  struct ipc_perm sem_perm;		/* operation permission struct */
+  __time_t sem_otime;			/* last semop() time */
+  unsigned long int __unused1;
+  __time_t sem_ctime;			/* last time changed by semctl() */
+  unsigned long int __unused2;
+  unsigned long int sem_nsems;		/* number of semaphores in set */
+  unsigned long int __unused3;
+  unsigned long int __unused4;
+};
+
+#ifdef __LIBC_IPC_INTERNAL
+struct __old_semid_ds
+{
+  struct __old_ipc_perm sem_perm;	/* operation permission struct */
+  __time_t sem_otime;			/* last semop() time */
+  __time_t sem_ctime;			/* last time changed by semctl() */
+  struct sem *__sembase;		/* ptr to first semaphore in array */
+  struct sem_queue *__sem_pending;	/* pending operations */
+  struct sem_queue *__sem_pending_last; /* last pending operation */
+  struct sem_undo *__undo;		/* ondo requests on this array */
+  unsigned short int sem_nsems;		/* number of semaphores in set */
+};
+#endif
+
+/* The user should define a union like the following to use it for arguments
+   for `semctl'.
+
+   union semun
+   {
+     int val;				<= value for SETVAL
+     struct semid_ds *buf;		<= buffer for IPC_STAT & IPC_SET
+     unsigned short int *array;		<= array for GETALL & SETALL
+     struct seminfo *__buf;		<= buffer for IPC_INFO
+   };
+
+   Previous versions of this file used to define this union but this is
+   incorrect.  One can test the macro _SEM_SEMUN_UNDEFINED to see whether
+   one must define the union or not.  */
+#define _SEM_SEMUN_UNDEFINED	1
+
+#ifdef __USE_MISC
+
+/* ipcs ctl cmds */
+# define SEM_STAT 18
+# define SEM_INFO 19
+
+struct  seminfo
+{
+  int semmap;
+  int semmni;
+  int semmns;
+  int semmnu;
+  int semmsl;
+  int semopm;
+  int semume;
+  int semusz;
+  int semvmx;
+  int semaem;
+};
+
+#endif /* __USE_MISC */
diff --git a/sysdeps/unix/sysv/linux/bits/shm.h b/sysdeps/unix/sysv/linux/bits/shm.h
new file mode 100644
index 0000000000..786555b067
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/bits/shm.h
@@ -0,0 +1,116 @@
+/* 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
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+#ifndef _SYS_SHM_H
+# error "Never include <bits/shm.h> directly; use <sys/shm.h> instead."
+#endif
+
+#include <sys/types.h>
+
+/* Permission flag for shmget.  */
+#define SHM_R		0400		/* or S_IRUGO from <linux/stat.h> */
+#define SHM_W		0200		/* or S_IWUGO from <linux/stat.h> */
+
+/* Flags for `shmat'.  */
+#define SHM_RDONLY	010000		/* attach read-only else read-write */
+#define SHM_RND		020000		/* round attach address to SHMLBA */
+#define SHM_REMAP	040000		/* take-over region on attach */
+
+/* Commands for `shmctl'.  */
+#define SHM_LOCK	11		/* lock segment (root only) */
+#define SHM_UNLOCK	12		/* unlock segment (root only) */
+
+
+/* Data structure describing a set of semaphores.  */
+struct shmid_ds
+  {
+    struct ipc_perm shm_perm;		/* operation permission struct */
+    size_t shm_segsz;			/* size of segment in bytes */
+    __time_t shm_atime;			/* time of last shmat() */
+    unsigned long int __unused1;
+    __time_t shm_dtime;			/* time of last shmdt() */
+    unsigned long int __unused2;
+    __time_t shm_ctime;			/* time of last change by shmctl() */
+    unsigned long int __unused3;
+    pid_t shm_cpid;			/* pid of creator */
+    pid_t shm_lpid;			/* pid of last shmop */
+    unsigned long int shm_nattch;	/* number of current attaches */
+    unsigned long int __unused4;
+    unsigned long int __unused5;
+  };
+
+#ifdef __LIBC_IPC_INTERNAL
+struct __old_shmid_ds
+  {
+    struct __old_ipc_perm shm_perm;	/* operation permission struct */
+    int shm_segsz;			/* size of segment in bytes */
+    __time_t shm_atime;			/* time of last shmat() */
+    __time_t shm_dtime;			/* time of last shmdt() */
+    __time_t shm_ctime;			/* time of last change by shmctl() */
+    __ipc_pid_t shm_cpid;		/* pid of creator */
+    __ipc_pid_t shm_lpid;		/* pid of last shmop */
+    unsigned short int shm_nattch;	/* number of current attaches */
+    unsigned short int __shm_npages;	/* size of segment (pages) */
+    unsigned long int *__shm_pages;	/* array of ptrs to frames -> SHMMAX */
+    struct vm_area_struct *__attaches;	/* descriptors for attaches */
+  };
+#endif
+
+#ifdef __USE_MISC
+
+/* ipcs ctl commands */
+# define SHM_STAT 	13
+# define SHM_INFO 	14
+
+/* shm_mode upper byte flags */
+# define SHM_DEST	01000	/* segment will be destroyed on last detach */
+# define SHM_LOCKED	02000   /* segment will not be swapped */
+
+struct	shminfo
+  {
+    unsigned long int shmmax;
+    unsigned long int shmmin;
+    unsigned long int shmmni;
+    unsigned long int shmseg;
+    unsigned long int shmall;
+    unsigned long int __unused1;
+    unsigned long int __unused2;
+    unsigned long int __unused3;
+    unsigned long int __unused4;
+  };
+
+struct	__old_shminfo
+  {
+    int shmmax;
+    int shmmin;
+    int shmmni;
+    int shmseg;
+    int shmall;
+  };
+
+struct shm_info
+  {
+    int used_ids;
+    unsigned long int shm_tot;	/* total allocated shm */
+    unsigned long int shm_rss;	/* total resident shm */
+    unsigned long int shm_swp;	/* total swapped shm */
+    unsigned long int swap_attempts;
+    unsigned long int swap_successes;
+  };
+
+#endif /* __USE_MISC */
diff --git a/sysdeps/unix/sysv/linux/execve.c b/sysdeps/unix/sysv/linux/execve.c
index 9093dcf88c..8f89206ac3 100644
--- a/sysdeps/unix/sysv/linux/execve.c
+++ b/sysdeps/unix/sysv/linux/execve.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1999 Free Software Foundation, Inc.
+/* Copyright (C) 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,7 +22,8 @@
 #include <sysdep.h>
 #include <sys/syscall.h>
 
-extern int __syscall_execve (const char *file, char **argv, char **envp);
+extern int __syscall_execve (const char *file, char * const argv[],
+			     char * const envp[]);
 extern void __pthread_kill_other_threads_np __P ((void));
 weak_extern (__pthread_kill_other_threads_np)
 
diff --git a/sysdeps/unix/sysv/linux/i386/chown.c b/sysdeps/unix/sysv/linux/i386/chown.c
index 9addfd0598..8652d0f097 100644
--- a/sysdeps/unix/sysv/linux/i386/chown.c
+++ b/sysdeps/unix/sysv/linux/i386/chown.c
@@ -38,7 +38,7 @@
 */
 
 extern int __syscall_chown (const char *__file,
-			    uid_t __owner, gid_t __group);
+			    __kernel_uid_t __owner, __kernel_gid_t __group);
 #if defined __NR_lchown || __ASSUME_LCHOWN_SYSCALL > 0
 /* Running under Linux > 2.1.80.  */
 
@@ -76,6 +76,13 @@ __real_chown (const char *file, uid_t owner, gid_t group)
 	  __libc_missing_32bit_uids = 1;
 	}
 #  endif /* __NR_chown32 */
+      if (((owner + 1) > (uid_t) ((__kernel_uid_t) -1U))
+	  || ((group + 1) > (gid_t) ((__kernel_gid_t) -1U)))
+	{
+	  __set_errno (EINVAL);
+	  return -1;
+	}
+
       result = INLINE_SYSCALL (chown, 3, file, owner, group);
 
       if (result >= 0 || errno != ENOSYS)
@@ -105,6 +112,13 @@ __real_chown (const char *file, uid_t owner, gid_t group)
       __libc_missing_32bit_uids = 1;
     }
 #  endif /* __NR_chown32 */
+  if (((owner + 1) > (uid_t) ((__kernel_uid_t) -1U))
+      || ((group + 1) > (gid_t) ((__kernel_gid_t) -1U)))
+    {
+      __set_errno (EINVAL);
+      return -1;
+    }
+
   return INLINE_SYSCALL (chown, 3, file, owner, group);
 # endif
 }
diff --git a/sysdeps/unix/sysv/linux/i386/fchown.c b/sysdeps/unix/sysv/linux/i386/fchown.c
index 7d4c360dbd..5a84d4170e 100644
--- a/sysdeps/unix/sysv/linux/i386/fchown.c
+++ b/sysdeps/unix/sysv/linux/i386/fchown.c
@@ -59,8 +59,8 @@ __fchown (int fd, uid_t owner, gid_t group)
     }
 # endif /* __NR_fchown32 */
 
-  if ( (owner != (uid_t) ((__kernel_uid_t) owner)) ||
-       (group != (gid_t) ((__kernel_gid_t) group)) )
+  if (((owner + 1) > (uid_t) ((__kernel_uid_t) -1U))
+      || ((group + 1) > (gid_t) ((__kernel_gid_t) -1U)))
     {
       __set_errno (EINVAL);
       return -1;
diff --git a/sysdeps/unix/sysv/linux/i386/lchown.c b/sysdeps/unix/sysv/linux/i386/lchown.c
index 86ff7d518d..2d8e8fb998 100644
--- a/sysdeps/unix/sysv/linux/i386/lchown.c
+++ b/sysdeps/unix/sysv/linux/i386/lchown.c
@@ -60,8 +60,8 @@ __lchown (const char *file, uid_t owner, gid_t group)
     }
 #  endif /* __NR_lchown32 */
 
-  if ( (owner != (uid_t) ((__kernel_uid_t) owner)) ||
-       (group != (gid_t) ((__kernel_gid_t) group)) )
+  if (((owner + 1) > (uid_t) ((__kernel_uid_t) -1U))
+      || ((group + 1) > (gid_t) ((__kernel_gid_t) -1U)))
     {
       __set_errno (EINVAL);
       return -1;
@@ -76,4 +76,3 @@ weak_alias (__lchown, lchown)
 #else
 # include <sysdeps/generic/lchown.c>
 #endif
-
diff --git a/sysdeps/unix/sysv/linux/i386/setregid.c b/sysdeps/unix/sysv/linux/i386/setregid.c
index 4f00d30bc6..b4d0a2a116 100644
--- a/sysdeps/unix/sysv/linux/i386/setregid.c
+++ b/sysdeps/unix/sysv/linux/i386/setregid.c
@@ -59,8 +59,8 @@ __setregid (gid_t rgid, gid_t egid)
       __libc_missing_32bit_uids = 1;
     }
 # endif /* __NR_setregid32 */
-  if ((rgid != (gid_t) -1 && rgid != (gid_t) (__kernel_gid_t) rgid)
-      || (egid != (gid_t) -1 && egid != (gid_t) (__kernel_gid_t) egid))
+  if (((rgid + 1) > (gid_t) ((__kernel_gid_t) -1U))
+      || ((egid + 1) > (gid_t) ((__kernel_gid_t) -1U)))
     {
       __set_errno (EINVAL);
       return -1;
diff --git a/sysdeps/unix/sysv/linux/i386/setresgid.c b/sysdeps/unix/sysv/linux/i386/setresgid.c
index 45dbcc8485..97bb97469c 100644
--- a/sysdeps/unix/sysv/linux/i386/setresgid.c
+++ b/sysdeps/unix/sysv/linux/i386/setresgid.c
@@ -62,9 +62,9 @@ setresgid (gid_t rgid, gid_t egid, gid_t sgid)
     }
 #  endif /* __NR_setresgid32 */
 
-  if ((rgid != (gid_t) -1 && rgid != (gid_t) (__kernel_gid_t) rgid)
-      || (egid != (gid_t) -1 && egid != (gid_t) (__kernel_gid_t) egid)
-      || (sgid != (gid_t) -1 && sgid != (gid_t) (__kernel_gid_t) sgid))
+  if (((rgid + 1) > (gid_t) ((__kernel_gid_t) -1U))
+      || ((egid + 1) > (gid_t) ((__kernel_gid_t) -1U))
+      || ((sgid + 1) > (gid_t) ((__kernel_gid_t) -1U)))
     {
       __set_errno (EINVAL);
       return -1;
diff --git a/sysdeps/unix/sysv/linux/i386/setresuid.c b/sysdeps/unix/sysv/linux/i386/setresuid.c
index 90214526ab..94fc79ba5c 100644
--- a/sysdeps/unix/sysv/linux/i386/setresuid.c
+++ b/sysdeps/unix/sysv/linux/i386/setresuid.c
@@ -44,7 +44,7 @@ extern int __libc_missing_32bit_uids;
 int
 __setresuid (uid_t ruid, uid_t euid, uid_t suid)
 {
-# if __ASSUME_32BITUIDS > 0  
+# if __ASSUME_32BITUIDS > 0
   return INLINE_SYSCALL (setresuid32, 3, ruid, euid, suid);
 # else
 #  ifdef __NR_setresuid32
@@ -62,9 +62,9 @@ __setresuid (uid_t ruid, uid_t euid, uid_t suid)
     }
 #  endif /* __NR_setresuid32 */
 
-  if ((ruid != (uid_t) -1 && ruid != (uid_t) (__kernel_uid_t) ruid)
-      || (euid != (uid_t) -1 && euid != (uid_t) (__kernel_uid_t) euid)
-      || (suid != (uid_t) -1 && suid != (uid_t) (__kernel_uid_t) suid))
+  if (((ruid + 1) > (uid_t) ((__kernel_uid_t) -1U))
+      || ((euid + 1) > (uid_t) ((__kernel_uid_t) -1U))
+      || ((suid + 1) > (uid_t) ((__kernel_uid_t) -1U)))
     {
       __set_errno (EINVAL);
       return -1;
diff --git a/sysdeps/unix/sysv/linux/i386/setreuid.c b/sysdeps/unix/sysv/linux/i386/setreuid.c
index 58ddff2b00..b660604152 100644
--- a/sysdeps/unix/sysv/linux/i386/setreuid.c
+++ b/sysdeps/unix/sysv/linux/i386/setreuid.c
@@ -59,8 +59,8 @@ __setreuid (uid_t ruid, uid_t euid)
       __libc_missing_32bit_uids = 1;
     }
 # endif /* __NR_setreuid32 */
-  if ((ruid != (uid_t) -1 && ruid != (uid_t) (__kernel_uid_t) ruid)
-      || (euid != (uid_t) -1 && euid != (uid_t) (__kernel_uid_t) euid))
+  if (((ruid + 1) > (uid_t) ((__kernel_uid_t) -1U))
+      || ((euid + 1) > (uid_t) ((__kernel_uid_t) -1U)))
     {
       __set_errno (EINVAL);
       return -1;
diff --git a/sysdeps/unix/sysv/linux/kernel-features.h b/sysdeps/unix/sysv/linux/kernel-features.h
index f7bdf4808b..626b116242 100644
--- a/sysdeps/unix/sysv/linux/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/kernel-features.h
@@ -66,7 +66,7 @@
 #endif
 
 /* When did the `setresuid' sysall became available?  */
-#if __LINUX_KERNEL_VERSION >= 131584
+#if __LINUX_KERNEL_VERSION >= 131584 && !defined __sparc__
 # define __ASSUME_SETRESUID_SYSCALL	1
 #endif
 
@@ -106,4 +106,7 @@
 /* Linux 2.3.39 introduced 32bit UID/GIDs.  */
 #if __LINUX_KERNEL_VERSION >= 131879
 # define __ASSUME_32BITUIDS		1
+# ifdef __sparc__
+#  define __ASSUME_SETRESUID_SYSCALL	1
+# endif
 #endif
diff --git a/sysdeps/unix/sysv/linux/m68k/chown.c b/sysdeps/unix/sysv/linux/m68k/chown.c
index c27da95944..4e7625c13e 100644
--- a/sysdeps/unix/sysv/linux/m68k/chown.c
+++ b/sysdeps/unix/sysv/linux/m68k/chown.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1998 Free Software Foundation, Inc.
+/* Copyright (C) 1998, 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
@@ -24,21 +24,28 @@
 
 #include <linux/posix_types.h>
 
-#include <sysdeps/unix/sysv/linux/32bit_uid_compat.h>
-
 extern int __syscall_chown (const char *__file,
-			    uid_t __owner, gid_t __group);
+			    __kernel_uid_t __owner, __kernel_gid_t __group);
 
 #ifdef __NR_chown32
 extern int __syscall_chown32 (const char *__file,
 			      __kernel_uid32_t owner, __kernel_gid32_t group);
+
+# if __ASSUME_32BITUIDS == 0
+/* This variable is shared with all files that need to check for 32bit
+   uids.  */
+extern int __libc_missing_32bit_uids;
+# endif
 #endif /* __NR_chown32 */
 
 int
 __chown (const char *file, uid_t owner, gid_t group)
 {
-#ifdef __NR_chown32
-  if (__libc_missing_32bit_uids != NO_HIGHUIDS)
+#if __ASSUME_32BITUIDS
+  return INLINE_SYSCALL (chown32, 3, file, owner, group);
+#else
+# ifdef __NR_chown32
+  if (!__libc_missing_32bit_uids)
     {
       int result;
       int saved_errno = errno;
@@ -48,10 +55,18 @@ __chown (const char *file, uid_t owner, gid_t group)
 	return result;
 
       __set_errno (saved_errno);
-      __libc_missing_32bit_uids = NO_HIGHUIDS;
+      __libc_missing_32bit_uids = 1;
+    }
+# endif /* __NR_chown32 */
+
+  if (((owner + 1) > (gid_t) ((__kernel_uid_t) -1U))
+      || ((group + 1) > (gid_t) ((__kernel_gid_t) -1U)))
+    {
+      __set_errno (EINVAL);
+      return -1;
     }
-#endif /* __NR_chown32 */
 
   return INLINE_SYSCALL (chown, 3, file, owner, group);
+#endif
 }
 weak_alias (__chown, chown)
diff --git a/sysdeps/unix/sysv/linux/msgctl.c b/sysdeps/unix/sysv/linux/msgctl.c
index 7f0d7c55a4..ef3c92235c 100644
--- a/sysdeps/unix/sysv/linux/msgctl.c
+++ b/sysdeps/unix/sysv/linux/msgctl.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1995, 1997, 1998 Free Software Foundation, Inc.
+/* Copyright (C) 1995, 1997, 1998, 2000 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, August 1995.
 
@@ -17,20 +17,95 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
+#define __LIBC_IPC_INTERNAL
 #include <errno.h>
 #include <sys/msg.h>
 
 #include <sysdep.h>
+#include <string.h>
 #include <sys/syscall.h>
 
+#include "kernel-features.h"
+
 /* Allows to control internal state and destruction of message queue
    objects.  */
+int __old_msgctl (int, int, struct __old_msqid_ds *);
+int __new_msgctl (int, int, struct msqid_ds *);
 
 int
-msgctl (msqid, cmd, buf)
-     int msqid;
-     int cmd;
-     struct msqid_ds *buf;
+__old_msgctl (int msqid, int cmd, struct __old_msqid_ds *buf)
 {
   return INLINE_SYSCALL (ipc, 5, IPCOP_msgctl, msqid, cmd, 0, buf);
 }
+
+int
+__new_msgctl (int msqid, int cmd, struct msqid_ds *buf)
+{
+#if __ASSUME_32BITUIDS > 0
+  return INLINE_SYSCALL (ipc, 5, IPCOP_msgctl, msqid, cmd | __IPC_64, 0, buf);
+#else
+  switch (cmd) {
+    case MSG_STAT:
+    case IPC_STAT:
+    case IPC_SET:
+      break;
+    default:
+      return INLINE_SYSCALL (ipc, 5, IPCOP_msgctl, msqid, cmd, 0, buf);
+  }
+
+  {
+    int save_errno = errno, result;
+    struct __old_msqid_ds old;
+
+    /* Unfortunately there is no way how to find out for sure whether
+       we should use old or new msgctl.  */
+    result = INLINE_SYSCALL (ipc, 5, IPCOP_msgctl, msqid, cmd | __IPC_64, 0, buf);
+    if (result != -1 || errno != EINVAL)
+      return result;
+
+    __set_errno(save_errno);
+    if (cmd == IPC_SET)
+      {
+	old.msg_perm.uid = buf->msg_perm.uid;
+	old.msg_perm.gid = buf->msg_perm.gid;
+	old.msg_perm.mode = buf->msg_perm.mode;
+	old.msg_qbytes = buf->msg_qbytes;
+	if (old.msg_perm.uid != buf->msg_perm.uid ||
+	    old.msg_perm.gid != buf->msg_perm.gid ||
+	    old.msg_qbytes != buf->msg_qbytes)
+	  {
+	    __set_errno (EINVAL);
+	    return -1;
+	  }
+      }
+    result = INLINE_SYSCALL (ipc, 5, IPCOP_msgctl, msqid, cmd, 0, &old);
+    if (result != -1 && cmd != IPC_SET)
+      {
+	memset(buf, 0, sizeof(*buf));
+	buf->msg_perm.__key = old.msg_perm.__key;
+	buf->msg_perm.uid = old.msg_perm.uid;
+	buf->msg_perm.gid = old.msg_perm.gid;
+	buf->msg_perm.cuid = old.msg_perm.cuid;
+	buf->msg_perm.cgid = old.msg_perm.cgid;
+	buf->msg_perm.mode = old.msg_perm.mode;
+	buf->msg_perm.__seq = old.msg_perm.__seq;
+	buf->msg_stime = old.msg_stime;
+	buf->msg_rtime = old.msg_rtime;
+	buf->msg_ctime = old.msg_ctime;
+	buf->__msg_cbytes = old.__msg_cbytes;
+	buf->msg_qnum = old.msg_qnum;
+	buf->msg_qbytes = old.msg_qbytes;
+	buf->msg_lspid = old.msg_lspid;
+	buf->msg_lrpid = old.msg_lrpid;
+      }
+    return result;
+  }
+#endif
+}
+
+#if defined PIC && DO_VERSIONING
+default_symbol_version (__new_msgctl, msgctl, GLIBC_2.2);
+symbol_version (__old_msgctl, msgctl, GLIBC_2.0);
+#else
+weak_alias (__new_msgctl, msgctl);
+#endif
diff --git a/sysdeps/unix/sysv/linux/msgget.c b/sysdeps/unix/sysv/linux/msgget.c
index f9788d6e54..949f0c031a 100644
--- a/sysdeps/unix/sysv/linux/msgget.c
+++ b/sysdeps/unix/sysv/linux/msgget.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1995, 1997, 1998 Free Software Foundation, Inc.
+/* Copyright (C) 1995, 1997, 1998, 2000 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, August 1995.
 
@@ -17,6 +17,7 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
+#define __LIBC_IPC_INTERNAL
 #include <errno.h>
 #include <sys/msg.h>
 #include <stdlib.h>		/* for definition of NULL */
diff --git a/sysdeps/unix/sysv/linux/msgrcv.c b/sysdeps/unix/sysv/linux/msgrcv.c
index 30169fb3a6..232d8463e5 100644
--- a/sysdeps/unix/sysv/linux/msgrcv.c
+++ b/sysdeps/unix/sysv/linux/msgrcv.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1995, 1997, 1998 Free Software Foundation, Inc.
+/* Copyright (C) 1995, 1997, 1998, 2000 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, August 1995.
 
@@ -17,6 +17,7 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
+#define __LIBC_IPC_INTERNAL
 #include <errno.h>
 #include <sys/msg.h>
 
diff --git a/sysdeps/unix/sysv/linux/msgsnd.c b/sysdeps/unix/sysv/linux/msgsnd.c
index af6df3d4a7..9fdb00960b 100644
--- a/sysdeps/unix/sysv/linux/msgsnd.c
+++ b/sysdeps/unix/sysv/linux/msgsnd.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1995, 1997, 1998, 1999 Free Software Foundation, Inc.
+/* Copyright (C) 1995, 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, August 1995.
 
@@ -17,6 +17,7 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
+#define __LIBC_IPC_INTERNAL
 #include <errno.h>
 #include <sys/msg.h>
 
@@ -30,5 +31,5 @@ msgsnd (msqid, msgp, msgsz, msgflg)
      size_t msgsz;
      int msgflg;
 {
-  return INLINE_SYSCALL (ipc, 5, IPCOP_msgsnd, msqid, msgsz, msgflg, msgp);
+  return INLINE_SYSCALL (ipc, 5, IPCOP_msgsnd, msqid, msgsz, msgflg, (void *)msgp);
 }
diff --git a/sysdeps/unix/sysv/linux/pwrite64.c b/sysdeps/unix/sysv/linux/pwrite64.c
index 236cbd7d49..c1888962d2 100644
--- a/sysdeps/unix/sysv/linux/pwrite64.c
+++ b/sysdeps/unix/sysv/linux/pwrite64.c
@@ -27,8 +27,8 @@
 
 #if defined __NR_pwrite || __ASSUME_PWRITE_SYSCALL > 0
 
-extern ssize_t __syscall_pwrite64 (int fd, const void *buf, size_t count,
-				   off_t offset_hi, off_t offset_lo);
+extern ssize_t __syscall_pwrite (int fd, const void *buf, size_t count,
+				 off_t offset_hi, off_t offset_lo);
 
 # if __ASSUME_PWRITE_SYSCALL == 0
 static ssize_t __emulate_pwrite64 (int fd, const void *buf, size_t count,
diff --git a/sysdeps/unix/sysv/linux/semctl.c b/sysdeps/unix/sysv/linux/semctl.c
index 7a29d7c109..40417b4f1d 100644
--- a/sysdeps/unix/sysv/linux/semctl.c
+++ b/sysdeps/unix/sysv/linux/semctl.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1995, 1997, 1998 Free Software Foundation, Inc.
+/* Copyright (C) 1995, 1997, 1998, 2000 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, August 1995.
 
@@ -17,13 +17,17 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
+#define __LIBC_IPC_INTERNAL
 #include <errno.h>
 #include <stdarg.h>
 #include <sys/sem.h>
 
 #include <sysdep.h>
+#include <string.h>
 #include <sys/syscall.h>
 
+#include "kernel-features.h"
+
 /* Define a `union semun' suitable for Linux here.  */
 union semun
 {
@@ -36,9 +40,11 @@ union semun
 
 /* Return identifier for array of NSEMS semaphores associated with
    KEY.  */
+int __old_semctl (int semid, int semnum, int cmd, ...);
+int __new_semctl (int semid, int semnum, int cmd, ...);
 
 int
-semctl (int semid, int semnum, int cmd, ...)
+__old_semctl (int semid, int semnum, int cmd, ...)
 {
   union semun arg;
   va_list ap;
@@ -52,3 +58,81 @@ semctl (int semid, int semnum, int cmd, ...)
 
   return INLINE_SYSCALL (ipc, 5, IPCOP_semctl, semid, semnum, cmd, &arg);
 }
+
+int
+__new_semctl (int semid, int semnum, int cmd, ...)
+{
+  union semun arg;
+  va_list ap;
+
+  va_start (ap, cmd);
+
+  /* Get the argument.  */
+  arg = va_arg (ap, union semun);
+
+  va_end (ap);
+
+#if __ASSUME_32BITUIDS > 0
+  return INLINE_SYSCALL (ipc, 5, IPCOP_semctl, semid, semnum, cmd | __IPC_64, &arg);
+#else
+  switch (cmd) {
+    case SEM_STAT:
+    case IPC_STAT:
+    case IPC_SET:
+      break;
+    default:
+      return INLINE_SYSCALL (ipc, 5, IPCOP_semctl, semid, semnum, cmd, &arg);
+  }
+
+  {
+    int save_errno = errno, result;
+    struct __old_semid_ds old;
+    struct semid_ds *buf;
+
+    /* Unfortunately there is no way how to find out for sure whether
+       we should use old or new semctl.  */
+    result = INLINE_SYSCALL (ipc, 5, IPCOP_semctl, semid, semnum, cmd | __IPC_64, &arg);
+    if (result != -1 || errno != EINVAL)
+      return result;
+
+    __set_errno(save_errno);
+    buf = arg.buf;
+    arg.buf = (struct semid_ds *)&old;
+    if (cmd == IPC_SET)
+      {
+	old.sem_perm.uid = buf->sem_perm.uid;
+	old.sem_perm.gid = buf->sem_perm.gid;
+	old.sem_perm.mode = buf->sem_perm.mode;
+	if (old.sem_perm.uid != buf->sem_perm.uid ||
+	    old.sem_perm.gid != buf->sem_perm.gid)
+	  {
+	    __set_errno (EINVAL);
+	    return -1;
+	  }
+      }
+    result = INLINE_SYSCALL (ipc, 5, IPCOP_semctl, semid, semnum, cmd, &arg);
+    if (result != -1 && cmd != IPC_SET)
+      {
+	memset(buf, 0, sizeof(*buf));
+	buf->sem_perm.__key = old.sem_perm.__key;
+	buf->sem_perm.uid = old.sem_perm.uid;
+	buf->sem_perm.gid = old.sem_perm.gid;
+	buf->sem_perm.cuid = old.sem_perm.cuid;
+	buf->sem_perm.cgid = old.sem_perm.cgid;
+	buf->sem_perm.mode = old.sem_perm.mode;
+	buf->sem_perm.__seq = old.sem_perm.__seq;
+	buf->sem_otime = old.sem_otime;
+	buf->sem_ctime = old.sem_ctime;
+	buf->sem_nsems = old.sem_nsems;
+      }
+    return result;
+  }
+#endif
+}
+
+#if defined PIC && DO_VERSIONING
+default_symbol_version (__new_semctl, semctl, GLIBC_2.2);
+symbol_version (__old_semctl, semctl, GLIBC_2.0);
+#else
+weak_alias (__new_semctl, semctl);
+#endif
diff --git a/sysdeps/unix/sysv/linux/semget.c b/sysdeps/unix/sysv/linux/semget.c
index 60a150a9fd..bfb102337e 100644
--- a/sysdeps/unix/sysv/linux/semget.c
+++ b/sysdeps/unix/sysv/linux/semget.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1995, 1997, 1998 Free Software Foundation, Inc.
+/* Copyright (C) 1995, 1997, 1998, 2000 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, August 1995.
 
@@ -17,6 +17,7 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
+#define __LIBC_IPC_INTERNAL
 #include <errno.h>
 #include <sys/sem.h>
 #include <stdlib.h>		/* for definition of NULL */
diff --git a/sysdeps/unix/sysv/linux/semop.c b/sysdeps/unix/sysv/linux/semop.c
index 33fd289cc4..8b0d3573a0 100644
--- a/sysdeps/unix/sysv/linux/semop.c
+++ b/sysdeps/unix/sysv/linux/semop.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1995, 1997, 1998, 1999 Free Software Foundation, Inc.
+/* Copyright (C) 1995, 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, August 1995.
 
@@ -17,6 +17,7 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
+#define __LIBC_IPC_INTERNAL
 #include <errno.h>
 #include <sys/sem.h>
 
diff --git a/sysdeps/unix/sysv/linux/shmat.c b/sysdeps/unix/sysv/linux/shmat.c
index 6e25d452a3..8dccb35b6b 100644
--- a/sysdeps/unix/sysv/linux/shmat.c
+++ b/sysdeps/unix/sysv/linux/shmat.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1995, 1997, 1998, 1999 Free Software Foundation, Inc.
+/* Copyright (C) 1995, 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, August 1995.
 
@@ -17,6 +17,7 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
+#define __LIBC_IPC_INTERNAL
 #include <errno.h>
 #include <sys/shm.h>
 
diff --git a/sysdeps/unix/sysv/linux/shmctl.c b/sysdeps/unix/sysv/linux/shmctl.c
index 890e700a30..d9722ccc84 100644
--- a/sysdeps/unix/sysv/linux/shmctl.c
+++ b/sysdeps/unix/sysv/linux/shmctl.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1995, 1997, 1998 Free Software Foundation, Inc.
+/* Copyright (C) 1995, 1997, 1998, 2000 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, August 1995.
 
@@ -17,19 +17,109 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
+#define __LIBC_IPC_INTERNAL
 #include <errno.h>
 #include <sys/shm.h>
 
 #include <sysdep.h>
+#include <string.h>
 #include <sys/syscall.h>
+#include <bits/wordsize.h>
+
+#include "kernel-features.h"
 
 /* Provide operations to control over shared memory segments.  */
+int __old_shmctl (int, int, struct __old_shmid_ds *);
+int __new_shmctl (int, int, struct shmid_ds *);
 
 int
-shmctl (shmid, cmd, buf)
-     int shmid;
-     int cmd;
-     struct shmid_ds *buf;
+__old_shmctl (int shmid, int cmd, struct __old_shmid_ds *buf)
 {
   return INLINE_SYSCALL (ipc, 5, IPCOP_shmctl, shmid, cmd, 0, buf);
 }
+
+int
+__new_shmctl (int shmid, int cmd, struct shmid_ds *buf)
+{
+#if __ASSUME_32BITUIDS > 0
+  return INLINE_SYSCALL (ipc, 5, IPCOP_shmctl, shmid, cmd | __IPC_64, 0, buf);
+#else
+  switch (cmd) {
+    case SHM_STAT:
+    case IPC_STAT:
+    case IPC_SET:
+#if __WORDSIZE != 32
+    case IPC_INFO:
+#endif
+      break;
+    default:
+      return INLINE_SYSCALL (ipc, 5, IPCOP_shmctl, shmid, cmd, 0, buf);
+  }
+
+  {
+    int save_errno = errno, result;
+    struct __old_shmid_ds old;
+
+    /* Unfortunately there is no way how to find out for sure whether
+       we should use old or new shmctl.  */
+    result = INLINE_SYSCALL (ipc, 5, IPCOP_shmctl, shmid, cmd | __IPC_64, 0, buf);
+    if (result != -1 || errno != EINVAL)
+      return result;
+
+    __set_errno(save_errno);
+    if (cmd == IPC_SET)
+      {
+	old.shm_perm.uid = buf->shm_perm.uid;
+	old.shm_perm.gid = buf->shm_perm.gid;
+	old.shm_perm.mode = buf->shm_perm.mode;
+	if (old.shm_perm.uid != buf->shm_perm.uid ||
+	    old.shm_perm.gid != buf->shm_perm.gid)
+	  {
+	    __set_errno (EINVAL);
+	    return -1;
+	  }
+      }
+    result = INLINE_SYSCALL (ipc, 5, IPCOP_shmctl, shmid, cmd, 0, &old);
+    if (result != -1 && (cmd == SHM_STAT || cmd == IPC_STAT))
+      {
+	memset(buf, 0, sizeof(*buf));
+	buf->shm_perm.__key = old.shm_perm.__key;
+	buf->shm_perm.uid = old.shm_perm.uid;
+	buf->shm_perm.gid = old.shm_perm.gid;
+	buf->shm_perm.cuid = old.shm_perm.cuid;
+	buf->shm_perm.cgid = old.shm_perm.cgid;
+	buf->shm_perm.mode = old.shm_perm.mode;
+	buf->shm_perm.__seq = old.shm_perm.__seq;
+	buf->shm_atime = old.shm_atime;
+	buf->shm_dtime = old.shm_dtime;
+	buf->shm_ctime = old.shm_ctime;
+	buf->shm_segsz = old.shm_segsz;
+	buf->shm_nattch = old.shm_nattch;
+	buf->shm_cpid = old.shm_cpid;
+	buf->shm_lpid = old.shm_lpid;
+      }
+#if __WORDSIZE != 32
+    else if (result != -1 && cmd == IPC_INFO)
+      {
+	struct __old_shminfo *oldi = (struct __old_shminfo *)&old;
+	struct shminfo *i = (struct shminfo *)buf;
+
+	memset(i, 0, sizeof(*i));
+	i->shmmax = oldi->shmmax;
+	i->shmmin = oldi->shmmin;
+	i->shmmni = oldi->shmmni;
+	i->shmseg = oldi->shmseg;
+	i->shmall = oldi->shmall;
+      }
+#endif
+    return result;
+  }
+#endif
+}
+
+#if defined PIC && DO_VERSIONING
+default_symbol_version (__new_shmctl, shmctl, GLIBC_2.2);
+symbol_version (__old_shmctl, shmctl, GLIBC_2.0);
+#else
+weak_alias (__new_shmctl, shmctl);
+#endif
diff --git a/sysdeps/unix/sysv/linux/shmdt.c b/sysdeps/unix/sysv/linux/shmdt.c
index 1d1a1847d1..9cd6b11fcb 100644
--- a/sysdeps/unix/sysv/linux/shmdt.c
+++ b/sysdeps/unix/sysv/linux/shmdt.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1995, 1997, 1998 Free Software Foundation, Inc.
+/* Copyright (C) 1995, 1997, 1998, 2000 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, August 1995.
 
@@ -17,6 +17,7 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
+#define __LIBC_IPC_INTERNAL
 #include <errno.h>
 #include <sys/shm.h>
 
diff --git a/sysdeps/unix/sysv/linux/shmget.c b/sysdeps/unix/sysv/linux/shmget.c
index d9f5ba036b..416dc9a44e 100644
--- a/sysdeps/unix/sysv/linux/shmget.c
+++ b/sysdeps/unix/sysv/linux/shmget.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1995, 1997, 1998, 1999 Free Software Foundation, Inc.
+/* Copyright (C) 1995, 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, August 1995.
 
@@ -17,6 +17,7 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
+#define __LIBC_IPC_INTERNAL
 #include <errno.h>
 #include <sys/shm.h>
 #include <stdlib.h>		/* for definition of NULL */
diff --git a/sysdeps/unix/sysv/linux/sparc/bits/ipc.h b/sysdeps/unix/sysv/linux/sparc/bits/ipc.h
new file mode 100644
index 0000000000..1a479248a5
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/sparc/bits/ipc.h
@@ -0,0 +1,98 @@
+/* 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
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+#ifndef _SYS_IPC_H
+# error "Never use <bits/ipc.h> directly; include <sys/ipc.h> instead."
+#endif
+
+#include <bits/types.h>
+#include <bits/wordsize.h>
+
+/* Mode bits for `msgget', `semget', and `shmget'.  */
+#define IPC_CREAT	01000		/* Create key if key does not exist. */
+#define IPC_EXCL	02000		/* Fail if key exists.  */
+#define IPC_NOWAIT	04000		/* Return error on wait.  */
+
+/* Control commands for `msgctl', `semctl', and `shmctl'.  */
+#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.  */
+
+/* Special key values.  */
+#define IPC_PRIVATE	((__key_t) 0)	/* Private key.  */
+
+#define __IPC_64	0x100
+
+
+/* Data structure used to pass permission information to IPC operations.  */
+struct ipc_perm
+  {
+    __key_t __key;			/* Key.  */
+    __uid_t uid;			/* Owner's user ID.  */
+    __gid_t gid;			/* Owner's group ID.  */
+    __uid_t cuid;			/* Creator's user ID.  */
+    __gid_t cgid;			/* Creator's group ID.  */
+#if __WORDSIZE == 32
+    unsigned short int __pad1;
+    unsigned short int mode;		/* Read/write permission.  */
+    unsigned short int __pad2;
+#else
+    unsigned int mode;			/* Read/write permission.  */
+    unsigned short int __pad1;
+#endif
+    unsigned short int __seq;		/* Sequence number.  */
+    unsigned long long int __unused1;
+    unsigned long long int __unused2;
+  };
+
+#ifdef __LIBC_IPC_INTERNAL
+struct __old_ipc_perm
+  {
+    __key_t __key;			/* Key.  */
+    unsigned short int uid;		/* Owner's user ID.  */
+    unsigned short int gid;		/* Owner's group ID.  */
+    unsigned short int cuid;		/* Creator's user ID.  */
+    unsigned short int cgid;		/* Creator's group ID.  */
+    unsigned short int mode;		/* Read/write permission.  */
+    unsigned short int __seq;		/* Sequence number.  */
+  };
+
+__BEGIN_DECLS
+
+/* The actual system call: all functions are multiplexed by this.  */
+extern int __syscall_ipc (int __call, int __first, int __second,
+			  int __third, void *__ptr);
+
+__END_DECLS
+
+
+/* The codes for the functions to use the multiplexer `__syscall_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
+
+#endif /* __LIBC_IPC_INTERNAL */
diff --git a/sysdeps/unix/sysv/linux/sparc/bits/msq.h b/sysdeps/unix/sysv/linux/sparc/bits/msq.h
new file mode 100644
index 0000000000..c5095083c8
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/sparc/bits/msq.h
@@ -0,0 +1,99 @@
+/* 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
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+#ifndef _SYS_MSG_H
+# error "Never use <bits/msq.h> directly; include <sys/msg.h> instead."
+#endif
+
+#include <sys/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 */
+
+
+/* Structure of record for one message inside the kernel.
+   The type `struct msg' is opaque.  */
+struct msqid_ds
+{
+  struct ipc_perm msg_perm;	/* structure describing operation permission */
+#if __WORDSIZE == 32
+  unsigned int __pad1;
+#endif
+  __time_t msg_stime;		/* time of last msgsnd command */
+#if __WORDSIZE == 32
+  unsigned int __pad2;
+#endif
+  __time_t msg_rtime;		/* time of last msgrcv command */
+#if __WORDSIZE == 32
+  unsigned int __pad3;
+#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 */
+  pid_t msg_lspid;		/* pid of last msgsnd() */
+  pid_t msg_lrpid;		/* pid of last msgrcv() */
+  unsigned long int __unused1;
+  unsigned long int __unused2;
+};
+
+#ifdef __LIBC_IPC_INTERNAL
+
+struct __old_msqid_ds
+{
+  struct __old_ipc_perm msg_perm;	/* structure describing operation permission */
+  struct msg *__msg_first;		/* pointer to first message on queue */
+  struct msg *__msg_last;		/* pointer to last message on queue */
+  __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 */
+  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 */
+  __ipc_pid_t msg_lspid;		/* pid of last msgsnd() */
+  __ipc_pid_t msg_lrpid;		/* pid of last msgrcv() */
+};
+
+#endif
+
+#ifdef __USE_MISC
+
+# define msg_cbytes	__msg_cbytes
+
+/* ipcs ctl commands */
+# define MSG_STAT 11
+# define MSG_INFO 12
+
+/* buffer for msgctl calls IPC_INFO, MSG_INFO */
+struct msginfo
+  {
+    int msgpool;
+    int msgmap;
+    int msgmax;
+    int msgmnb;
+    int msgmni;
+    int msgssz;
+    int msgtql;
+    unsigned short int msgseg;
+  };
+
+#endif /* __USE_MISC */
diff --git a/sysdeps/unix/sysv/linux/sparc/bits/sem.h b/sysdeps/unix/sysv/linux/sparc/bits/sem.h
new file mode 100644
index 0000000000..92906bc81b
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/sparc/bits/sem.h
@@ -0,0 +1,106 @@
+/* Copyright (C) 1995, 1996, 1997, 1998, 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
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+#ifndef _SYS_SEM_H
+# error "Never include <bits/sem.h> directly; use <sys/sem.h> instead."
+#endif
+
+#include <sys/types.h>
+#include <bits/wordsize.h>
+
+/* Flags for `semop'.  */
+#define SEM_UNDO	0x1000		/* undo the operation on exit */
+
+/* Commands for `semctl'.  */
+#define GETPID		11		/* get sempid */
+#define GETVAL		12		/* get semval */
+#define GETALL		13		/* get all semval's */
+#define GETNCNT		14		/* get semncnt */
+#define GETZCNT		15		/* get semzcnt */
+#define SETVAL		16		/* set semval */
+#define SETALL		17		/* set all semval's */
+
+
+/* Data structure describing a set of semaphores.  */
+struct semid_ds
+{
+  struct ipc_perm sem_perm;		/* operation permission struct */
+#if __WORDSIZE == 32
+  unsigned int __pad1;
+#endif
+  __time_t sem_otime;			/* last semop() time */
+#if __WORDSIZE == 32
+  unsigned int __pad2;
+#endif
+  __time_t sem_ctime;			/* last time changed by semctl() */
+  unsigned long int sem_nsems;		/* number of semaphores in set */
+  unsigned long int __unused1;
+  unsigned long int __unused2;
+};
+
+#ifdef __LIBC_IPC_INTERNAL
+struct __old_semid_ds
+{
+  struct __old_ipc_perm sem_perm;	/* operation permission struct */
+  __time_t sem_otime;			/* last semop() time */
+  __time_t sem_ctime;			/* last time changed by semctl() */
+  struct sem *__sembase;		/* ptr to first semaphore in array */
+  struct sem_queue *__sem_pending;	/* pending operations */
+  struct sem_queue *__sem_pending_last; /* last pending operation */
+  struct sem_undo *__undo;		/* ondo requests on this array */
+  unsigned short int sem_nsems;		/* number of semaphores in set */
+};
+#endif
+
+/* The user should define a union like the following to use it for arguments
+   for `semctl'.
+
+   union semun
+   {
+     int val;				<= value for SETVAL
+     struct semid_ds *buf;		<= buffer for IPC_STAT & IPC_SET
+     unsigned short int *array;		<= array for GETALL & SETALL
+     struct seminfo *__buf;		<= buffer for IPC_INFO
+   };
+
+   Previous versions of this file used to define this union but this is
+   incorrect.  One can test the macro _SEM_SEMUN_UNDEFINED to see whether
+   one must define the union or not.  */
+#define _SEM_SEMUN_UNDEFINED	1
+
+#ifdef __USE_MISC
+
+/* ipcs ctl cmds */
+# define SEM_STAT 18
+# define SEM_INFO 19
+
+struct  seminfo
+{
+  int semmap;
+  int semmni;
+  int semmns;
+  int semmnu;
+  int semmsl;
+  int semopm;
+  int semume;
+  int semusz;
+  int semvmx;
+  int semaem;
+};
+
+#endif /* __USE_MISC */
diff --git a/sysdeps/unix/sysv/linux/sparc/bits/shm.h b/sysdeps/unix/sysv/linux/sparc/bits/shm.h
new file mode 100644
index 0000000000..8f2ee52296
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/sparc/bits/shm.h
@@ -0,0 +1,123 @@
+/* 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
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+#ifndef _SYS_SHM_H
+# error "Never include <bits/shm.h> directly; use <sys/shm.h> instead."
+#endif
+
+#include <sys/types.h>
+#include <bits/wordsize.h>
+
+/* Permission flag for shmget.  */
+#define SHM_R		0400		/* or S_IRUGO from <linux/stat.h> */
+#define SHM_W		0200		/* or S_IWUGO from <linux/stat.h> */
+
+/* Flags for `shmat'.  */
+#define SHM_RDONLY	010000		/* attach read-only else read-write */
+#define SHM_RND		020000		/* round attach address to SHMLBA */
+#define SHM_REMAP	040000		/* take-over region on attach */
+
+/* Commands for `shmctl'.  */
+#define SHM_LOCK	11		/* lock segment (root only) */
+#define SHM_UNLOCK	12		/* unlock segment (root only) */
+
+
+/* Data structure describing a set of semaphores.  */
+struct shmid_ds
+  {
+    struct ipc_perm shm_perm;		/* operation permission struct */
+#if __WORDSIZE == 32
+    unsigned int __pad1;
+#endif
+    __time_t shm_atime;			/* time of last shmat() */
+#if __WORDSIZE == 32
+    unsigned int __pad2;
+#endif
+    __time_t shm_dtime;			/* time of last shmdt() */
+#if __WORDSIZE == 32
+    unsigned int __pad3;
+#endif
+    __time_t shm_ctime;			/* time of last change by shmctl() */
+    size_t shm_segsz;			/* size of segment in bytes */
+    pid_t shm_cpid;			/* pid of creator */
+    pid_t shm_lpid;			/* pid of last shmop */
+    unsigned long int shm_nattch;	/* number of current attaches */
+    unsigned long int __unused1;
+    unsigned long int __unused2;
+  };
+
+#ifdef __LIBC_IPC_INTERNAL
+struct __old_shmid_ds
+  {
+    struct __old_ipc_perm shm_perm;	/* operation permission struct */
+    int shm_segsz;			/* size of segment in bytes */
+    __time_t shm_atime;			/* time of last shmat() */
+    __time_t shm_dtime;			/* time of last shmdt() */
+    __time_t shm_ctime;			/* time of last change by shmctl() */
+    __ipc_pid_t shm_cpid;		/* pid of creator */
+    __ipc_pid_t shm_lpid;		/* pid of last shmop */
+    unsigned short int shm_nattch;	/* number of current attaches */
+    unsigned short int __shm_npages;	/* size of segment (pages) */
+    unsigned long int *__shm_pages;	/* array of ptrs to frames -> SHMMAX */
+    struct vm_area_struct *__attaches;	/* descriptors for attaches */
+  };
+#endif
+
+#ifdef __USE_MISC
+
+/* ipcs ctl commands */
+# define SHM_STAT 	13
+# define SHM_INFO 	14
+
+/* shm_mode upper byte flags */
+# define SHM_DEST	01000	/* segment will be destroyed on last detach */
+# define SHM_LOCKED	02000   /* segment will not be swapped */
+
+struct	shminfo
+  {
+    unsigned long shmmax;
+    unsigned long shmmin;
+    unsigned long shmmni;
+    unsigned long shmseg;
+    unsigned long shmall;
+    unsigned long __unused1;
+    unsigned long __unused2;
+    unsigned long __unused3;
+    unsigned long __unused4;
+  };
+
+struct	__old_shminfo
+  {
+    int shmmax;
+    int shmmin;
+    int shmmni;
+    int shmseg;
+    int shmall;
+  };
+
+struct shm_info
+  {
+    int used_ids;
+    unsigned long int shm_tot;	/* total allocated shm */
+    unsigned long int shm_rss;	/* total resident shm */
+    unsigned long int shm_swp;	/* total swapped shm */
+    unsigned long int swap_attempts;
+    unsigned long int swap_successes;
+  };
+
+#endif /* __USE_MISC */
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/Dist b/sysdeps/unix/sysv/linux/sparc/sparc32/Dist
index 28968fd133..24b16852e6 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc32/Dist
+++ b/sysdeps/unix/sysv/linux/sparc/sparc32/Dist
@@ -1,7 +1,5 @@
 clone.S
 kernel_stat.h
 init-first.h
-setresuid.c
-setresgid.c
 setfsuid.c
 setfsgid.c
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/mmap64.c b/sysdeps/unix/sysv/linux/sparc/sparc32/mmap64.c
index c9e7653c89..6a77e28a8a 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc32/mmap64.c
+++ b/sysdeps/unix/sysv/linux/sparc/sparc32/mmap64.c
@@ -28,7 +28,7 @@
 #include "kernel-features.h"
 
 #ifdef __NR_mmap2
-extern int __syscall_mmap2(__ptr_t, size_t, int, int, int, off_t);
+extern __ptr_t __syscall_mmap2(__ptr_t, size_t, int, int, int, off_t);
 #ifndef __ASSUME_MMAP2_SYSCALL
 static int have_no_mmap2;
 #endif
@@ -48,11 +48,11 @@ __mmap64 (__ptr_t addr, size_t len, int prot, int flags, int fd, off64_t offset)
       int saved_errno = errno;
 #endif
       /* This will be always 12, no matter what page size is.  */
-      int result = INLINE_SYSCALL (mmap2, 6, addr, len, prot, flags,
-				   fd, (off_t) (offset >> 12));
+      __ptr_t result = INLINE_SYSCALL (mmap2, 6, addr, len, prot, flags,
+				       fd, (off_t) (offset >> 12));
 
 #ifndef __ASSUME_MMAP2_SYSCALL
-      if (result != -1 || errno != ENOSYS)
+      if (result != (__ptr_t) -1 || errno != ENOSYS)
 #endif
 	return result;
 
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/setegid.c b/sysdeps/unix/sysv/linux/sparc/sparc32/setegid.c
index 2e3a54c893..f822b0902e 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc32/setegid.c
+++ b/sysdeps/unix/sysv/linux/sparc/sparc32/setegid.c
@@ -1 +1,51 @@
-#include <sysdeps/unix/sysv/linux/i386/setegid.c>
+/* Copyright (C) 1998, 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
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+#include <errno.h>
+#include <sys/syscall.h>
+#include <sys/types.h>
+#include <unistd.h>
+
+#ifdef __NR_setresgid32
+
+extern int __setresgid (gid_t rgid, gid_t egid, gid_t sgid);
+
+int
+setegid (gid_t gid)
+{
+  int result;
+
+  if (gid == (gid_t) ~0)
+    {
+      __set_errno (EINVAL);
+      return -1;
+    }
+
+  /* First try the syscall.  */
+  result = __setresgid (-1, gid, -1);
+  if (result == -1 && errno == ENOSYS)
+    /* No system call available.  Use emulation.  This may not work
+       since `setregid' also sets the saved group ID when GID is not
+       equal to the real group ID, making it impossible to switch back. */
+    result = __setregid (-1, gid);
+
+  return result;
+}
+#else
+# include <sysdeps/unix/bsd/setegid.c>
+#endif
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/seteuid.c b/sysdeps/unix/sysv/linux/sparc/sparc32/seteuid.c
index 18e41d08c1..0b3c700924 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc32/seteuid.c
+++ b/sysdeps/unix/sysv/linux/sparc/sparc32/seteuid.c
@@ -1 +1,55 @@
-#include <sysdeps/unix/sysv/linux/i386/seteuid.c>
+/* 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
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+#include <errno.h>
+#include <sys/syscall.h>
+#include <sys/types.h>
+#include <unistd.h>
+
+#include "kernel-features.h"
+
+#if defined __NR_setresuid32 || __ASSUME_SETRESUID_SYSCALL > 0
+
+extern int __setresuid (uid_t ruid, uid_t euid, uid_t suid);
+
+int
+seteuid (uid_t uid)
+{
+  int result;
+
+  if (uid == (uid_t) ~0)
+    {
+      __set_errno (EINVAL);
+      return -1;
+    }
+
+  /* First try the syscall.  */
+  result = __setresuid (-1, uid, -1);
+# if __ASSUME_SETRESUID_SYSCALL == 0
+  if (result == -1 && errno == ENOSYS)
+    /* No system call available.  Use emulation.  This may not work
+       since `setreuid' also sets the saved user ID when UID is not
+       equal to the real user ID, making it impossible to switch back.  */
+    result = __setreuid (-1, uid);
+# endif
+
+  return result;
+}
+#else
+# include <sysdeps/unix/bsd/seteuid.c>
+#endif
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/setresgid.c b/sysdeps/unix/sysv/linux/sparc/sparc32/setresgid.c
deleted file mode 100644
index daca1a4833..0000000000
--- a/sysdeps/unix/sysv/linux/sparc/sparc32/setresgid.c
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/unix/sysv/linux/i386/setresgid.c>
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/setresuid.c b/sysdeps/unix/sysv/linux/sparc/sparc32/setresuid.c
deleted file mode 100644
index 3aeabe9ad7..0000000000
--- a/sysdeps/unix/sysv/linux/sparc/sparc32/setresuid.c
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/unix/sysv/linux/i386/setresuid.c>
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/syscalls.list b/sysdeps/unix/sysv/linux/sparc/sparc32/syscalls.list
index 07333a72b6..5f472d56c7 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc32/syscalls.list
+++ b/sysdeps/unix/sysv/linux/sparc/sparc32/syscalls.list
@@ -8,12 +8,14 @@ s_setfsuid	setfsuid setfsuid	1	__syscall_setfsuid
 s_setgid	setgid	setgid		1	__syscall_setgid
 s_setgroups	setgroups setgroups	2	__syscall_setgroups
 s_setregid	setregid setregid	2	__syscall_setregid
-s_setresgid	setresgid setresgid	3	__syscall_setresgid
-s_setresuid	setresuid setresuid	3	__syscall_setresuid
 s_setreuid	setreuid setreuid	2	__syscall_setreuid
 s_setrlimit	setrlimit setrlimit	3	__syscall_setrlimit
 s_ipc		msgget	ipc		5	__syscall_ipc
 s_setuid	setuid	setuid		1	__syscall_setuid
+setresuid	EXTRA	setresuid32	3	__setresuid	setresuid
+setresgid	EXTRA	setresgid32	3	__setresgid	setresgid
+getresuid	EXTRA	getresuid32	3	getresuid
+getresgid	EXTRA	getresgid32	3	getresgid
 
 # System calls with wrappers.
 rt_sigaction	-	rt_sigaction	4	__syscall_rt_sigaction
@@ -52,3 +54,25 @@ sys_mknod	xmknod	mknod		3	__syscall_mknod
 sys_readv	readv	readv		3	__syscall_readv
 sys_stat	xstat	stat		2	__syscall_stat
 sys_writev	writev	writev		3	__syscall_writev
+s_chown		chown	chown		3	__syscall_chown
+s_chown32	chown	chown32		3	__syscall_chown32
+s_fchown	fchown	fchown		3	__syscall_fchown
+s_fchown32	fchown	fchown32	3	__syscall_fchown32
+s_lchown	lchown	lchown		3	__syscall_lchown
+s_lchown32	lchown	lchown32	3	__syscall_lchown32
+s_getgid	getgid	getgid		0	__syscall_getgid
+s_getgid32	getgid	getgid32	0	__syscall_getgid32
+s_getuid	getuid	getuid		0	__syscall_getuid
+s_getuid32	getuid	getuid32	0	__syscall_getuid32
+s_getgroups32	getgroups getgroups32	2	__syscall_getgroups32
+s_setgroups32	setgroups setgroups32	2	__syscall_setgroups32
+s_setfsgid32	setfsgid setfsgid32	1	__syscall_setfsgid32
+s_setfsuid32	setfsuid setfsuid32	1	__syscall_setfsuid32
+s_setregid32	setregid setregid32	2	__syscall_setregid32
+s_setreuid32	setreuid setreuid32	2	__syscall_setreuid32
+s_getegid	getegid	getegid		0	__syscall_getegid
+s_geteuid	geteuid	geteuid		0	__syscall_geteuid
+s_getegid32	getegid	getegid32	0	__syscall_getegid32
+s_geteuid32	geteuid	geteuid32	0	__syscall_geteuid32
+s_setgid32	setgid	setgid32	1	__syscall_setgid32
+s_setuid32	setuid	setuid32	1	__syscall_setuid32
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/msgctl.c b/sysdeps/unix/sysv/linux/sparc/sparc64/msgctl.c
new file mode 100644
index 0000000000..53ace35584
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/sparc/sparc64/msgctl.c
@@ -0,0 +1,36 @@
+/* Copyright (C) 1995, 1997, 1998, 2000 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, August 1995.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+#include <errno.h>
+#include <sys/msg.h>
+
+#include <sysdep.h>
+#include <sys/syscall.h>
+
+/* Allows to control internal state and destruction of message queue
+   objects.  */
+
+int
+msgctl (msqid, cmd, buf)
+     int msqid;
+     int cmd;
+     struct msqid_ds *buf;
+{
+  return INLINE_SYSCALL (ipc, 5, IPCOP_msgctl, msqid, cmd, 0, buf);
+}
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/semctl.c b/sysdeps/unix/sysv/linux/sparc/sparc64/semctl.c
new file mode 100644
index 0000000000..b0f76e6552
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/sparc/sparc64/semctl.c
@@ -0,0 +1,54 @@
+/* Copyright (C) 1995, 1997, 1998, 2000 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, August 1995.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+#include <errno.h>
+#include <stdarg.h>
+#include <sys/sem.h>
+
+#include <sysdep.h>
+#include <sys/syscall.h>
+
+/* Define a `union semun' suitable for Linux here.  */
+union semun
+{
+  int val;			/* value for SETVAL */
+  struct semid_ds *buf;		/* buffer for IPC_STAT & IPC_SET */
+  unsigned short int *array;	/* array for GETALL & SETALL */
+  struct seminfo *__buf;	/* buffer for IPC_INFO */
+};
+
+
+/* Return identifier for array of NSEMS semaphores associated with
+   KEY.  */
+
+int
+semctl (int semid, int semnum, int cmd, ...)
+{
+  union semun arg;
+  va_list ap;
+
+  va_start (ap, cmd);
+
+  /* Get the argument.  */
+  arg = va_arg (ap, union semun);
+
+  va_end (ap);
+
+  return INLINE_SYSCALL (ipc, 5, IPCOP_semctl, semid, semnum, cmd, &arg);
+}
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/shmctl.c b/sysdeps/unix/sysv/linux/sparc/sparc64/shmctl.c
new file mode 100644
index 0000000000..7bb49469e0
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/sparc/sparc64/shmctl.c
@@ -0,0 +1,35 @@
+/* Copyright (C) 1995, 1997, 1998, 2000 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, August 1995.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+#include <errno.h>
+#include <sys/shm.h>
+
+#include <sysdep.h>
+#include <sys/syscall.h>
+
+/* Provide operations to control over shared memory segments.  */
+
+int
+shmctl (shmid, cmd, buf)
+     int shmid;
+     int cmd;
+     struct shmid_ds *buf;
+{
+  return INLINE_SYSCALL (ipc, 5, IPCOP_shmctl, shmid, cmd, 0, buf);
+}
diff --git a/sysdeps/unix/sysv/linux/syscalls.list b/sysdeps/unix/sysv/linux/syscalls.list
index 6215973fc3..7947cb6920 100644
--- a/sysdeps/unix/sysv/linux/syscalls.list
+++ b/sysdeps/unix/sysv/linux/syscalls.list
@@ -53,7 +53,7 @@ setfsgid	EXTRA	setfsgid	1	setfsgid
 setfsuid	EXTRA	setfsuid	1	setfsuid
 setpgid		-	setpgid		2	__setpgid	setpgid
 setresuid	EXTRA	setresuid	3	__setresuid	setresuid
-setresgid	EXTRA	setresgid	3	setresgid
+setresgid	EXTRA	setresgid	3	__setresgid	setresgid
 sigaltstack	-	sigaltstack	2	__sigaltstack	sigaltstack
 sysinfo		EXTRA	sysinfo		1	sysinfo
 swapon		-	swapon		2	__swapon	swapon
diff --git a/sysdeps/unix/sysv/linux/truncate64.c b/sysdeps/unix/sysv/linux/truncate64.c
index fb3b80a411..2f8d5a38e2 100644
--- a/sysdeps/unix/sysv/linux/truncate64.c
+++ b/sysdeps/unix/sysv/linux/truncate64.c
@@ -31,7 +31,7 @@
 int __have_no_truncate64;
 #endif
 
-extern int __syscall_truncate64 (int fd, int high_length, int low_length);
+extern int __syscall_truncate64 (const char *path, int high_length, int low_length);
 
 
 /* Truncate the file FD refers to to LENGTH bytes.  */