Skip to contentSkip to conversation

LTP testing: msgctl/IPC_STAT

PATCH Johannes Stezenbach 3 participants 4 messages Jul 19, 2002 – Jul 22, 2002 MIPS

lore
Share & tools
lore
#0 lore raw

I was investigating LTP test suite failures of the msgctl01, msgctl02, msgsnd01 and msgsnd02 tests. It seems that they are caused by a mismatch between /usr/include/bits/msq.h and linux/include/asm-mips/msgbuf.h.

I suggest the following patch which makes mips' msgbuf.h a copy of the one in include/asm-i386.

Johannes

Index: linux/include/asm-mips/msgbuf.h
===================================================================
RCS file: /cvs/linux/include/asm-mips/msgbuf.h,v retrieving revision 1.1

include/asm-mips/msgbuf.h +8 -4
diff -u -r1.1 msgbuf.h
@@ -2,26 +2,30 @@
 #define _ASM_MSGBUF_H
 
 /* 
- * The msqid64_ds structure for alpha architecture.
+ * The msqid64_ds structure for mips architecture.
  * Note extra padding because this structure is passed back and forth
  * between kernel and user space.
  *
  * Pad space is left for:
- * - 2 miscellaneous 64-bit values
+ * - 64-bit time_t to solve y2038 problem
+ * - 2 miscellaneous 32-bit values
  */
 
 struct msqid64_ds {
 	struct ipc64_perm msg_perm;
 	__kernel_time_t msg_stime;	/* last msgsnd time */
+	unsigned long	__unused1;
 	__kernel_time_t msg_rtime;	/* last msgrcv time */
+	unsigned long	__unused2;
 	__kernel_time_t msg_ctime;	/* last change time */
+	unsigned long	__unused3;
 	unsigned long  msg_cbytes;	/* current number of bytes on queue */
 	unsigned long  msg_qnum;	/* number of messages in queue */
 	unsigned long  msg_qbytes;	/* max number of bytes on queue */
 	__kernel_pid_t msg_lspid;	/* pid of last msgsnd */
 	__kernel_pid_t msg_lrpid;	/* last receive pid */
-	unsigned long  __unused1;
-	unsigned long  __unused2;
+	unsigned long  __unused4;
+	unsigned long  __unused5;
 };
 
 #endif /* _ASM_MSGBUF_H */
#1 lore raw
Quoted 8 lines · Johannes Stezenbach

I was investigating LTP test suite failures of the msgctl01, msgctl02, msgsnd01 and msgsnd02 tests. It seems that they are caused by a mismatch between /usr/include/bits/msq.h and linux/include/asm-mips/msgbuf.h.

I suggest the following patch which makes mips' msgbuf.h a copy of the one in include/asm-i386.

I prefer we fix glibc. Here is a patch.

H.J.

2002-07-19 H.J. Lu <[email protected]>

* sysdeps/unix/sysv/linux/mips/bits/msq.h: New.

unix/sysv/linux/mips/bits/msq.h renamed from unix/sysv/linux/mips/bits/msq.h.mips +74 -0
@@ -0,0 +1,74 @@
+/* Copyright (C) 2002 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#ifndef _SYS_MSG_H
+# error "Never use <bits/msq.h> directly; include <sys/msg.h> instead."
+#endif
+
+#include <bits/types.h>
+
+/* Define options for message queue functions.  */
+#define MSG_NOERROR	010000	/* no error if message is too big */
+#ifdef __USE_GNU
+# define MSG_EXCEPT	020000	/* recv any msg except of specified type */
+#endif
+
+/* Types used in the structure definition.  */
+typedef unsigned long int msgqnum_t;
+typedef unsigned long int msglen_t;
+
+
+/* Structure of record for one message inside the kernel.
+   The type `struct msg' is opaque.  */
+struct msqid_ds
+{
+  struct ipc_perm msg_perm;	/* structure describing operation permission */
+  __time_t msg_stime;		/* time of last msgsnd command */
+  __time_t msg_rtime;		/* time of last msgrcv command */
+  __time_t msg_ctime;		/* time of last change */
+  unsigned long int __msg_cbytes; /* current number of bytes on queue */
+  msgqnum_t msg_qnum;		/* number of messages currently on queue */
+  msglen_t msg_qbytes;		/* max number of bytes allowed on queue */
+  __pid_t msg_lspid;		/* pid of last msgsnd() */
+  __pid_t msg_lrpid;		/* pid of last msgrcv() */
+  unsigned long int __unused1;
+  unsigned long int __unused2;
+};
+
+#ifdef __USE_MISC
+
+# define msg_cbytes	__msg_cbytes
+
+/* ipcs ctl commands */
+# define MSG_STAT 11
+# define MSG_INFO 12
+
+/* buffer for msgctl calls IPC_INFO, MSG_INFO */
+struct msginfo
+  {
+    int msgpool;
+    int msgmap;
+    int msgmax;
+    int msgmnb;
+    int msgmni;
+    int msgssz;
+    int msgtql;
+    unsigned short int msgseg;
+  };
+
+#endif /* __USE_MISC */
#2 lore raw
Quoted 6 lines · H. J. Lu
Quoted 5 lines · Johannes Stezenbach

