Skip to contentSkip to conversation

sysv ipc msg functions

PATCH Greg Weeks 4 participants 7 messages Apr 19, 2005 MIPS

lore
Share & tools
lore

Greg Weeks

author
#0 lore raw

I needed this glibc patch to get the sysv ipc msgctl functions to work correctly. This looks a bit hackish to me, so I wanted to run it past everybody here before filing it with glibc.

Greg Weeks

sysdeps/unix/sysv/linux/mips/bits/msq.h renamed from sysdeps/unix/sysv/linux/mips/bits/msq.h.orig +18 -0
@@ -38,9 +38,27 @@ typedef unsigned long int msglen_t;
 struct msqid_ds
 {
   struct ipc_perm msg_perm;	/* structure describing operation permission */
+#if __WORDSIZE == 32 && defined(__MIPSEB__)
+   unsigned long	__unused3;
+#endif
   __time_t msg_stime;		/* time of last msgsnd command */
+#if __WORDSIZE == 32 && defined(__MIPSEL__)
+   unsigned long	__unused3;
+#endif
+#if __WORDSIZE == 32 && defined(__MIPSEB__)
+  unsigned long	__unused4;
+#endif
   __time_t msg_rtime;		/* time of last msgrcv command */
+#if __WORDSIZE == 32 && defined(__MIPSEL__)
+  unsigned long	__unused4;
+#endif
+#if __WORDSIZE == 32 && defined(__MIPSEB__)
+  unsigned long	__unused5;
+#endif
   __time_t msg_ctime;		/* time of last change */
+#if __WORDSIZE == 32 && defined(__MIPSEL__)
+  unsigned long	__unused5;
+#endif
   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 */
#1 lore raw

[ Charset ISO-8859-1 unsupported, converting... ]

Quoted 4 lines

I needed this glibc patch to get the sysv ipc msgctl functions to work correctly. This looks a bit hackish to me, so I wanted to run it past everybody here before filing it with glibc.

Perhaps is ignorance on my part, but I thought the compiler would handle the endianness with regards to the structure members. Did you have problems with big and little endian such that you had to do all of the ugly #ifdef'ing?

-Steve

author
#2 lore raw
Quoted 13 lines · [email protected] wrote:

[ Charset ISO-8859-1 unsupported, converting... ]

Quoted 4 lines

I needed this glibc patch to get the sysv ipc msgctl functions to work correctly. This looks a bit hackish to me, so I wanted to run it past everybody here before filing it with glibc.

Perhaps is ignorance on my part, but I thought the compiler would handle the endianness with regards to the structure members. Did you have problems with big and little endian such that you had to do all of the ugly #ifdef'ing?

yes. Take a look at the kernel structure it is mapping to.

in
asm-mips/msgbuf.h

struct msqid64_ds

Greg Weeks

#3 lore raw
In reply to Greg Weeks
Quoted 3 lines · Greg Weeks

I needed this glibc patch to get the sysv ipc msgctl functions to work correctly. This looks a bit hackish to me, so I wanted to run it past everybody here before filing it with glibc.

What's your configuration? Big or little endian, userland ABI, kernel ABI. Glibc version. Kernel version. What specific things don't work. Not even enough information here to make a guess.

You're updating the userspace msqid_ds to match the kernel's msqid64_ds. They're not normally the same type. Rather, see <linux/msg.h> for the type o32 generally uses.

Signature · 2 lines
Daniel Jacobowitz
CodeSourcery, LLC
author
#4 lore raw
Quoted 7 lines · Daniel Jacobowitz
Quoted 3 lines · Greg Weeks

I needed this glibc patch to get the sysv ipc msgctl functions to work correctly. This looks a bit hackish to me, so I wanted to run it past everybody here before filing it with glibc.

Quoted 9 lines

What's your configuration? Big or little endian, userland ABI, kernel
ABI. Glibc version. Kernel version. What specific things don't work. Not even enough information here to make a guess.

You're updating the userspace msqid_ds to match the kernel's msqid64_ds. They're not normally the same type. Rather, see <linux/msg.h> for the type o32 generally uses.

glibc-2.3.3-200407050320
2.6.11.7 kernel but it's the issue is the same on the 2.6.12-rc from cvs. The board is a malta 4kc in LE mode.
If you want to see a failure the LTP msgctl/msgsnd tests fail.

Greg Weeks

#6 lore raw
Quoted 8 lines · Thiemo Seufer
Quoted 3 lines · Greg Weeks

I needed this glibc patch to get the sysv ipc msgctl functions to work correctly. This looks a bit hackish to me, so I wanted to run it past everybody here before filing it with glibc.

The Debian glibc has a similiar patch, see
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=200215&archive=yes
for a discussion.

Last thing I see there was:

Okay, I suggest you send this patch to Uli for libc and I'll prepare a patch for the kernel, will post here later.

Anything ever come of that?

Signature · 2 lines
Daniel Jacobowitz
CodeSourcery, LLC