[PATCH 2/2] uapi: Remove struct msgbuf, struct ipc_kludge.

From: Harald van Dijk
Date: Sun Sep 10 2023 - 19:43:25 EST


struct msgbuf is mostly an internal type: msgsnd and msgrcv have always
been documented as taking a pointer to a user-defined type. Any code
that relies on the uapi-defined type can trivially be updated to follow
the documentation and define the type itself.

struct ipc_kludge is a workaround for the limited number of arguments
supported in syscalls, references struct msgbuf, so either needs
updating or also needs removing from uapi. As no libc that I have been
able to find uses it (almost all use an array of long instead, and
dietlibc defines its own struct ipc_kludge without relying on kernel
headers), this commit removes it too from uapi.

Signed-off-by: Harald van Dijk <harald@xxxxxxxxxxx>
---
include/linux/ipc.h | 10 ++++++++++
include/linux/msg.h | 6 ++++++
include/uapi/linux/ipc.h | 10 ----------
include/uapi/linux/msg.h | 6 ------
4 files changed, 16 insertions(+), 16 deletions(-)

diff --git a/include/linux/ipc.h b/include/linux/ipc.h
index e1c9eea6015b5..b2f8e4ff554ec 100644
--- a/include/linux/ipc.h
+++ b/include/linux/ipc.h
@@ -8,6 +8,16 @@
#include <uapi/linux/ipc.h>
#include <linux/refcount.h>
+/*
+ * These are used to wrap system calls.
+ *
+ * See architecture code for ugly details..
+ */
+struct ipc_kludge {
+ struct msgbuf __user *msgp;
+ long msgtyp;
+};
+
/* used by in-kernel data structures */
struct kern_ipc_perm {
spinlock_t lock;
diff --git a/include/linux/msg.h b/include/linux/msg.h
index 9a972a296b953..46836a6291af2 100644
--- a/include/linux/msg.h
+++ b/include/linux/msg.h
@@ -5,6 +5,12 @@
#include <linux/list.h>
#include <uapi/linux/msg.h>
+/* message buffer for msgsnd and msgrcv calls */
+struct msgbuf {
+ long mtype; /* type of message */
+ char mtext[1]; /* message text */
+};
+
/* one msg_msg structure for each message */
struct msg_msg {
struct list_head m_list;
diff --git a/include/uapi/linux/ipc.h b/include/uapi/linux/ipc.h
index 5995fc9d675ea..2c6e543c18fd8 100644
--- a/include/uapi/linux/ipc.h
+++ b/include/uapi/linux/ipc.h
@@ -50,16 +50,6 @@ struct ipc_perm
#define IPC_64 0x0100 /* New version (support 32-bit UIDs, bigger
message sizes, etc. */
-/*
- * These are used to wrap system calls.
- *
- * See architecture code for ugly details..
- */
-struct ipc_kludge {
- struct msgbuf __user *msgp;
- long msgtyp;
-};
-
#define SEMOP 1
#define SEMGET 2
#define SEMCTL 3
diff --git a/include/uapi/linux/msg.h b/include/uapi/linux/msg.h
index 3881c94d48eae..901e2952669e6 100644
--- a/include/uapi/linux/msg.h
+++ b/include/uapi/linux/msg.h
@@ -34,12 +34,6 @@ struct msqid_ds {
/* Include the definition of msqid64_ds */
#include <asm/msgbuf.h>
-/* message buffer for msgsnd and msgrcv calls */
-struct msgbuf {
- long mtype; /* type of message */
- char mtext[1]; /* message text */
-};
-
/* buffer for msgctl calls IPC_INFO, MSG_INFO */
struct msginfo {
int msgpool;
--
2.34.1