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: develop--- via Libc-alpha X-Patchwork-Id: 1262153 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=sourceware.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=sourceware.org; envelope-from=libc-alpha-bounces@sourceware.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=sourceware.org Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.a=rsa-sha256 header.s=default header.b=hdAzKCwa; dkim-atps=neutral Received: from sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 48p9pC4P7Nz9sPR for ; Fri, 27 Mar 2020 03:45:23 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 297BB384BC3F; Thu, 26 Mar 2020 16:45:10 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 297BB384BC3F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1585241110; bh=5m17BYVNyNvNCq76LrH7NIV2TbntwhjIvvTe+htYl2A=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=hdAzKCwa0j3pGn2iLdF8FA3LaHor0wyAdPZMi+8k/WvosCv7ljDIXzgqe8cGtxDKv vwSMQvVrhwAcaUAdB2I15fNPjqaBRYvPXXAaeJhzQ5tyxYCYoeX+r+Kdl+Vawmf2Qp ab+hotkxGicRfrP1ZYq8FGaYKmI2dHy8bqGuE0Zs= 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 To: libc-alpha@sourceware.org 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-Patchwork-Original-From: Alistair Francis via Libc-alpha From: develop--- via Libc-alpha Reply-To: Alistair Francis Cc: Vineet.Gupta1@synopsys.com, Alistair Francis Errors-To: libc-alpha-bounces@sourceware.org Sender: "Libc-alpha" 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; +};