* [PATCH] MIPS/Linux: Kernel vs libc struct siginfo discrepancy
@ 2004-11-10 17:18 Maciej W. Rozycki
2004-11-10 18:00 ` Thiemo Seufer
2004-11-11 1:47 ` Ralf Baechle
0 siblings, 2 replies; 7+ messages in thread
From: Maciej W. Rozycki @ 2004-11-10 17:18 UTC (permalink / raw)
To: Ralf Baechle, linux-mips, libc-alpha; +Cc: Nigel Stephens, Maciej W. Rozycki
Hello,
Since the following change:
http://www.linux-mips.org/cvsweb/linux/include/asm-mips/siginfo.h.diff?r1=1.4&r2=1.5&only_with_tag=MAIN
dated back to Aug 1999 (!), the definitions of struct siginfo in Linux and
GNU libc differ to each other. While it's the kernel that is at fault by
changing its ABI, at this stage it may be more acceptable to update glibc
as it's not the only program interfacing to Linux (uClibc?). It doesn't
seem to be a heavily used feature as otherwise someone else would have
noticed the problem during these five years. As I don't really have a
preference, hereby I provide two patches to choose from and ask for
voting. The ChangeLog entry is for glibc, of course.
2004-11-10 Maciej W. Rozycki <macro@linux-mips.org>
* sysdeps/unix/sysv/linux/mips/bits/siginfo.h [struct siginfo]
(_sigchld): Update to match the kernel.
Maciej
glibc-2.3.3-20041018-mips-siginfo_sigchld-1.patch
diff -up --recursive --new-file glibc-2.3.3-20041018.macro/sysdeps/unix/sysv/linux/bits/siginfo.h glibc-2.3.3-20041018/sysdeps/unix/sysv/linux/bits/siginfo.h
--- glibc-2.3.3-20041018.macro/sysdeps/unix/sysv/linux/bits/siginfo.h Tue Apr 22 02:26:04 2003
+++ glibc-2.3.3-20041018/sysdeps/unix/sysv/linux/bits/siginfo.h Wed Nov 10 16:52:24 2004
@@ -1,5 +1,5 @@
/* siginfo_t, sigevent and constants. Linux version.
- Copyright (C) 1997-2002, 2003 Free Software Foundation, Inc.
+ Copyright (C) 1997-2002, 2003, 2004 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
@@ -87,8 +87,8 @@ typedef struct siginfo
{
__pid_t si_pid; /* Which child. */
__uid_t si_uid; /* Real user ID of sending process. */
- int si_status; /* Exit value or signal. */
__clock_t si_utime;
+ int si_status; /* Exit value or signal. */
__clock_t si_stime;
} _sigchld;
patch-malta-2.6.9-rc1-20041020-mips-siginfo_sigchld-0
diff -up --recursive --new-file linux-malta-2.6.9-rc1-20041020.macro/include/asm-mips/siginfo.h linux-malta-2.6.9-rc1-20041020/include/asm-mips/siginfo.h
--- linux-malta-2.6.9-rc1-20041020.macro/include/asm-mips/siginfo.h 2004-10-01 14:49:33.000000000 +0000
+++ linux-malta-2.6.9-rc1-20041020/include/asm-mips/siginfo.h 2004-11-10 16:53:42.000000000 +0000
@@ -47,8 +47,8 @@ typedef struct siginfo {
struct {
pid_t _pid; /* which child */
uid_t _uid; /* sender's uid */
- clock_t _utime;
int _status; /* exit code */
+ clock_t _utime;
clock_t _stime;
} _sigchld;
^ permalink raw reply [flat|nested] 7+ messages in thread* Re: [PATCH] MIPS/Linux: Kernel vs libc struct siginfo discrepancy 2004-11-10 17:18 [PATCH] MIPS/Linux: Kernel vs libc struct siginfo discrepancy Maciej W. Rozycki @ 2004-11-10 18:00 ` Thiemo Seufer 2004-11-10 18:19 ` Maciej W. Rozycki 2004-11-15 17:50 ` Maciej W. Rozycki 2004-11-11 1:47 ` Ralf Baechle 1 sibling, 2 replies; 7+ messages in thread From: Thiemo Seufer @ 2004-11-10 18:00 UTC (permalink / raw) To: Maciej W. Rozycki; +Cc: Ralf Baechle, linux-mips, libc-alpha, Nigel Stephens Maciej W. Rozycki wrote: > Hello, > > Since the following change: > > http://www.linux-mips.org/cvsweb/linux/include/asm-mips/siginfo.h.diff?r1=1.4&r2=1.5&only_with_tag=MAIN > > dated back to Aug 1999 (!), the definitions of struct siginfo in Linux and > GNU libc differ to each other. Only 2.4 Kernels, 2.6 uses the normal definition again. > While it's the kernel that is at fault by > changing its ABI, at this stage it may be more acceptable to update glibc > as it's not the only program interfacing to Linux (uClibc?). It doesn't > seem to be a heavily used feature as otherwise someone else would have > noticed the problem during these five years. As I don't really have a > preference, hereby I provide two patches to choose from and ask for > voting. I prefer to bring the 2.4 kernel in line with the rest of the system. > The ChangeLog entry is for glibc, of course. > > 2004-11-10 Maciej W. Rozycki <macro@linux-mips.org> > > * sysdeps/unix/sysv/linux/mips/bits/siginfo.h [struct siginfo] > (_sigchld): Update to match the kernel. > > Maciej > > glibc-2.3.3-20041018-mips-siginfo_sigchld-1.patch > diff -up --recursive --new-file glibc-2.3.3-20041018.macro/sysdeps/unix/sysv/linux/bits/siginfo.h glibc-2.3.3-20041018/sysdeps/unix/sysv/linux/bits/siginfo.h > --- glibc-2.3.3-20041018.macro/sysdeps/unix/sysv/linux/bits/siginfo.h Tue Apr 22 02:26:04 2003 > +++ glibc-2.3.3-20041018/sysdeps/unix/sysv/linux/bits/siginfo.h Wed Nov 10 16:52:24 2004 You surely meant to change the mips-specific siginfo.h here. ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] MIPS/Linux: Kernel vs libc struct siginfo discrepancy 2004-11-10 18:00 ` Thiemo Seufer @ 2004-11-10 18:19 ` Maciej W. Rozycki 2004-11-11 1:56 ` Ralf Baechle 2004-11-15 17:50 ` Maciej W. Rozycki 1 sibling, 1 reply; 7+ messages in thread From: Maciej W. Rozycki @ 2004-11-10 18:19 UTC (permalink / raw) To: Thiemo Seufer Cc: Ralf Baechle, linux-mips, libc-alpha, Nigel Stephens, Maciej W. Rozycki On Wed, 10 Nov 2004, Thiemo Seufer wrote: > > Since the following change: > > > > http://www.linux-mips.org/cvsweb/linux/include/asm-mips/siginfo.h.diff?r1=1.4&r2=1.5&only_with_tag=MAIN > > > > dated back to Aug 1999 (!), the definitions of struct siginfo in Linux and > > GNU libc differ to each other. > > Only 2.4 Kernels, 2.6 uses the normal definition again. Ah, it's been changed again for 2.6.9-rc3 without a word of a comment, grrr... > > While it's the kernel that is at fault by > > changing its ABI, at this stage it may be more acceptable to update glibc > > as it's not the only program interfacing to Linux (uClibc?). It doesn't > > seem to be a heavily used feature as otherwise someone else would have > > noticed the problem during these five years. As I don't really have a > > preference, hereby I provide two patches to choose from and ask for > > voting. > > I prefer to bring the 2.4 kernel in line with the rest of the system. OK for me. > You surely meant to change the mips-specific siginfo.h here. Thanks for spotting it. Here's an update just in case. Maciej glibc-2.3.3-20041018-mips-siginfo_sigchld-2.patch diff -up --recursive --new-file glibc-2.3.3-20041018.macro/sysdeps/unix/sysv/linux/mips/bits/siginfo.h glibc-2.3.3-20041018/sysdeps/unix/sysv/linux/mips/bits/siginfo.h --- glibc-2.3.3-20041018.macro/sysdeps/unix/sysv/linux/mips/bits/siginfo.h Fri May 23 02:26:20 2003 +++ glibc-2.3.3-20041018/sysdeps/unix/sysv/linux/mips/bits/siginfo.h Wed Nov 10 18:06:51 2004 @@ -65,8 +65,8 @@ typedef struct siginfo { __pid_t si_pid; /* Which child. */ __uid_t si_uid; /* Real user ID of sending process. */ - int si_status; /* Exit value or signal. */ __clock_t si_utime; + int si_status; /* Exit value or signal. */ __clock_t si_stime; } _sigchld; ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] MIPS/Linux: Kernel vs libc struct siginfo discrepancy 2004-11-10 18:19 ` Maciej W. Rozycki @ 2004-11-11 1:56 ` Ralf Baechle 0 siblings, 0 replies; 7+ messages in thread From: Ralf Baechle @ 2004-11-11 1:56 UTC (permalink / raw) To: Maciej W. Rozycki Cc: Thiemo Seufer, linux-mips, libc-alpha, Nigel Stephens, Maciej W. Rozycki On Wed, Nov 10, 2004 at 06:19:14PM +0000, Maciej W. Rozycki wrote: > > > http://www.linux-mips.org/cvsweb/linux/include/asm-mips/siginfo.h.diff?r1=1.4&r2=1.5&only_with_tag=MAIN > > > > > > dated back to Aug 1999 (!), the definitions of struct siginfo in Linux and > > > GNU libc differ to each other. > > > > Only 2.4 Kernels, 2.6 uses the normal definition again. > > Ah, it's been changed again for 2.6.9-rc3 without a word of a comment, > grrr... Yoichi Yuasa sent this patch upstream without notifying anybody. GRRRR also. Ralf ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] MIPS/Linux: Kernel vs libc struct siginfo discrepancy 2004-11-10 18:00 ` Thiemo Seufer 2004-11-10 18:19 ` Maciej W. Rozycki @ 2004-11-15 17:50 ` Maciej W. Rozycki 1 sibling, 0 replies; 7+ messages in thread From: Maciej W. Rozycki @ 2004-11-15 17:50 UTC (permalink / raw) To: libc-alpha, Thiemo Seufer; +Cc: Ralf Baechle, linux-mips, Nigel Stephens On Wed, 10 Nov 2004, Thiemo Seufer wrote: > I prefer to bring the 2.4 kernel in line with the rest of the system. This is what is now in effect (Ralf, thanks for looking into it) and all that is left to be done is to fix padding done in glibc as this is incorrect for 64-bit MIPS. Here is a patch based on the current Linux <asm-mips/siginfo.h> header and sysdeps/unix/sysv/linux/bits/siginfo.h. It seems to work for me for the mips-linux host. 2004-11-15 Maciej W. Rozycki <macro@mips.com> * sysdeps/unix/sysv/linux/mips/bits/siginfo.h (__SI_MAX_SIZE): Define appropriately based on __WORDSIZE. [struct siginfo] (__pad0): Add for explicit padding. * sysdeps/unix/sysv/linux/mips/bits/siginfo.h: Formatting fixes throughout. Please apply. Maciej glibc-2.3.3-20041018-mips-siginfo-pad-3.patch diff -up --recursive --new-file glibc-2.3.3-20041018.macro/sysdeps/unix/sysv/linux/mips/bits/siginfo.h glibc-2.3.3-20041018/sysdeps/unix/sysv/linux/mips/bits/siginfo.h --- glibc-2.3.3-20041018.macro/sysdeps/unix/sysv/linux/mips/bits/siginfo.h Fri May 23 02:26:20 2003 +++ glibc-2.3.3-20041018/sysdeps/unix/sysv/linux/mips/bits/siginfo.h Mon Nov 15 15:44:49 2004 @@ -1,5 +1,6 @@ /* siginfo_t, sigevent and constants. Linux/MIPS version. - Copyright (C) 1997, 1998, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. + Copyright (C) 1997, 1998, 2000, 2001, 2002, 2003, 2004 + 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 @@ -22,6 +23,8 @@ # error "Never include this file directly. Use <signal.h> instead" #endif +#include <bits/wordsize.h> + #if (!defined __have_sigval_t \ && (defined _SIGNAL_H || defined __need_siginfo_t \ || defined __need_sigevent_t)) @@ -39,8 +42,13 @@ typedef union sigval && (defined _SIGNAL_H || defined __need_siginfo_t)) # define __have_siginfo_t 1 -# define __SI_MAX_SIZE 128 -# define __SI_PAD_SIZE ((__SI_MAX_SIZE / sizeof (int)) - 3) +# define __SI_MAX_SIZE 128 +# if __WORDSIZE == 64 +# define __SI_PAD_SIZE ((__SI_MAX_SIZE / sizeof (int)) - 4) +# else +# define __SI_PAD_SIZE ((__SI_MAX_SIZE / sizeof (int)) - 3) +# endif + typedef struct siginfo { @@ -48,6 +56,8 @@ typedef struct siginfo int si_code; /* Signal code. */ int si_errno; /* If non-zero, an errno value associated with this signal, as defined in <errno.h>. */ + int __pad0[__SI_MAX_SIZE / sizeof (int) - __SI_PAD_SIZE - 3]; + /* Explicit padding. */ union { @@ -121,9 +131,9 @@ enum { SI_ASYNCNL = -60, /* Sent by asynch name lookup completion. */ # define SI_ASYNCNL SI_ASYNCNL - SI_TKILL = -6, /* Sent by tkill. */ + SI_TKILL = -6, /* Sent by tkill. */ # define SI_TKILL SI_TKILL - SI_SIGIO, /* Sent by queued SIGIO. */ + SI_SIGIO, /* Sent by queued SIGIO. */ # define SI_SIGIO SI_SIGIO SI_MESGQ, /* Sent by real time mesq state change. */ # define SI_MESGQ SI_MESGQ @@ -149,7 +159,7 @@ enum # define ILL_ILLOPN ILL_ILLOPN ILL_ILLADR, /* Illegal addressing mode. */ # define ILL_ILLADR ILL_ILLADR - ILL_ILLTRP, /* Illegal trap. */ + ILL_ILLTRP, /* Illegal trap. */ # define ILL_ILLTRP ILL_ILLTRP ILL_PRVOPC, /* Privileged opcode. */ # define ILL_PRVOPC ILL_PRVOPC ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] MIPS/Linux: Kernel vs libc struct siginfo discrepancy 2004-11-10 17:18 [PATCH] MIPS/Linux: Kernel vs libc struct siginfo discrepancy Maciej W. Rozycki 2004-11-10 18:00 ` Thiemo Seufer @ 2004-11-11 1:47 ` Ralf Baechle 2004-11-11 2:39 ` Maciej W. Rozycki 1 sibling, 1 reply; 7+ messages in thread From: Ralf Baechle @ 2004-11-11 1:47 UTC (permalink / raw) To: Maciej W. Rozycki Cc: linux-mips, libc-alpha, Nigel Stephens, Maciej W. Rozycki On Wed, Nov 10, 2004 at 05:18:02PM +0000, Maciej W. Rozycki wrote: > http://www.linux-mips.org/cvsweb/linux/include/asm-mips/siginfo.h.diff?r1=1.4&r2=1.5&only_with_tag=MAIN > > dated back to Aug 1999 (!), the definitions of struct siginfo in Linux and > GNU libc differ to each other. While it's the kernel that is at fault by > changing its ABI, at this stage it may be more acceptable to update glibc > as it's not the only program interfacing to Linux (uClibc?). It doesn't uClibc copies it's headers from glibc it seems. The change in 1999 was quite intensional because back then there was no SA_SIGINFO using libc for MIPS yet. Ralf ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] MIPS/Linux: Kernel vs libc struct siginfo discrepancy 2004-11-11 1:47 ` Ralf Baechle @ 2004-11-11 2:39 ` Maciej W. Rozycki 0 siblings, 0 replies; 7+ messages in thread From: Maciej W. Rozycki @ 2004-11-11 2:39 UTC (permalink / raw) To: Ralf Baechle; +Cc: Maciej W. Rozycki, linux-mips, libc-alpha, Nigel Stephens On Thu, 11 Nov 2004, Ralf Baechle wrote: > > dated back to Aug 1999 (!), the definitions of struct siginfo in Linux and > > GNU libc differ to each other. While it's the kernel that is at fault by > > changing its ABI, at this stage it may be more acceptable to update glibc > > as it's not the only program interfacing to Linux (uClibc?). It doesn't > > uClibc copies it's headers from glibc it seems. The change in 1999 was > quite intensional because back then there was no SA_SIGINFO using libc for > MIPS yet. Well, I'm afraid the glibc's header dates back to Jan 1999, so it predates the change to Linux and this is why it uses the original definition. Of course I know what the relationship between MIPS/Linux and glibc was back then and problems like this prove this wasn't the best idea ever. They are the very reason I insist on pushing changes upstream as soon as possible. Otherwise fixes get forgotten or lost as patches for old versions get discarded. This change should have made its way to glibc at the time of the change to Linux. Maciej ^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2004-11-15 17:51 UTC | newest] Thread overview: 7+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2004-11-10 17:18 [PATCH] MIPS/Linux: Kernel vs libc struct siginfo discrepancy Maciej W. Rozycki 2004-11-10 18:00 ` Thiemo Seufer 2004-11-10 18:19 ` Maciej W. Rozycki 2004-11-11 1:56 ` Ralf Baechle 2004-11-15 17:50 ` Maciej W. Rozycki 2004-11-11 1:47 ` Ralf Baechle 2004-11-11 2:39 ` Maciej W. Rozycki
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox