about summary refs log tree commit diff
path: root/sysdeps/unix
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/unix')
-rw-r--r--sysdeps/unix/sysv/linux/kernel-features.h12
-rw-r--r--sysdeps/unix/sysv/linux/msgctl.c2
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/bits/ipc.h5
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/bits/msq.h77
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/bits/sem.h87
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/bits/shm.h94
-rw-r--r--sysdeps/unix/sysv/linux/s390/bits/fcntl.h14
-rw-r--r--sysdeps/unix/sysv/linux/s390/sys/procfs.h28
-rw-r--r--sysdeps/unix/sysv/linux/s390/sys/ucontext.h72
-rw-r--r--sysdeps/unix/sysv/linux/semctl.c2
-rw-r--r--sysdeps/unix/sysv/linux/shmctl.c2
11 files changed, 316 insertions, 79 deletions
diff --git a/sysdeps/unix/sysv/linux/kernel-features.h b/sysdeps/unix/sysv/linux/kernel-features.h
index 9639be3fa1..563a7e911e 100644
--- a/sysdeps/unix/sysv/linux/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/kernel-features.h
@@ -110,15 +110,23 @@
 # define __ASSUME_NEW_GETRLIMIT_SYSCALL	1
 #endif
 
-/* Linux 2.3.39 introduced 32bit UID/GIDs.  Some platforms had 32 bit
-   type all along.  */
+/* Linux 2.3.39 introduced 32bit UID/GIDs and IPC64.  Some platforms had 32
+   bit type all along.  */
 #if __LINUX_KERNEL_VERSION >= 131879 || defined __powerpc__ || defined __mips__
 # define __ASSUME_32BITUIDS		1
+# ifndef __powerpc__
+#  define __ASSUME_IPC64		1
+# endif
 # ifdef __sparc__
 #  define __ASSUME_SETRESUID_SYSCALL	1
 # endif
 #endif
 
+/* Linux 2.4.0 on PPC introduced a correct IPC64.  */
+#if __LINUX_KERNEL_VERSION >= 132096 && defined __powerpc__
+# define __ASSUME_IPC64			1
+#endif
+
 /* We can use the LDTs for threading with Linux 2.3.99 and newer.  */
 #if __LINUX_KERNEL_VERSION >= 131939
 # define __ASSUME_LDT_WORKS		1
diff --git a/sysdeps/unix/sysv/linux/msgctl.c b/sysdeps/unix/sysv/linux/msgctl.c
index fb0ad56c76..7c43e5587b 100644
--- a/sysdeps/unix/sysv/linux/msgctl.c
+++ b/sysdeps/unix/sysv/linux/msgctl.c
@@ -65,7 +65,7 @@ compat_symbol (libc, __old_msgctl, msgctl, GLIBC_2_0);
 int
 __new_msgctl (int msqid, int cmd, struct msqid_ds *buf)
 {
-#if __ASSUME_32BITUIDS > 0
+#if __ASSUME_IPC64 > 0
   return INLINE_SYSCALL (ipc, 5, IPCOP_msgctl,
 			 msqid, cmd | __IPC_64, 0, CHECK_1 (buf));
 #else
diff --git a/sysdeps/unix/sysv/linux/powerpc/bits/ipc.h b/sysdeps/unix/sysv/linux/powerpc/bits/ipc.h
index 74b3d49111..60c6094dfe 100644
--- a/sysdeps/unix/sysv/linux/powerpc/bits/ipc.h
+++ b/sysdeps/unix/sysv/linux/powerpc/bits/ipc.h
@@ -48,7 +48,10 @@ struct ipc_perm
     __uid_t cuid;		/* Creator's user ID.  */
     __gid_t cgid;		/* Creator's group ID.  */
     __mode_t mode;		/* Read/write permission.  */
-    unsigned short int __seq;	/* Sequence number.  */
+    unsigned long int __seq;	/* Sequence number.  */
+    unsigned int __pad1;
+    unsigned long long int __unused1;
+    unsigned long long int __unused2;
   };
 
 
