unofficial mirror of libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Adhemerval Zanella <adhemerval.zanella@linaro.org>
To: libc-alpha@sourceware.org
Subject: [PATCH 4/5] ipc: Refactor sysvipc compat type
Date: Thu, 16 May 2019 12:12:48 -0300	[thread overview]
Message-ID: <20190516151249.19029-4-adhemerval.zanella@linaro.org> (raw)
In-Reply-To: <20190516151249.19029-1-adhemerval.zanella@linaro.org>

This patch removes some duplicated definition from sysvipc compat code.
The idea is to make it simple to enable the new wireup sysvipc on Linux
v5.1 for some 32 bits ABIs.

There is no semantic change expected on any port.  Checked with a build
against all affected ABIs.

	* sysdeps/unix/sysv/linux/ipc_priv.h (__OLD_IPC_ID_TYPE,
	__OLD_IPC_MODE_TYPE, __OLD_IPC_SEQ_TYPE): Define.
	(__old_ipc_perm): Use the new defines.
	* sysdeps/unix/sysv/linux/alpha/ipc_priv.h (__OLD_IPC_ID_TYPE,
	__OLD_IPC_MODE_TYPE, __OLD_IPC_SEQ_TYPE): Define.
	(__old_ipc_perm): Remove definition.
	* sysdeps/unix/sysv/linux/mips/mips64/ipc_priv.h (__OLD_IPC_ID_TYPE,
	__OLD_IPC_MODE_TYPE, __OLD_IPC_SEQ_TYPE): Define.
	(__old_ipc_perm): Remove definition.
	* sysdeps/unix/sysv/linux/powerpc/ipc_priv.h (__OLD_IPC_ID_TYPE,
	__OLD_IPC_MODE_TYPE, __OLD_IPC_SEQ_TYPE): Define.
	(__old_ipc_perm, SEMCTL_ARG_ADDRESS, MSGRCV_ARGS): Remove definitions.
	* sysdeps/unix/sysv/linux/sparc/sparc64/ipc_priv.h (__OLD_IPC_ID_TYPE,
	__OLD_IPC_MODE_TYPE, __OLD_IPC_SEQ_TYPE): Define.
	(__old_ipc_perm): Remove definition.
	* sysdeps/unix/sysv/linux/x86_64/ipc_priv.h: Remove file.
---
 sysdeps/unix/sysv/linux/alpha/ipc_priv.h      | 16 +++-------
 sysdeps/unix/sysv/linux/ipc_priv.h            | 27 +++++++++++++----
 .../unix/sysv/linux/mips/mips64/ipc_priv.h    | 16 +++-------
 sysdeps/unix/sysv/linux/powerpc/ipc_priv.h    | 23 +++-----------
 .../unix/sysv/linux/sparc/sparc64/ipc_priv.h  | 18 ++++-------
 sysdeps/unix/sysv/linux/x86_64/ipc_priv.h     | 30 -------------------
 6 files changed, 39 insertions(+), 91 deletions(-)
 delete mode 100644 sysdeps/unix/sysv/linux/x86_64/ipc_priv.h

diff --git a/sysdeps/unix/sysv/linux/alpha/ipc_priv.h b/sysdeps/unix/sysv/linux/alpha/ipc_priv.h
index 8b91e2f9fa..fa79bddcf3 100644
--- a/sysdeps/unix/sysv/linux/alpha/ipc_priv.h
+++ b/sysdeps/unix/sysv/linux/alpha/ipc_priv.h
@@ -16,15 +16,7 @@
    License along with the GNU C Library; if not, see
    <http://www.gnu.org/licenses/>.  */
 
-#include <sys/ipc.h>  /* For __key_t  */
-
-struct __old_ipc_perm
-{
-  __key_t __key;		/* Key.  */
-  unsigned int uid;		/* Owner's user ID.  */
-  unsigned int gid;		/* Owner's group ID.  */
-  unsigned int cuid;		/* Creator's user ID.  */
-  unsigned int cgid;		/* Creator's group ID.  */
-  unsigned int mode;		/* Read/write permission.  */
-  unsigned short int __seq;	/* Sequence number.  */
-};
+#define __OLD_IPC_ID_TYPE   unsigned int
+#define __OLD_IPC_MODE_TYPE unsigned int
+#define __OLD_IPC_SEQ_TYPE  unsigned short int
+#include <sysdeps/unix/sysv/linux/ipc_priv.h>
diff --git a/sysdeps/unix/sysv/linux/ipc_priv.h b/sysdeps/unix/sysv/linux/ipc_priv.h
index 49018c1b28..1f9583d42a 100644
--- a/sysdeps/unix/sysv/linux/ipc_priv.h
+++ b/sysdeps/unix/sysv/linux/ipc_priv.h
@@ -16,17 +16,30 @@
    License along with the GNU C Library; if not, see
    <http://www.gnu.org/licenses/>.  */
 
