From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from esa3.hgst.iphmx.com (esa3.hgst.iphmx.com [216.71.153.141]) by sourceware.org (Postfix) with ESMTPS id E99B3385DC0C for ; Tue, 28 Apr 2020 22:13:29 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org E99B3385DC0C IronPort-SDR: yfZmI9D0y2S7sMBGgk0i1ngbRJH+J8dQP5weDlaelgo3mnLxq3RkXCWrfEacCdz9Lan+LLNrFO 4YrT7HvtCmrKCuf4PlLF7poITKx8FapXOpeq4CVD9Bxw/fJ9am52WxuzrVBUlWUPP3/Si64udW k1/iq0Wd7JBKss83nuYy478KT1tzk0BI6SKyhUMKPBLYuduWo6FslSnBq3MLpRCZq7w420jUX0 ld/mQyKhQtzoI5o9uXxIWlCqFt4BHpA3SVkomYJlzYX8ThxyeEuEJnDV0EUlO2A/GJ4qHsz6vr Qz8= X-IronPort-AV: E=Sophos;i="5.73,328,1583164800"; d="scan'208";a="140766185" Received: from uls-op-cesaip01.wdc.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 29 Apr 2020 06:13:27 +0800 IronPort-SDR: WSNzs4kUmRZmdsMxrqlpdfeag/pkr7newUTTYDjQCmmIfnxjX2SsZsk/I+qCjGaEtlhqG4FMGR V2MDnn+dTjnONtVdpy4Wn3NNZjCfpmN6Y= Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Apr 2020 15:04:06 -0700 IronPort-SDR: Vxi/9CbrRPWCdUcxzcCrEmPUjMQMNK8qVRdkWbFJrIZLmzCH2IbFOwuyQarQHDK20ZAuPiFT9J fmwVac4Uimjg== WDCIronportException: Internal Received: from cnf009918.ad.shared (HELO risc6-mainframe.hgst.com) ([10.86.56.6]) by uls-op-cesaip01.wdc.com with ESMTP; 28 Apr 2020 15:13:27 -0700 From: Alistair Francis To: libc-alpha@sourceware.org Cc: alistair23@gmail.com, Alistair Francis , Adhemerval Zanella Subject: [PATCH v6 1/3] bits/sem.h: Split out struct semid_ds Date: Tue, 28 Apr 2020 15:05:05 -0700 Message-Id: <20200428220507.3409362-2-alistair.francis@wdc.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200428220507.3409362-1-alistair.francis@wdc.com> References: <20200428220507.3409362-1-alistair.francis@wdc.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-24.6 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_SHORT, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Apr 2020 22:13:31 -0000 Split out the struct semid_ds into it's own file. This will allow us to have architectures specify their own version. Reviewed-by: Adhemerval Zanella --- sysdeps/unix/sysv/linux/Makefile | 1 + sysdeps/unix/sysv/linux/bits/sem.h | 24 +---------- .../sysv/linux/bits/types/struct_semid_ds.h | 43 +++++++++++++++++++ 3 files changed, 45 insertions(+), 23 deletions(-) create mode 100644 sysdeps/unix/sysv/linux/bits/types/struct_semid_ds.h diff --git a/sysdeps/unix/sysv/linux/Makefile b/sysdeps/unix/sysv/linux/Makefile index 089a4899d5..db35c29351 100644 --- a/sysdeps/unix/sysv/linux/Makefile +++ b/sysdeps/unix/sysv/linux/Makefile @@ -90,6 +90,7 @@ sysdep_headers += sys/mount.h sys/acct.h \ bits/termios-baud.h bits/termios-c_cflag.h \ bits/termios-c_lflag.h bits/termios-tcflow.h \ bits/termios-misc.h \ + bits/types/struct_semid_ds.h \ bits/ipc-perm.h tests += tst-clone tst-clone2 tst-clone3 tst-fanotify tst-personality \ diff --git a/sysdeps/unix/sysv/linux/bits/sem.h b/sysdeps/unix/sysv/linux/bits/sem.h index e0f4155c67..0d1813ec67 100644 --- a/sysdeps/unix/sysv/linux/bits/sem.h +++ b/sysdeps/unix/sysv/linux/bits/sem.h @@ -21,6 +21,7 @@ #include #include +#include /* Flags for `semop'. */ #define SEM_UNDO 0x1000 /* undo the operation on exit */ @@ -34,29 +35,6 @@ #define SETVAL 16 /* set semval */ #define SETALL 17 /* set all semval's */ - -#if __SEM_PAD_BEFORE_TIME -# define __SEM_PAD_TIME(NAME, RES) \ - __syscall_ulong_t __glibc_reserved ## RES; __time_t NAME -#elif __SEM_PAD_AFTER_TIME -# define __SEM_PAD_TIME(NAME, RES) \ - __time_t NAME; __syscall_ulong_t __glibc_reserved ## RES -#else -# define __SEM_PAD_TIME(NAME, RES) \ - __time_t NAME -#endif - -/* Data structure describing a set of semaphores. */ -struct semid_ds -{ - struct ipc_perm sem_perm; /* operation permission struct */ - __SEM_PAD_TIME (sem_otime, 1); /* last semop() time */ - __SEM_PAD_TIME (sem_ctime, 2); /* last time changed by semctl() */ - __syscall_ulong_t sem_nsems; /* number of semaphores in set */ - __syscall_ulong_t __glibc_reserved3; - __syscall_ulong_t __glibc_reserved4; -}; - /* The user should define a union like the following to use it for arguments for `semctl'. diff --git a/sysdeps/unix/sysv/linux/bits/types/struct_semid_ds.h b/sysdeps/unix/sysv/linux/bits/types/struct_semid_ds.h new file mode 100644 index 0000000000..0e136961d5 --- /dev/null +++ b/sysdeps/unix/sysv/linux/bits/types/struct_semid_ds.h @@ -0,0 +1,43 @@ +/* Generic implementation of the semaphore struct semid_ds. + Copyright (C) 1995-2020 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 + +#if __SEM_PAD_BEFORE_TIME +# define __SEM_PAD_TIME(NAME, RES) \ + __syscall_ulong_t __glibc_reserved ## RES; __time_t NAME +#elif __SEM_PAD_AFTER_TIME +# define __SEM_PAD_TIME(NAME, RES) \ + __time_t NAME; __syscall_ulong_t __glibc_reserved ## RES +#else +# define __SEM_PAD_TIME(NAME, RES) \ + __time_t NAME +#endif + +/* Data structure describing a set of semaphores. */ +struct semid_ds +{ + struct ipc_perm sem_perm; /* operation permission struct */ + __SEM_PAD_TIME (sem_otime, 1); /* last semop() time */ + __SEM_PAD_TIME (sem_ctime, 2); /* last time changed by semctl() */ + __syscall_ulong_t sem_nsems; /* number of semaphores in set */ + __syscall_ulong_t __glibc_reserved3; + __syscall_ulong_t __glibc_reserved4; +}; -- 2.26.2