diff --git a/sysdeps/unix/sysv/linux/powerpc/bits/msq.h b/sysdeps/unix/sysv/linux/powerpc/bits/msq.h
new file mode 100644
index 0000000000..45caff5535
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/powerpc/bits/msq.h
@@ -0,0 +1,77 @@
+/* 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 <bits/types.h>
+
+/* Define options for message queue functions.  */
+#define MSG_NOERROR    010000  /* no error if message is too big */
+#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.
+   The type `struct msg' is opaque.  */
+struct msqid_ds
+{
+  struct ipc_perm msg_perm;    /* structure describing operation permission */
+  unsigned int __unused1;
+  __time_t msg_stime;          /* time of last msgsnd command */
+  unsigned int __unused2;
+  __time_t msg_rtime;          /* time of last msgrcv command */
+  unsigned int __unused3;
+  __time_t msg_ctime;          /* time of last change */
+  unsigned long __msg_cbytes; /* current number of bytes 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 __unused4;
+  unsigned long __unused5;
+};
+
+#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/powerpc/bits/sem.h b/sysdeps/unix/sysv/linux/powerpc/bits/sem.h
new file mode 100644
index 0000000000..18a9ff4d6f
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/powerpc/bits/sem.h
@@ -0,0 +1,87 @@
+/* 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 */
+  unsigned int __unused1;
+  __time_t sem_otime;                  /* last semop() time */
+  unsigned int __unused2;
+  __time_t sem_ctime;                  /* last time changed by semctl() */
+  unsigned long int sem_nsems;         /* number of semaphores in set */
+  unsigned long __unused3;
+  unsigned long __unused4;
+};
+
+/* 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/powerpc/bits/shm.h b/sysdeps/unix/sysv/linux/powerpc/bits/shm.h
new file mode 100644
index 0000000000..2150023cb1
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/powerpc/bits/shm.h
@@ -0,0 +1,94 @@
+/* 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 <bits/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) */
+
+
+/* Type to count number of attaches.  */
+typedef unsigned long int shmatt_t;
+
+/* Data structure describing a set of semaphores.  */
+struct shmid_ds
+  {
+    struct ipc_perm shm_perm;          /* operation permission struct */
+    unsigned int __unused1;
+    __time_t shm_atime;                        /* time of last shmat() */
+    unsigned int __unused2;
+    __time_t shm_dtime;                        /* time of last shmdt() */
+    unsigned int __unused3;
+    __time_t shm_ctime;                        /* time of last change by shmctl() */
+    unsigned int __unused4;
+    size_t shm_segsz;                  /* size of segment in bytes */
+    __pid_t shm_cpid;                  /* pid of creator */
+    __pid_t shm_lpid;                  /* pid of last shmop */
+    shmatt_t shm_nattch;               /* number of current attaches */
+    unsigned long __unused5;
+    unsigned long __unused6;
+  };
+
+#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 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/s390/bits/fcntl.h b/sysdeps/unix/sysv/linux/s390/bits/fcntl.h
index a54784a977..637bffaafe 100644
--- a/sysdeps/unix/sysv/linux/s390/bits/fcntl.h
+++ b/sysdeps/unix/sysv/linux/s390/bits/fcntl.h
@@ -65,14 +65,18 @@
 #define F_SETFD		2	/* Set file descriptor flags.  */
 #define F_GETFL		3	/* Get file status flags.  */
 #define F_SETFL		4	/* Set file status flags.  */
+#ifndef __USE_FILE_OFFSET64
 #define F_GETLK		5	/* Get record locking info.  */
 #define F_SETLK		6	/* Set record locking info (non-blocking).  */
 #define F_SETLKW	7	/* Set record locking info (blocking).  */
-
-/* XXX missing */
-#define F_GETLK64	5	/* Get record locking info.  */
-#define F_SETLK64	6	/* Set record locking info (non-blocking).  */
-#define F_SETLKW64	7	/* Set record locking info (blocking).  */
+#else
+# define F_GETLK        F_GETLK64  /* Get record locking info.  */
+# define F_SETLK        F_SETLK64  /* Set record locking info (non-blocking).*/
+# define F_SETLKW       F_SETLKW64 /* Set record locking info (blocking).  */
+#endif
+#define F_GETLK64       12      /* Get record locking info.  */
+#define F_SETLK64       13      /* Set record locking info (non-blocking).  */
+#define F_SETLKW64      14      /* Set record locking info (blocking).  */
 
 #if defined __USE_BSD || defined __USE_XOPEN2K
 # define F_SETOWN	8	/* Get owner of socket (receiver of SIGIO).  */
diff --git a/sysdeps/unix/sysv/linux/s390/sys/procfs.h b/sysdeps/unix/sysv/linux/s390/sys/procfs.h
index ee00621489..8b60338cdb 100644
--- a/sysdeps/unix/sysv/linux/s390/sys/procfs.h
+++ b/sysdeps/unix/sysv/linux/s390/sys/procfs.h
@@ -32,31 +32,15 @@
 #include <sys/time.h>
 #include <sys/types.h>
 #include <sys/user.h>
+#include <sys/ucontext.h>
 
 __BEGIN_DECLS
 
-/* Type for a general-purpose register.  */
-typedef unsigned long elf_greg_t;
-
-/* And the whole bunch of them.  We should have used `struct s390_regs',
-   but to avoid name space pollution and since the tradition says that
-   the register set is an array, we make elf_gregset_t a simple array
-   that has the same size as s390_regs. */
-#define ELF_NGREG 35
-typedef elf_greg_t elf_gregset_t[ELF_NGREG];
-
-typedef union
-{
-  double  d;
-  float   f;
-} elf_fpreg_t;
-
-/* Register set for the floating-point registers.  */
-typedef struct {
-  unsigned int fpc;
-  elf_fpreg_t fprs[NUM_FPRS];
-} elf_fpregset_t;
-
+typedef greg_t elf_greg_t;
+#define ELF_NGREG NGREG
+typedef gregset_t elf_gregset_t;
+typedef fpreg_t   elf_fpreg_t;
+typedef fpregset_t elf_fpregset_t;
 
 /* Signal info.  */
 struct elf_siginfo