+#ifndef _IPC_PRIV_H
+#define _IPC_PRIV_H
+
 #include <sys/ipc.h>  /* For __key_t  */
 
+#ifndef __OLD_IPC_ID_TYPE
+# define __OLD_IPC_ID_TYPE unsigned short int
+#endif
+#ifndef __OLD_IPC_MODE_TYPE
+# define __OLD_IPC_MODE_TYPE unsigned short int
+#endif
+#ifndef __OLD_IPC_SEQ_TYPE
+# define __OLD_IPC_SEQ_TYPE unsigned short int
+#endif
+
 struct __old_ipc_perm
 {
   __key_t __key;			/* Key.  */
-  unsigned short int uid;		/* Owner's user ID.  */
-  unsigned short int gid;		/* Owner's group ID.  */
-  unsigned short int cuid;		/* Creator's user ID.  */
-  unsigned short int cgid;		/* Creator's group ID.  */
-  unsigned short int mode;		/* Read/write permission.  */
-  unsigned short int __seq;		/* Sequence number.  */
+  __OLD_IPC_ID_TYPE uid;		/* Owner's user ID.  */
+  __OLD_IPC_ID_TYPE gid;		/* Owner's group ID.  */
+  __OLD_IPC_ID_TYPE cuid;		/* Creator's user ID.  */
+  __OLD_IPC_ID_TYPE cgid;		/* Creator's group ID.  */
+  __OLD_IPC_MODE_TYPE mode;		/* Read/write permission.  */
+  __OLD_IPC_SEQ_TYPE __seq;		/* Sequence number.  */
 };
 
 #define SEMCTL_ARG_ADDRESS(__arg) &__arg.array
@@ -38,3 +51,5 @@ struct __old_ipc_perm
   (__nsops), 0, (__sops), (__timeout)
 
 #include <ipc_ops.h>
+
+#endif /* _IPC_PRIV_H  */
diff --git a/sysdeps/unix/sysv/linux/mips/mips64/ipc_priv.h b/sysdeps/unix/sysv/linux/mips/mips64/ipc_priv.h
index ab5db79e25..682ec35662 100644
--- a/sysdeps/unix/sysv/linux/mips/mips64/ipc_priv.h
+++ b/sysdeps/unix/sysv/linux/mips/mips64/ipc_priv.h
@@ -16,15 +16,7 @@
    License along with the GNU C Library; if not, see
    <http://www.gnu.org/licenses/>.  */
 
-#include <sys/ipc.h>
-
-struct __old_ipc_perm
-{
-  __key_t __key;		/* Key.  */
-  int uid;			/* Owner's user ID.  */
-  int gid;			/* Owner's group ID.  */
-  int cuid;			/* Creator's user ID.  */
-  int cgid;			/* Creator's group ID.  */
-  int mode;			/* Read/write permission.  */
-  unsigned short int __seq;	/* Sequence number.  */
-};
+#define __OLD_IPC_ID_TYPE    int
+#define __OLD_IPC_MODE_TYPE  int
+#define __OLD_IPC_SEQ_TYPE   unsigned short int
+#include <sysdeps/unix/sysv/linux/ipc_priv.h>
diff --git a/sysdeps/unix/sysv/linux/powerpc/ipc_priv.h b/sysdeps/unix/sysv/linux/powerpc/ipc_priv.h
index 1c480ac0dd..f641ed9a32 100644
--- a/sysdeps/unix/sysv/linux/powerpc/ipc_priv.h
+++ b/sysdeps/unix/sysv/linux/powerpc/ipc_priv.h
@@ -16,22 +16,7 @@
    License along with the GNU C Library; if not, see
    <http://www.gnu.org/licenses/>.  */
 
-#include <sys/ipc.h>  /* For __key_t  */
-
-struct __old_ipc_perm
-{
-  __key_t __key;			/* Key.  */
-  unsigned int uid;			/* Owner's user ID.  */
-  unsigned int gid;			/* Owner's group ID.  */
-  unsigned int cuid;			/* Creator's user ID.  */
-  unsigned int cgid;			/* Creator's group ID.  */
-  unsigned int mode;			/* Read/write permission.  */
-  unsigned short int __seq;		/* Sequence number.  */
-};
-
-#define SEMCTL_ARG_ADDRESS(__arg) &__arg.array
-
-#define MSGRCV_ARGS(__msgp, __msgtyp) \
-  ((long int []){ (long int) __msgp, __msgtyp })
-
-#include <ipc_ops.h>
+#define __OLD_IPC_ID_TYPE    unsigned int
+#define __OLD_IPC_MODE_TYPE  unsigned int
+#define __OLD_IPC_SEQ_TYPE   unsigned short int
+#include <sysdeps/unix/sysv/linux/ipc_priv.h>
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/ipc_priv.h b/sysdeps/unix/sysv/linux/sparc/sparc64/ipc_priv.h
index 685c25439b..3d813fe9e6 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc64/ipc_priv.h
+++ b/sysdeps/unix/sysv/linux/sparc/sparc64/ipc_priv.h
@@ -16,24 +16,18 @@
    License along with the GNU C Library; if not, see
    <http://www.gnu.org/licenses/>.  */
 