I was investigating LTP test suite failures of the msgctl01, msgctl02, msgsnd01 and msgsnd02 tests. It seems that they are caused by a mismatch between /usr/include/bits/msq.h and linux/include/asm-mips/msgbuf.h.

Quoted 6 lines
Quoted 3 lines

I suggest the following patch which makes mips' msgbuf.h a copy of the one in include/asm-i386.

I prefer we fix glibc. Here is a patch.

Ok, so it's being fixed in glibc. Ralf please ignore my previous mail.

Quoted 7 lines

H.J.

------------------------------------------------------------------------

glibc-mips-msg.patchName: glibc-mips-msg.patch
Type: Plain Text (text/plain)

--

_    _ ____  ___   Carsten Langgaard   Mailto:[email protected]
|\  /|||___)(___   MIPS Denmark        Direct: +45 4486 5527
| \/ |||    ____)  Lautrupvang 4B      Switch: +45 4486 5555
  TECHNOLOGIES     2750 Ballerup       Fax...: +45 4486 5556
                   Denmark             http://www.mips.com
#3 lore raw
In reply to Johannes Stezenbach

I also send this patch a week ago. Ralf could you please applied it. If there is any objection against changing this structure in the kernel, then we need a glibc fix instead.

/Carsten

Quoted 42 lines · Johannes Stezenbach

I was investigating LTP test suite failures of the msgctl01, msgctl02, msgsnd01 and msgsnd02 tests. It seems that they are caused by a mismatch between /usr/include/bits/msq.h and linux/include/asm-mips/msgbuf.h.

I suggest the following patch which makes mips' msgbuf.h a copy of the one in include/asm-i386.

Johannes

Index: linux/include/asm-mips/msgbuf.h
===================================================================
RCS file: /cvs/linux/include/asm-mips/msgbuf.h,v retrieving revision 1.1
diff -u -r1.1 msgbuf.h

include/asm-mips/msgbuf.h 2002/07/19 14:20:29 renamed from include/asm-mips/msgbuf.h 2000/02/16 01:07:48 1.1 +6 -2
@@ -2,26 +2,30 @@
 #define _ASM_MSGBUF_H
 
 /*
- * The msqid64_ds structure for alpha architecture.
+ * The msqid64_ds structure for mips architecture.
  * Note extra padding because this structure is passed back and forth
  * between kernel and user space.
  *
  * Pad space is left for:
- * - 2 miscellaneous 64-bit values
+ * - 64-bit time_t to solve y2038 problem
+ * - 2 miscellaneous 32-bit values
  */
 
 struct msqid64_ds {
        struct ipc64_perm msg_perm;
        __kernel_time_t msg_stime;      /* last msgsnd time */
+       unsigned long   __unused1;
        __kernel_time_t msg_rtime;      /* last msgrcv time */
+       unsigned long   __unused2;
        __kernel_time_t msg_ctime;      /* last change time */
+       unsigned long   __unused3;
        unsigned long  msg_cbytes;      /* current number of bytes on queue */
        unsigned long  msg_qnum;        /* number of messages in queue */

include/asm-mips/msgbuf.h 2002/07/19 14:20:29 line 31

Quoted 10 lines
include/asm-mips/msgbuf.h 2002/07/19 14:20:29 renamed from include/asm-mips/msgbuf.h 2000/02/16 01:07:48 1.1 +2 -2
        unsigned long  msg_qbytes;      /* max number of bytes on queue */
        __kernel_pid_t msg_lspid;       /* pid of last msgsnd */
        __kernel_pid_t msg_lrpid;       /* last receive pid */
-       unsigned long  __unused1;
-       unsigned long  __unused2;
+       unsigned long  __unused4;
+       unsigned long  __unused5;
 };
 
 #endif /* _ASM_MSGBUF_H */

--

_    _ ____  ___   Carsten Langgaard   Mailto:[email protected]
|\  /|||___)(___   MIPS Denmark        Direct: +45 4486 5527
| \/ |||    ____)  Lautrupvang 4B      Switch: +45 4486 5555
  TECHNOLOGIES     2750 Ballerup       Fax...: +45 4486 5556
                   Denmark             http://www.mips.com