diff mbox series

[4/5] ipc: Refactor sysvipc compat type

Message ID 20190516151249.19029-4-adhemerval.zanella@linaro.org
State New
Headers show
Series [1/5] sysvipc: Fix compat msgctl | expand

Commit Message

Adhemerval Zanella May 16, 2019, 3:12 p.m. UTC
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

-- 
2.17.1
diff mbox series

Patch

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.  */
-};