diff --git a/sysdeps/unix/sysv/linux/s390/sys/ucontext.h b/sysdeps/unix/sysv/linux/s390/sys/ucontext.h
index 4723ce1810..b9ec8069b0 100644
--- a/sysdeps/unix/sysv/linux/s390/sys/ucontext.h
+++ b/sysdeps/unix/sysv/linux/s390/sys/ucontext.h
@@ -19,7 +19,9 @@
 
 #ifndef _SYS_UCONTEXT_H
 #define _SYS_UCONTEXT_H	1
-
+/* Forward definition to avoid parse errors */
+struct ucontext;
+typedef struct ucontext ucontext_t;
 #include <features.h>
 #include <signal.h>
 
@@ -28,62 +30,39 @@
 #include <bits/sigcontext.h>
 
 
-/* Type for general register.  */
-typedef int greg_t;
+/* Type for a general-purpose register.  */
+typedef unsigned long greg_t;
 
-/* Number of general registers.  */
-#define NGREG	16
+/* And the whole bunch of them.  We should have used `struct s390_regs',
+   but to avoid name space pollution and since the tradition says that
+   the register set is an array, we make gregset_t a simple array
+   that has the same size as s390_regs. */
+#define NGREG 36
+#define NUM_FPRS 16
+typedef greg_t gregset_t[NGREG];
 
-/* Number of each register is the `gregset_t' array.  */
-enum
+typedef union
 {
-  GPR0 = 0,
-#define GPR0 GPR0
-  GPR1,
-#define GPR1 GPR1
-  GPR2,
-#define GPR2 GPR2
-  GPR3,
-#define GPR3 GPR3
-  GPR4,
-#define GPR4 GPR4
-  GPR5,
-#define GPR5 GPR5
-  GPR6,
-#define GPR6 GPR6
-  GPR7,
-#define GPR7 GPR7
-  GPR8,
-#define GPR8 GPR8
-  GPR9,
-#define GPR9 GPR9
-  GPRA,
-#define GPRA GPRA
-  GPRB,
-#define GPRB GPRB
-  GPRC,
-#define GPRC GPRC
-  GPRD,
-#define GPRD GPRD
-  GPRE,
-#define GPRE GPRE
-  GPRF
-#define GPRF GPRF
-};
+  double  d;
+  float   f;
+} fpreg_t;
 
-/* Structure to describe FPU registers.  */
-typedef long long fpreg_t;
+/* Register set for the floating-point registers.  */
+typedef struct {
+  unsigned int fpc;
+  fpreg_t fprs[NUM_FPRS];
+} fpregset_t;
 
 /* Context to describe whole processor state.  */
 typedef struct
   {
     int version;
-    greg_t gregs[NGREG];
-    fpreg_t fpregs[16];
+    gregset_t    gregs;
+    fpregset_t   fpregs;
   } mcontext_t;
 
 /* Userlevel context.  */
-typedef struct ucontext
+struct ucontext
   {
     unsigned long int uc_flags;
     struct ucontext *uc_links;
@@ -91,6 +70,7 @@ typedef struct ucontext
     stack_t uc_stack;
     mcontext_t uc_mcontext;
     long int uc_filler[170];
-  } ucontext_t;
+  };
+
 
 #endif /* sys/ucontext.h */
diff --git a/sysdeps/unix/sysv/linux/semctl.c b/sysdeps/unix/sysv/linux/semctl.c
index 0d64b95dba..b858de2ca2 100644
--- a/sysdeps/unix/sysv/linux/semctl.c
+++ b/sysdeps/unix/sysv/linux/semctl.c
@@ -93,7 +93,7 @@ __new_semctl (int semid, int semnum, int cmd, ...)
 
   va_end (ap);
 
-#if __ASSUME_32BITUIDS > 0
+#if __ASSUME_IPC64 > 0
   return INLINE_SYSCALL (ipc, 5, IPCOP_semctl, semid, semnum, cmd | __IPC_64,
 			 CHECK_SEMCTL (&arg, semid, cmd | __IPC_64));
 #else
diff --git a/sysdeps/unix/sysv/linux/shmctl.c b/sysdeps/unix/sysv/linux/shmctl.c
index 8ff911bca8..d47c611ab1 100644
--- a/sysdeps/unix/sysv/linux/shmctl.c
+++ b/sysdeps/unix/sysv/linux/shmctl.c
@@ -73,7 +73,7 @@ compat_symbol (libc, __old_shmctl, shmctl, GLIBC_2_0);
 int
 __new_shmctl (int shmid, int cmd, struct shmid_ds *buf)
 {
-#if __ASSUME_32BITUIDS > 0
+#if __ASSUME_IPC64 > 0
   return INLINE_SYSCALL (ipc, 5, IPCOP_shmctl, shmid, cmd | __IPC_64, 0, CHECK_1 (buf));
 #else
   switch (cmd) {