[PATCH, REPOST, MIPS] Fix struct msqid_ds to match the kernel definition

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

[PATCH, REPOST, MIPS] Fix struct msqid_ds to match the kernel definition

Thiemo Seufer
Hello All,

the appended patch fixes the layout of msqid_ds on Linux/MIPS and
brings it in sync with the kernel side implementations. This patch
was originally posted to libc-alpha three years ago
http://sourceware.org/ml/libc-alpha/2003-10/msg00047.html.

The patch is in general use in Linux/MIPS distributions, namely
Debian and Gentoo.


Thiemo


Index: sysdeps/unix/sysv/linux/mips/bits/msq.h
===================================================================
RCS file: /cvs/glibc/libc/sysdeps/unix/sysv/linux/mips/bits/msq.h,v
retrieving revision 1.1
diff -a -d -u -p -r1.1 msq.h
--- sysdeps/unix/sysv/linux/mips/bits/msq.h 26 Aug 2002 01:49:55 -0000 1.1
+++ sysdeps/unix/sysv/linux/mips/bits/msq.h 7 Oct 2003 18:30:30 -0000
@@ -38,16 +38,34 @@ 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 int __unused1;
+#endif
   __time_t msg_stime; /* time of last msgsnd command */
+#if __WORDSIZE == 32 && defined (__MIPSEL__)
+  unsigned long int __unused1;
+#endif
+#if __WORDSIZE == 32 && defined (__MIPSEB__)
+  unsigned long int __unused2;
+#endif
   __time_t msg_rtime; /* time of last msgrcv command */
+#if __WORDSIZE == 32 && defined (__MIPSEL__)
+  unsigned long int __unused2;
+#endif
+#if __WORDSIZE == 32 && defined (__MIPSEB__)
+  unsigned long int __unused3;
+#endif
   __time_t msg_ctime; /* time of last change */
+#if __WORDSIZE == 32 && defined (__MIPSEL__)
+  unsigned long int __unused3;
+#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 */
   __pid_t msg_lspid; /* pid of last msgsnd() */
   __pid_t msg_lrpid; /* pid of last msgrcv() */
-  unsigned long int __unused1;
-  unsigned long int __unused2;
+  unsigned long int __unused4;
+  unsigned long int __unused5;
 };
 
 #ifdef __USE_MISC
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH, REPOST, MIPS] Fix struct msqid_ds to match the kernel definition

Daniel Jacobowitz-2
On Tue, Nov 07, 2006 at 02:44:28PM +0000, Thiemo Seufer wrote:
> Hello All,
>
> the appended patch fixes the layout of msqid_ds on Linux/MIPS and
> brings it in sync with the kernel side implementations. This patch
> was originally posted to libc-alpha three years ago
> http://sourceware.org/ml/libc-alpha/2003-10/msg00047.html.
>
> The patch is in general use in Linux/MIPS distributions, namely
> Debian and Gentoo.

Sorry, I haven't gotten to glibc since you posted this.  I checked it
in.

On Thu, Jan 04, 2007 at 05:43:46PM -0800, Kaz Kylheku wrote:
> I don't see anything in the bits/msg.h definition of struct msqid_ds
> that would take care of 32 versus 64 issues. Shouldn't there be
> conditionally defined padding after the three __time_t members? For some
> other architectures like x86_64, the padding is there.

It's a little trickier than that.  It was already wrong for o32.  I
think Thiemo's patch that I just committed fixes it.  If it doesn't,
let me know.

> Also, the n32 system call just routes the system call directly to
> sys_msgctl, where there is no wrapper that would set the IPC_64 flag. If
> you don't have that, then the IPC_OLD version is assumed: i.e. that you
> have the old obsolete version of the structure which contains a next and
> previous pointer.

Should n32 use the glibc wrappers that o32 uses?

--
Daniel Jacobowitz
CodeSourcery