From patchwork Mon Oct 8 19:45:30 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joseph Myers X-Patchwork-Id: 29672 Received: (qmail 100752 invoked by alias); 8 Oct 2018 19:45:57 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 100540 invoked by uid 89); 8 Oct 2018 19:45:43 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-24.5 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.2 spammy=4013 X-HELO: relay1.mentorg.com Date: Mon, 8 Oct 2018 19:45:30 +0000 From: Joseph Myers To: Subject: Use common bits/sem.h for more architectures Message-ID: User-Agent: Alpine 2.21 (DEB 202 2017-01-01) MIME-Version: 1.0 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 (pending review; there is no dependency on that 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. 2018-10-08 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. 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 */