From patchwork Thu Mar 26 16:37:22 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alistair Francis X-Patchwork-Id: 38633 Return-Path: X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from esa5.hgst.iphmx.com (esa5.hgst.iphmx.com [216.71.153.144]) by sourceware.org (Postfix) with ESMTPS id F1049385E023 for ; Thu, 26 Mar 2020 16:45:06 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org F1049385E023 IronPort-SDR: 3CiFMerqMlTMTRrbIe9ymBbGVoFXGZ/T/1XkXDN/U2vfEu6jfE2+IlrIBjGwk3kG/epxBBfTXq ytSxpRaJN6456UDCHmj+uV2dfawaihwZHGYdOWmHjrl0HtjEn1mLfCAErpGUZ90w7VhdxfpDqp 8gBcnpntYn/dbFmr5Up/vZNPikCtRTKw5HR3UYUDcM8ReqjGFTQLjDfxl8UiW47ADjzuGH2j9s CrYca14nXSMcHtxQLKzyvLc5BhSjBMg6WuHuBLo2gACCw2uHy1avmkyByYEIRJxcBbAu2KkymG WfU= X-IronPort-AV: E=Sophos;i="5.72,309,1580745600"; d="scan'208";a="134027529" Received: from uls-op-cesaip02.wdc.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 27 Mar 2020 00:45:02 +0800 IronPort-SDR: 9JmjRsccEx2zau/0YAmbaEMK8uN07NUPL3Vf8Xb1mPxVq0RhEq3gs4qwPRVsy2Y755fX4qCcrB 5+MWet5EvUyVzB0QObLS1vQGoxRPODjRWCRqeDGIj9X7bmFFSh7jkjKXE9vlsjTBb/+ZBb8/Of tetYg4gtcR9+bvLKNuPr9fQT0iqdJPH0/fweZj8g2cQ017FnaIP/XjPpEMdLqnT8ei0xY+486u YzqkLRUm8DpF9JJXHNzcFX7lnIRsGs0eU1/H/vJT2liDa7UyFPccMu0BQRUjG8CHZnrGXM8U/i qTu1JUh8drYm+2KCO69HMUr4 Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep02.wdc.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Mar 2020 09:36:04 -0700 IronPort-SDR: ILuT4hgF5xYNkD8lThSP476zYmaBqWZc6Iv9vMadOvNquwwMSGPqknHU7KKOBPZR3pCZNu64Fl CqiUILRte+/GJIOmVSoLdmvzSTV789WHZbPIEqib+HaO5RcimQ2iB+GV9lgvaacNV3nPrU/joT JasNl+ZQ5cc3ATrFvo2s7nE18u7TSztjutmMDExPowQ5BBpLvaQQ34TnLhYpiiTK9EDuq1ISlL PiXEow2FMz3Ha5dweBD+Yeqih43rKtznCzzutHIpfwozsPeFO/0UbaLcj5qDGyWMG8t3pprkX8 r0s= WDCIronportException: Internal Received: from lpt-shen-j.ad.shared (HELO risc6-mainframe.hgst.com) ([10.86.54.198]) by uls-op-cesaip02.wdc.com with ESMTP; 26 Mar 2020 09:45:01 -0700 From: Alistair Francis To: libc-alpha@sourceware.org Cc: Vineet.Gupta1@synopsys.com, alistair23@gmail.com, Alistair Francis Subject: [PATCH v4 1/3] bits/sem.h: Split out struct semid_ds Date: Thu, 26 Mar 2020 09:37:22 -0700 Message-Id: <20200326163724.377351-2-alistair.francis@wdc.com> X-Mailer: git-send-email 2.26.0 In-Reply-To: <20200326163724.377351-1-alistair.francis@wdc.com> References: <20200326163724.377351-1-alistair.francis@wdc.com> MIME-Version: 1.0 X-Spam-Status: No, score=-26.4 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: Thu, 26 Mar 2020 16:45:08 -0000 Split out the struct semid_ds into it's own file. This will allow us to have architectures specify their own version. --- sysdeps/unix/sysv/linux/Makefile | 1 + sysdeps/unix/sysv/linux/bits/sem.h | 24 +------------ sysdeps/unix/sysv/linux/bits/semid_ds_t.h | 43 +++++++++++++++++++++++ 3 files changed, 45 insertions(+), 23 deletions(-) create mode 100644 sysdeps/unix/sysv/linux/bits/semid_ds_t.h diff --git a/sysdeps/unix/sysv/linux/Makefile b/sysdeps/unix/sysv/linux/Makefile index 60dc5cf9e5..ddb2a54e57 100644 --- a/sysdeps/unix/sysv/linux/Makefile +++ b/sysdeps/unix/sysv/linux/Makefile @@ -92,6 +92,7 @@ sysdep_headers += sys/mount.h sys/acct.h sys/sysctl.h \ bits/termios-baud.h bits/termios-c_cflag.h \ bits/termios-c_lflag.h bits/termios-tcflow.h \ bits/termios-misc.h \ + bits/semid_ds_t.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..5c2f6be4c3 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/semid_ds_t.h b/sysdeps/unix/sysv/linux/bits/semid_ds_t.h new file mode 100644 index 0000000000..baed55ca8b --- /dev/null +++ b/sysdeps/unix/sysv/linux/bits/semid_ds_t.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; +};