public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Adhemerval Zanella <adhemerval.zanella@linaro.org>
To: libc-alpha@sourceware.org
Cc: stepan@golosunov.pp.ru, Alistair Francis <alistair.francis@wdc.com>
Subject: [PATCH 5/7] sysvipc: Split out linux struct shmid_ds
Date: Tue, 30 Jun 2020 16:24:39 -0300	[thread overview]
Message-ID: <20200630192441.3299710-5-adhemerval.zanella@linaro.org> (raw)
In-Reply-To: <20200630192441.3299710-1-adhemerval.zanella@linaro.org>

This will allow us to have architectures specify their own version.

Not semantic changes expected.  Checked with a build against the
all affected ABIs.
---
 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 <bits/types/struct_shmid_ds.h>
 
 #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
+   <https://www.gnu.org/licenses/>.  */
+
+#ifndef _SYS_SHM_H
+# error "Never include <bits/types/struct_shmid_ds.h> directly; use <sys/shm.h> instead."
+#endif
+
+#include <bits/shm-pad.h>
+
+#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;
+  };
-- 
2.25.1


  parent reply	other threads:[~2020-06-30 19:24 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-30 19:24 [PATCH 1/7] sysv: linux: Add 64-bit time_t variant for semctl Adhemerval Zanella
2020-06-30 19:24 ` [PATCH 2/7] sysvipc: Split out linux struct semid_ds Adhemerval Zanella
2020-07-02 21:20   ` Alistair Francis
2020-07-07 19:01   ` Carlos O'Donell
2020-06-30 19:24 ` [PATCH 3/7] sysvipc: Remove the linux msq-pad.h file Adhemerval Zanella
2020-07-02 21:26   ` Alistair Francis
2020-07-07 19:05   ` Carlos O'Donell
2020-06-30 19:24 ` [PATCH 4/7] sysv: linux: Add 64-bit time_t variant for msgctl Adhemerval Zanella
2020-07-02 21:39   ` Alistair Francis
2020-07-08 18:07     ` Adhemerval Zanella
2020-07-07 19:51   ` Carlos O'Donell
2020-07-08 15:32     ` [PATCH v2] " Adhemerval Zanella
2020-07-08 17:04       ` Carlos O'Donell
2020-07-08 17:56       ` Alistair Francis
2020-06-30 19:24 ` Adhemerval Zanella [this message]
2020-07-02 21:40   ` [PATCH 5/7] sysvipc: Split out linux struct shmid_ds Alistair Francis
2020-07-07 19:52   ` Carlos O'Donell
2020-06-30 19:24 ` [PATCH 6/7] sysvipc: Remove the linux shm-pad.h file Adhemerval Zanella
2020-07-07 19:57   ` Carlos O'Donell
2020-06-30 19:24 ` [PATCH 7/7] sysv: linux: Add 64-bit time_t variant for shmctl Adhemerval Zanella
2020-07-01  2:28   ` Alistair Francis
2020-07-01 12:19     ` Adhemerval Zanella
2020-07-01 15:48       ` Alistair Francis
2020-07-01 16:35         ` Adhemerval Zanella
2020-07-01 17:07           ` Adhemerval Zanella
2020-07-01 20:59             ` Vineet Gupta
2020-07-01 23:00             ` Alistair Francis
2020-07-02 21:41               ` Alistair Francis
2020-07-07 21:33   ` Carlos O'Donell
2020-07-08 15:32     ` [PATCH v2] " Adhemerval Zanella
2020-07-08 17:02       ` Carlos O'Donell
2020-07-08 18:01       ` Alistair Francis
2020-07-10 17:13       ` Joseph Myers
2020-07-10 17:49         ` Adhemerval Zanella
2020-07-10 17:57           ` Joseph Myers
2020-07-10 17:59             ` Adhemerval Zanella
2020-07-02 19:01 ` [PATCH 1/7] sysv: linux: Add 64-bit time_t variant for semctl Alistair Francis
2020-07-07  3:32 ` Carlos O'Donell
2020-07-07 14:09   ` Adhemerval Zanella
2020-07-08 15:32     ` [PATCH v2] " Adhemerval Zanella
2020-07-08 17:04       ` Carlos O'Donell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200630192441.3299710-5-adhemerval.zanella@linaro.org \
    --to=adhemerval.zanella@linaro.org \
    --cc=alistair.francis@wdc.com \
    --cc=libc-alpha@sourceware.org \
    --cc=stepan@golosunov.pp.ru \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).