From patchwork Tue Jun 30 19:24:39 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella Netto X-Patchwork-Id: 39846 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id B44C53858D37; Tue, 30 Jun 2020 19:24:57 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B44C53858D37 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1593545097; bh=sW1k7Cc9xdkSMZcwWbazlfkjFSzIs/5eO4lQt9oi2so=; 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=l56ObtqMdPZYrqa1UlQE8LIfQGcmlC8SHd3CYeuv15quOphqz7x7/m8X76pLJBAq7 4AMlMmNbYV8lRVP4v16LTtQcGUZiCz0lrmWOXol6AqI3Uev0mw0S3Kvd55QeazuO4J iOqa1mYqgPkoEAyQKvTDGYo1WdFyV/8EeQFGsg4s= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-qt1-x82f.google.com (mail-qt1-x82f.google.com [IPv6:2607:f8b0:4864:20::82f]) by sourceware.org (Postfix) with ESMTPS id F1E9E3858D35 for ; Tue, 30 Jun 2020 19:24:53 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org F1E9E3858D35 Received: by mail-qt1-x82f.google.com with SMTP id d27so16523711qtg.4 for ; Tue, 30 Jun 2020 12:24:53 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=sW1k7Cc9xdkSMZcwWbazlfkjFSzIs/5eO4lQt9oi2so=; b=poyIapgF380MxtsDcq3/nD+9XX8RSieAQ1q/n4DPkC564+EUwiT9ldvQwBMbVT/0nh dklyRciVoHGtTAAefxwmw0drD1Nxm0bGhW9nRnXNbLu73LFQNWkhMawAbJrFhidHmDtc F/bOnXcNAL0Q9W8CwfOojOY9XOTN8DwmbdMSr/HcjOZ3NZEIuipcDi4a5Kj4Gtw2XV1I hRJ0pnlNyrmWA9Yl7/dR94t/4U2llSLVxgVqyFVrxuCQjaDvru8PAAIqeevowgdXdM49 0ZpCAJv3QDNStOK0jq6+zMQV1bDoUOb0EOJ3b77sYk7afJFg0JeRqQ9sJal51f3TzURQ V/gg== X-Gm-Message-State: AOAM530sebYRQPGonF5WeSpTzrZXrwlX62W7y5dloKfKy3fQ/+bkE4oQ oAFJ5QTvQk3G789vzloLIxg1RoCG3bI= X-Google-Smtp-Source: ABdhPJzBfefg0xhBGR1aoF1eUobHy0dPMSVswvqaIcToNZG5gWCALPlwDJxuniBCLSSBq4PgR9JI7w== X-Received: by 2002:ac8:1ac4:: with SMTP id h4mr23164866qtk.249.1593545093271; Tue, 30 Jun 2020 12:24:53 -0700 (PDT) Received: from localhost.localdomain ([177.194.48.209]) by smtp.googlemail.com with ESMTPSA id b7sm3558214qkl.18.2020.06.30.12.24.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Jun 2020 12:24:52 -0700 (PDT) To: libc-alpha@sourceware.org Subject: [PATCH 5/7] sysvipc: Split out linux struct shmid_ds Date: Tue, 30 Jun 2020 16:24:39 -0300 Message-Id: <20200630192441.3299710-5-adhemerval.zanella@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200630192441.3299710-1-adhemerval.zanella@linaro.org> References: <20200630192441.3299710-1-adhemerval.zanella@linaro.org> MIME-Version: 1.0 X-Spam-Status: No, score=-14.6 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_SHORT, RCVD_IN_DNSWL_NONE, 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: Adhemerval Zanella via Libc-alpha From: Adhemerval Zanella Netto Reply-To: Adhemerval Zanella Cc: stepan@golosunov.pp.ru, Alistair Francis Errors-To: libc-alpha-bounces@sourceware.org Sender: "Libc-alpha" This will allow us to have architectures specify their own version. Not semantic changes expected. Checked with a build against the all affected ABIs. Reviewed-by: Alistair Francis Tested-by: Carlos O'Donell Reviewed-by: Carlos O'Donell --- sysdeps/unix/sysv/linux/Makefile | 1 + sysdeps/unix/sysv/linux/bits/shm.h | 34 +---------- .../sysv/linux/bits/types/struct_shmid_ds.h | 57 +++++++++++++++++++ 3 files changed, 59 insertions(+), 33 deletions(-) create mode 100644 sysdeps/unix/sysv/linux/bits/types/struct_shmid_ds.h diff --git a/sysdeps/unix/sysv/linux/Makefile b/sysdeps/unix/sysv/linux/Makefile index 505087e617..bdd187af73 100644 --- a/sysdeps/unix/sysv/linux/Makefile +++ b/sysdeps/unix/sysv/linux/Makefile @@ -93,6 +93,7 @@ sysdep_headers += sys/mount.h sys/acct.h \ bits/termios-misc.h \ bits/types/struct_semid_ds.h \ bits/types/struct_msqid_ds.h \ + bits/types/struct_shmid_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/shm.h b/sysdeps/unix/sysv/linux/bits/shm.h index 113c05ee89..9ef6aeaf92 100644 --- a/sysdeps/unix/sysv/linux/bits/shm.h +++ b/sysdeps/unix/sysv/linux/bits/shm.h @@ -43,39 +43,7 @@ __BEGIN_DECLS /* Type to count number of attaches. */ typedef __syscall_ulong_t shmatt_t; -#if __SHM_PAD_BEFORE_TIME -# define __SHM_PAD_TIME(NAME, RES) \ - unsigned long int __glibc_reserved ## RES; __time_t NAME -#elif __SHM_PAD_AFTER_TIME -# define __SHM_PAD_TIME(NAME, RES) \ - __time_t NAME; unsigned long int __glibc_reserved ## RES -#else -# define __SHM_PAD_TIME(NAME, RES) \ - __time_t NAME -#endif - -/* Data structure describing a shared memory segment. */ -struct shmid_ds - { - struct ipc_perm shm_perm; /* operation permission struct */ -#if !__SHM_SEGSZ_AFTER_TIME - size_t shm_segsz; /* size of segment in bytes */ -#endif - __SHM_PAD_TIME (shm_atime, 1); /* time of last shmat() */ - __SHM_PAD_TIME (shm_dtime, 2); /* time of last shmdt() */ - __SHM_PAD_TIME (shm_ctime, 3); /* time of last change by shmctl() */ -#if __SHM_PAD_BETWEEN_TIME_AND_SEGSZ - unsigned long int __glibc_reserved4; -#endif -#if __SHM_SEGSZ_AFTER_TIME - size_t shm_segsz; /* size of segment in bytes */ -#endif - __pid_t shm_cpid; /* pid of creator */ - __pid_t shm_lpid; /* pid of last shmop */ - shmatt_t shm_nattch; /* number of current attaches */ - __syscall_ulong_t __glibc_reserved5; - __syscall_ulong_t __glibc_reserved6; - }; +#include #ifdef __USE_MISC diff --git a/sysdeps/unix/sysv/linux/bits/types/struct_shmid_ds.h b/sysdeps/unix/sysv/linux/bits/types/struct_shmid_ds.h new file mode 100644 index 0000000000..938bbedfcd --- /dev/null +++ b/sysdeps/unix/sysv/linux/bits/types/struct_shmid_ds.h @@ -0,0 +1,57 @@ +/* Generic implementation of the shared memory struct shmid_ds. + Copyright (C) 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_SHM_H +# error "Never include directly; use instead." +#endif + +#include + +#if __SHM_PAD_BEFORE_TIME +# define __SHM_PAD_TIME(NAME, RES) \ + unsigned long int __glibc_reserved ## RES; __time_t NAME +#elif __SHM_PAD_AFTER_TIME +# define __SHM_PAD_TIME(NAME, RES) \ + __time_t NAME; unsigned long int __glibc_reserved ## RES +#else +# define __SHM_PAD_TIME(NAME, RES) \ + __time_t NAME +#endif + +/* Data structure describing a shared memory segment. */ +struct shmid_ds + { + struct ipc_perm shm_perm; /* operation permission struct */ +#if !__SHM_SEGSZ_AFTER_TIME + size_t shm_segsz; /* size of segment in bytes */ +#endif + __SHM_PAD_TIME (shm_atime, 1); /* time of last shmat() */ + __SHM_PAD_TIME (shm_dtime, 2); /* time of last shmdt() */ + __SHM_PAD_TIME (shm_ctime, 3); /* time of last change by shmctl() */ +#if __SHM_PAD_BETWEEN_TIME_AND_SEGSZ + unsigned long int __glibc_reserved4; +#endif +#if __SHM_SEGSZ_AFTER_TIME + size_t shm_segsz; /* size of segment in bytes */ +#endif + __pid_t shm_cpid; /* pid of creator */ + __pid_t shm_lpid; /* pid of last shmop */ + shmatt_t shm_nattch; /* number of current attaches */ + __syscall_ulong_t __glibc_reserved5; + __syscall_ulong_t __glibc_reserved6; + };