From 19e62f26901febce98e34d81eb40323dcc835cd3 Mon Sep 17 00:00:00 2001 From: Joseph Myers Date: Wed, 10 Oct 2018 00:54:27 +0000 Subject: Use common bits/sem.h for more architectures. sysdeps/unix/sysv/linux/bits/sem.h has padding after time fields in struct semid_ds unconditionally, and thus is only suitable for 32-bit architectures (no 64-bit configurations use this file); sysdeps/unix/sysv/linux/generic/bits/sem.h is substantively the same, except that the padding is conditioned on __WORDSIZE == 32, and so it can be used for 64-bit architectures as well. This patch adds the conditionals to sysdeps/unix/sysv/linux/bits/sem.h. The linux/generic/ version is then no longer needed and so is removed, as are the alpha, ia64 and s390 versions which are also no longer needed. The other architecture-specific versions have different padding or types and so are still needed after this change. This is essentially the same change for bits/sem.h as the bits/msq.h patch. However, the details of the padding variations for the architectures that aren't changed are not all the same between msqid_ds and semid_ds. Tested with build-many-glibcs.py. * sysdeps/unix/sysv/linux/bits/sem.h: Include . (struct semid_ds): Condition padding after time fields on [__WORDSIZE == 32]. * sysdeps/unix/sysv/linux/alpha/bits/sem.h: Remove file. * sysdeps/unix/sysv/linux/generic/bits/sem.h: Likewise. * sysdeps/unix/sysv/linux/ia64/bits/sem.h: Likewise. * sysdeps/unix/sysv/linux/s390/bits/sem.h: Likewise. --- ChangeLog | 8 +++ sysdeps/unix/sysv/linux/alpha/bits/sem.h | 85 --------------------------- sysdeps/unix/sysv/linux/bits/sem.h | 5 ++ sysdeps/unix/sysv/linux/generic/bits/sem.h | 93 ------------------------------ sysdeps/unix/sysv/linux/ia64/bits/sem.h | 86 --------------------------- sysdeps/unix/sysv/linux/s390/bits/sem.h | 91 ----------------------------- 6 files changed, 13 insertions(+), 355 deletions(-) delete mode 100644 sysdeps/unix/sysv/linux/alpha/bits/sem.h delete mode 100644 sysdeps/unix/sysv/linux/generic/bits/sem.h delete mode 100644 sysdeps/unix/sysv/linux/ia64/bits/sem.h delete mode 100644 sysdeps/unix/sysv/linux/s390/bits/sem.h diff --git a/ChangeLog b/ChangeLog index 124f645284..4d4dbe2751 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,13 @@ 2018-10-10 Joseph Myers + * sysdeps/unix/sysv/linux/bits/sem.h: Include . + (struct semid_ds): Condition padding after time fields on + [__WORDSIZE == 32]. + * sysdeps/unix/sysv/linux/alpha/bits/sem.h: Remove file. + * sysdeps/unix/sysv/linux/generic/bits/sem.h: Likewise. + * sysdeps/unix/sysv/linux/ia64/bits/sem.h: Likewise. + * sysdeps/unix/sysv/linux/s390/bits/sem.h: Likewise. + * sysdeps/unix/sysv/linux/bits/msq.h: Include . (struct msqid_ds): Condition padding after time fields on [__WORDSIZE == 32]. diff --git a/sysdeps/unix/sysv/linux/alpha/bits/sem.h b/sysdeps/unix/sysv/linux/alpha/bits/sem.h deleted file mode 100644 index d218cf4f92..0000000000 --- a/sysdeps/unix/sysv/linux/alpha/bits/sem.h +++ /dev/null @@ -1,85 +0,0 @@ -/* Copyright (C) 1995-2018 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 */ - __time_t sem_ctime; /* last time changed by semctl() */ - unsigned long int sem_nsems; /* number of semaphores in set */ - unsigned long int __glibc_reserved1; - unsigned long int __glibc_reserved2; -}; - -/* 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 -# define SEM_STAT_ANY 20 - -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/sem.h b/sysdeps/unix/sysv/linux/bits/sem.h index 7ccd600517..bf6d797080 100644 --- a/sysdeps/unix/sysv/linux/bits/sem.h +++ b/sysdeps/unix/sysv/linux/bits/sem.h @@ -20,6 +20,7 @@ #endif #include +#include /* Flags for `semop'. */ #define SEM_UNDO 0x1000 /* undo the operation on exit */ @@ -39,9 +40,13 @@ struct semid_ds { struct ipc_perm sem_perm; /* operation permission struct */ __time_t sem_otime; /* last semop() time */ +#if __WORDSIZE == 32 unsigned long int __glibc_reserved1; +#endif __time_t sem_ctime; /* last time changed by semctl() */ +#if __WORDSIZE == 32 unsigned long int __glibc_reserved2; +#endif unsigned long int sem_nsems; /* number of semaphores in set */ unsigned long int __glibc_reserved3; unsigned long int __glibc_reserved4; diff --git a/sysdeps/unix/sysv/linux/generic/bits/sem.h b/sysdeps/unix/sysv/linux/generic/bits/sem.h deleted file mode 100644 index 9c8b318efb..0000000000 --- a/sysdeps/unix/sysv/linux/generic/bits/sem.h +++ /dev/null @@ -1,93 +0,0 @@ -/* Copyright (C) 2011-2018 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Chris Metcalf , 2011. - - 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 -#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 */ -#if __WORDSIZE == 32 - unsigned long int __glibc_reserved1; -#endif - __time_t sem_ctime; /* last time changed by semctl() */ -#if __WORDSIZE == 32 - unsigned long int __glibc_reserved2; -#endif - unsigned long int sem_nsems; /* number of semaphores in set */ - unsigned long int __glibc_reserved3; - unsigned long int __glibc_reserved4; -}; - -/* 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 -# define SEM_STAT_ANY 20 - -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/ia64/bits/sem.h b/sysdeps/unix/sysv/linux/ia64/bits/sem.h deleted file mode 100644 index e2637076ae..0000000000 --- a/sysdeps/unix/sysv/linux/ia64/bits/sem.h +++ /dev/null @@ -1,86 +0,0 @@ -/* Copyright (C) 2000-2018 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by David Mosberger-Tang - - 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 */ - __time_t sem_ctime; /* last time changed by semctl() */ - unsigned long int sem_nsems; /* number of semaphores in set */ - unsigned long int __glibc_reserved1; - unsigned long int __glibc_reserved2; -}; - -/* 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 -# define SEM_STAT_ANY 20 - -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/s390/bits/sem.h b/sysdeps/unix/sysv/linux/s390/bits/sem.h deleted file mode 100644 index 1d0bd5cd9a..0000000000 --- a/sysdeps/unix/sysv/linux/s390/bits/sem.h +++ /dev/null @@ -1,91 +0,0 @@ -/* Copyright (C) 2001-2018 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 */ -#if __WORDSIZE != 64 - unsigned long int __glibc_reserved1; -#endif - __time_t sem_ctime; /* last time changed by semctl() */ -#if __WORDSIZE != 64 - unsigned long int __glibc_reserved2; -#endif - unsigned long int sem_nsems; /* number of semaphores in set */ - unsigned long int __glibc_reserved3; - unsigned long int __glibc_reserved4; -}; - -/* 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 -# define SEM_STAT_ANY 20 - -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 */ -- cgit 1.4.1