-#include <sys/ipc.h>  /* For __key_t  */
-
-struct __old_ipc_perm
-{
-  __key_t __key;		/* Key.  */
-  unsigned int uid;		/* Owner's user ID.  */
-  unsigned int gid;		/* Owner's group ID.  */
-  unsigned int cuid;		/* Creator's user ID.  */
-  unsigned int cgid;		/* Creator's group ID.  */
-  unsigned int mode;		/* Read/write permission.  */
-  unsigned short int __seq;	/* Sequence number.  */
-};
+#define __OLD_IPC_ID_TYPE   unsigned int
+#define __OLD_IPC_MODE_TYPE unsigned int
+#define __OLD_IPC_SEQ_TYPE  unsigned short int
+#include <sysdeps/unix/sysv/linux/ipc_priv.h>
 
 /* SPARC semctl multiplex syscall expects the union pointed address, not
    the union address itself.  */
+#undef SEMCTL_ARG_ADDRESS
 #define SEMCTL_ARG_ADDRESS(__arg) __arg.array
 
 /* Also for msgrcv it does not use the kludge on final 2 arguments.  */
+#undef MSGRCV_ARGS
 #define MSGRCV_ARGS(__msgp, __msgtyp) __msgp, __msgtyp
 
 #include <ipc_ops.h>
diff --git a/sysdeps/unix/sysv/linux/x86_64/ipc_priv.h b/sysdeps/unix/sysv/linux/x86_64/ipc_priv.h
deleted file mode 100644
index ab44949e6d..0000000000
--- a/sysdeps/unix/sysv/linux/x86_64/ipc_priv.h
+++ /dev/null
@@ -1,30 +0,0 @@
-/* Old SysV permission definition for Linux.  x86_64 version.
-   Copyright (C) 2016-2019 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
-   <http://www.gnu.org/licenses/>.  */
-
-#include <sys/ipc.h>  /* For __key_t  */
-
-struct __old_ipc_perm
-{
-  __key_t __key;		/* Key.  */
-  unsigned short uid;		/* Owner's user ID.  */
-  unsigned short gid;		/* Owner's group ID.  */
-  unsigned short cuid;		/* Creator's user ID.  */
-  unsigned short cgid;		/* Creator's group ID.  */
-  unsigned short mode;		/* Read/write permission.  */
-  unsigned short int __seq;	/* Sequence number.  */
-};
-- 
2.17.1


  parent reply	other threads:[~2019-05-16 15:13 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-16 15:12 [PATCH 1/5] sysvipc: Fix compat msgctl Adhemerval Zanella
2019-05-16 15:12 ` [PATCH 2/5] sysvipc: Move __IPC_64 to kernel-features.h Adhemerval Zanella
2019-05-16 15:38   ` Andreas Schwab
2019-05-16 18:57     ` Adhemerval Zanella
2019-05-20  7:42       ` Andreas Schwab
2019-05-20 11:53         ` Adhemerval Zanella
2019-05-20 12:20           ` Andreas Schwab
2019-05-20 12:30             ` Adhemerval Zanella
2019-05-20 12:38               ` Adhemerval Zanella
2019-05-16 15:12 ` [PATCH 3/5] sysvipc: Consolidate semtimedop s390 Adhemerval Zanella
2019-05-16 15:41   ` Florian Weimer
2019-05-16 19:09     ` Adhemerval Zanella
2019-05-17  9:13       ` Florian Weimer
2019-05-17 12:30         ` Adhemerval Zanella
2019-05-17 12:44           ` Florian Weimer
2019-05-17 19:09           ` Arnd Bergmann
2019-05-20 13:29             ` Adhemerval Zanella
2019-05-16 15:12 ` Adhemerval Zanella [this message]
2019-05-16 15:12 ` [PATCH 5/5] Update sysvipc kernel-features.h files for Linux 5.1 Adhemerval Zanella
2019-05-17 21:00   ` Stepan Golosunov
2019-05-20 12:31     ` Adhemerval Zanella
2019-05-16 15:36 ` [PATCH 1/5] sysvipc: Fix compat msgctl Florian Weimer
2019-05-16 19:06   ` Adhemerval Zanella

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

  List information: https://www.gnu.org/software/libc/involved.html

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

  git send-email \
    --in-reply-to=20190516151249.19029-4-adhemerval.zanella@linaro.org \
    --to=adhemerval.zanella@linaro.org \
    --cc=libc-alpha@sourceware.org \
    /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).