From a254b8c9cb0e2ab9d135af53e20f77512736d69f Mon Sep 17 00:00:00 2001 From: "H.J. Lu" Date: Thu, 31 May 2012 16:04:12 -0700 Subject: Use x86-64 bits/{msq,sem,shm}.h for i386 and x86-64 --- ChangeLog | 7 ++ sysdeps/unix/sysv/linux/x86/bits/msq.h | 81 ++++++++++++++++++++++ sysdeps/unix/sysv/linux/x86/bits/sem.h | 86 +++++++++++++++++++++++ sysdeps/unix/sysv/linux/x86/bits/shm.h | 109 ++++++++++++++++++++++++++++++ sysdeps/unix/sysv/linux/x86_64/bits/msq.h | 81 ---------------------- sysdeps/unix/sysv/linux/x86_64/bits/sem.h | 86 ----------------------- sysdeps/unix/sysv/linux/x86_64/bits/shm.h | 109 ------------------------------ 7 files changed, 283 insertions(+), 276 deletions(-) create mode 100644 sysdeps/unix/sysv/linux/x86/bits/msq.h create mode 100644 sysdeps/unix/sysv/linux/x86/bits/sem.h create mode 100644 sysdeps/unix/sysv/linux/x86/bits/shm.h delete mode 100644 sysdeps/unix/sysv/linux/x86_64/bits/msq.h delete mode 100644 sysdeps/unix/sysv/linux/x86_64/bits/sem.h delete mode 100644 sysdeps/unix/sysv/linux/x86_64/bits/shm.h diff --git a/ChangeLog b/ChangeLog index 375b385..024cc26 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,13 @@ 2012-05-31 H.J. Lu [BZ #14117] + * sysdeps/unix/sysv/linux/x86_64/bits/msq.h: Renamed to ... + * sysdeps/unix/sysv/linux/x86/bits/msq.h: This. + * sysdeps/unix/sysv/linux/x86_64/bits/sem.h: Renamed to ... + * sysdeps/unix/sysv/linux/x86/bits/sem.h: This. + * sysdeps/unix/sysv/linux/x86_64/bits/shm.h: Renamed to ... + * sysdeps/unix/sysv/linux/x86/bits/shm.h: This. + * sysdeps/unix/sysv/linux/x86_64/bits/ipctypes.h: Renamed to ... * sysdeps/unix/sysv/linux/x86/bits/ipctypes.h: This. diff --git a/sysdeps/unix/sysv/linux/x86/bits/msq.h b/sysdeps/unix/sysv/linux/x86/bits/msq.h new file mode 100644 index 0000000..7f23500 --- /dev/null +++ b/sysdeps/unix/sysv/linux/x86/bits/msq.h @@ -0,0 +1,81 @@ +/* Copyright (C) 1995-2012 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#ifndef _SYS_MSG_H +# error "Never use directly; include instead." +#endif + +#include + +/* 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 __syscall_ulong_t msgqnum_t; +typedef __syscall_ulong_t 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 */ + __time_t msg_stime; /* time of last msgsnd command */ +#ifndef __x86_64__ + unsigned long int __unused1; +#endif + __time_t msg_rtime; /* time of last msgrcv command */ +#ifndef __x86_64__ + unsigned long int __unused2; +#endif + __time_t msg_ctime; /* time of last change */ +#ifndef __x86_64__ + unsigned long int __unused3; +#endif + __syscall_ulong_t __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() */ + __syscall_ulong_t __unused4; + __syscall_ulong_t __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/x86/bits/sem.h b/sysdeps/unix/sysv/linux/x86/bits/sem.h new file mode 100644 index 0000000..92bbcef --- /dev/null +++ b/sysdeps/unix/sysv/linux/x86/bits/sem.h @@ -0,0 +1,86 @@ +/* Copyright (C) 2002-2012 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#ifndef _SYS_SEM_H +# error "Never include directly; use instead." +#endif + +#include + +/* 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 */ + __syscall_ulong_t __unused1; + __time_t sem_ctime; /* last time changed by semctl() */ + __syscall_ulong_t __unused2; + __syscall_ulong_t sem_nsems; /* number of semaphores in set */ + __syscall_ulong_t __unused3; + __syscall_ulong_t __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/x86/bits/shm.h b/sysdeps/unix/sysv/linux/x86/bits/shm.h new file mode 100644 index 0000000..cba25ed --- /dev/null +++ b/sysdeps/unix/sysv/linux/x86/bits/shm.h @@ -0,0 +1,109 @@ +/* Copyright (C) 1995-2012 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#ifndef _SYS_SHM_H +# error "Never include directly; use instead." +#endif + +#include + +/* Permission flag for shmget. */ +#define SHM_R 0400 /* or S_IRUGO from */ +#define SHM_W 0200 /* or S_IWUGO from */ + +/* 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 */ +#define SHM_EXEC 0100000 /* execution access */ + +/* Commands for `shmctl'. */ +#define SHM_LOCK 11 /* lock segment (root only) */ +#define SHM_UNLOCK 12 /* unlock segment (root only) */ + +__BEGIN_DECLS + +/* Segment low boundary address multiple. */ +#define SHMLBA (__getpagesize ()) +extern int __getpagesize (void) __THROW __attribute__ ((__const__)); + + +/* Type to count number of attaches. */ +typedef __syscall_ulong_t shmatt_t; + +/* Data structure describing a shared memory segment. */ +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() */ +#ifndef __x86_64__ + unsigned long int __unused1; +#endif + __time_t shm_dtime; /* time of last shmdt() */ +#ifndef __x86_64__ + unsigned long int __unused2; +#endif + __time_t shm_ctime; /* time of last change by shmctl() */ +#ifndef __x86_64__ + unsigned long int __unused3; +#endif + __pid_t shm_cpid; /* pid of creator */ + __pid_t shm_lpid; /* pid of last shmop */ + shmatt_t shm_nattch; /* number of current attaches */ + __syscall_ulong_t __unused4; + __syscall_ulong_t __unused5; + }; + +#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 */ +# define SHM_HUGETLB 04000 /* segment is mapped via hugetlb */ +# define SHM_NORESERVE 010000 /* don't check for reservations */ + +struct shminfo + { + __syscall_ulong_t shmmax; + __syscall_ulong_t shmmin; + __syscall_ulong_t shmmni; + __syscall_ulong_t shmseg; + __syscall_ulong_t shmall; + __syscall_ulong_t __unused1; + __syscall_ulong_t __unused2; + __syscall_ulong_t __unused3; + __syscall_ulong_t __unused4; + }; + +struct shm_info + { + int used_ids; + __syscall_ulong_t shm_tot; /* total allocated shm */ + __syscall_ulong_t shm_rss; /* total resident shm */ + __syscall_ulong_t shm_swp; /* total swapped shm */ + __syscall_ulong_t swap_attempts; + __syscall_ulong_t swap_successes; + }; + +#endif /* __USE_MISC */ + +__END_DECLS diff --git a/sysdeps/unix/sysv/linux/x86_64/bits/msq.h b/sysdeps/unix/sysv/linux/x86_64/bits/msq.h deleted file mode 100644 index 7f23500..0000000 --- a/sysdeps/unix/sysv/linux/x86_64/bits/msq.h +++ /dev/null @@ -1,81 +0,0 @@ -/* Copyright (C) 1995-2012 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 Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 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 - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#ifndef _SYS_MSG_H -# error "Never use directly; include instead." -#endif - -#include - -/* 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 __syscall_ulong_t msgqnum_t; -typedef __syscall_ulong_t 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 */ - __time_t msg_stime; /* time of last msgsnd command */ -#ifndef __x86_64__ - unsigned long int __unused1; -#endif - __time_t msg_rtime; /* time of last msgrcv command */ -#ifndef __x86_64__ - unsigned long int __unused2; -#endif - __time_t msg_ctime; /* time of last change */ -#ifndef __x86_64__ - unsigned long int __unused3; -#endif - __syscall_ulong_t __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() */ - __syscall_ulong_t __unused4; - __syscall_ulong_t __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/x86_64/bits/sem.h b/sysdeps/unix/sysv/linux/x86_64/bits/sem.h deleted file mode 100644 index 92bbcef..0000000 --- a/sysdeps/unix/sysv/linux/x86_64/bits/sem.h +++ /dev/null @@ -1,86 +0,0 @@ -/* Copyright (C) 2002-2012 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 Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 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 - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#ifndef _SYS_SEM_H -# error "Never include directly; use instead." -#endif - -#include - -/* 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 */ - __syscall_ulong_t __unused1; - __time_t sem_ctime; /* last time changed by semctl() */ - __syscall_ulong_t __unused2; - __syscall_ulong_t sem_nsems; /* number of semaphores in set */ - __syscall_ulong_t __unused3; - __syscall_ulong_t __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/x86_64/bits/shm.h b/sysdeps/unix/sysv/linux/x86_64/bits/shm.h deleted file mode 100644 index cba25ed..0000000 --- a/sysdeps/unix/sysv/linux/x86_64/bits/shm.h +++ /dev/null @@ -1,109 +0,0 @@ -/* Copyright (C) 1995-2012 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 Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 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 - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#ifndef _SYS_SHM_H -# error "Never include directly; use instead." -#endif - -#include - -/* Permission flag for shmget. */ -#define SHM_R 0400 /* or S_IRUGO from */ -#define SHM_W 0200 /* or S_IWUGO from */ - -/* 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 */ -#define SHM_EXEC 0100000 /* execution access */ - -/* Commands for `shmctl'. */ -#define SHM_LOCK 11 /* lock segment (root only) */ -#define SHM_UNLOCK 12 /* unlock segment (root only) */ - -__BEGIN_DECLS - -/* Segment low boundary address multiple. */ -#define SHMLBA (__getpagesize ()) -extern int __getpagesize (void) __THROW __attribute__ ((__const__)); - - -/* Type to count number of attaches. */ -typedef __syscall_ulong_t shmatt_t; - -/* Data structure describing a shared memory segment. */ -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() */ -#ifndef __x86_64__ - unsigned long int __unused1; -#endif - __time_t shm_dtime; /* time of last shmdt() */ -#ifndef __x86_64__ - unsigned long int __unused2; -#endif - __time_t shm_ctime; /* time of last change by shmctl() */ -#ifndef __x86_64__ - unsigned long int __unused3; -#endif - __pid_t shm_cpid; /* pid of creator */ - __pid_t shm_lpid; /* pid of last shmop */ - shmatt_t shm_nattch; /* number of current attaches */ - __syscall_ulong_t __unused4; - __syscall_ulong_t __unused5; - }; - -#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 */ -# define SHM_HUGETLB 04000 /* segment is mapped via hugetlb */ -# define SHM_NORESERVE 010000 /* don't check for reservations */ - -struct shminfo - { - __syscall_ulong_t shmmax; - __syscall_ulong_t shmmin; - __syscall_ulong_t shmmni; - __syscall_ulong_t shmseg; - __syscall_ulong_t shmall; - __syscall_ulong_t __unused1; - __syscall_ulong_t __unused2; - __syscall_ulong_t __unused3; - __syscall_ulong_t __unused4; - }; - -struct shm_info - { - int used_ids; - __syscall_ulong_t shm_tot; /* total allocated shm */ - __syscall_ulong_t shm_rss; /* total resident shm */ - __syscall_ulong_t shm_swp; /* total swapped shm */ - __syscall_ulong_t swap_attempts; - __syscall_ulong_t swap_successes; - }; - -#endif /* __USE_MISC */ - -__END_DECLS -- cgit v1.1