* [PATCH] salinfo_decode silent exit in older 2.4s
@ 2005-04-08 21:23 dann frazier
2005-04-10 23:58 ` Keith Owens
` (6 more replies)
0 siblings, 7 replies; 8+ messages in thread
From: dann frazier @ 2005-04-08 21:23 UTC (permalink / raw)
To: linux-ia64
[-- Attachment #1: Type: text/plain, Size: 1020 bytes --]
I was playing with salinfo_decode on an older kernel (2.4.21 era) and it
would normally die silently right after exec.
This no longer happens because of a semantic difference that occurred in
later 2.4 kernels. Older 2.4s would return -EINTR when they wanted
userspace to try again, while current 2.4s use -ERESTARTSYS. (The
surrounding code is also somewhat different, but it looks like the idea
is the same).
If salinfo_decode detects an EINTR, it will silently exit the main loop.
This patch corrects the problem for me on older kernels, and should have
no effect for current kernels. Hopefully this is what the author
originally intended.
Signed-off-by: dann frazier <dannf@hp.com>
--- salinfo-0.7.orig/salinfo_decode.c Tue Oct 5 09:23:33 2004
+++ salinfo-0.7/salinfo_decode.c Fri Apr 8 15:06:40 2005
@@ -235,7 +235,7 @@
char filename[PATH_MAX];
if (read(fd_event, text, sizeof(text)) <= 0) {
if (errno == EINTR)
- ret = 0;
+ continue;
else
perror(event_filename);
goto out;
[-- Attachment #2: salinfo.patch --]
[-- Type: text/x-patch, Size: 324 bytes --]
--- salinfo-0.7.orig/salinfo_decode.c Tue Oct 5 09:23:33 2004
+++ salinfo-0.7/salinfo_decode.c Fri Apr 8 15:06:40 2005
@@ -235,7 +235,7 @@
char filename[PATH_MAX];
if (read(fd_event, text, sizeof(text)) <= 0) {
if (errno == EINTR)
- ret = 0;
+ continue;
else
perror(event_filename);
goto out;
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] salinfo_decode silent exit in older 2.4s
2005-04-08 21:23 [PATCH] salinfo_decode silent exit in older 2.4s dann frazier
@ 2005-04-10 23:58 ` Keith Owens
2005-04-11 21:03 ` dann frazier
` (5 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: Keith Owens @ 2005-04-10 23:58 UTC (permalink / raw)
To: linux-ia64
On Fri, 08 Apr 2005 15:23:43 -0600,
dann frazier <dannf@hp.com> wrote:
>I was playing with salinfo_decode on an older kernel (2.4.21 era) and it
>would normally die silently right after exec.
>
>This no longer happens because of a semantic difference that occurred in
>later 2.4 kernels. Older 2.4s would return -EINTR when they wanted
>userspace to try again, while current 2.4s use -ERESTARTSYS. (The
>surrounding code is also somewhat different, but it looks like the idea
>is the same).
ERESTARTSYS should never be seen by user space code. The kernel should
either restart the current syscall or convert the code to EINTR before
returning to user space. If you are seeing ERESTARTSYS in user space
then it is a kernel bug.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] salinfo_decode silent exit in older 2.4s
2005-04-08 21:23 [PATCH] salinfo_decode silent exit in older 2.4s dann frazier
2005-04-10 23:58 ` Keith Owens
@ 2005-04-11 21:03 ` dann frazier
2005-04-11 23:03 ` Keith Owens
` (4 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: dann frazier @ 2005-04-11 21:03 UTC (permalink / raw)
To: linux-ia64
On Mon, 2005-04-11 at 09:58 +1000, Keith Owens wrote:
> On Fri, 08 Apr 2005 15:23:43 -0600,
> dann frazier <dannf@hp.com> wrote:
> >I was playing with salinfo_decode on an older kernel (2.4.21 era) and it
> >would normally die silently right after exec.
> >
> >This no longer happens because of a semantic difference that occurred in
> >later 2.4 kernels. Older 2.4s would return -EINTR when they wanted
> >userspace to try again, while current 2.4s use -ERESTARTSYS. (The
> >surrounding code is also somewhat different, but it looks like the idea
> >is the same).
>
> ERESTARTSYS should never be seen by user space code. The kernel should
> either restart the current syscall or convert the code to EINTR before
> returning to user space. If you are seeing ERESTARTSYS in user space
> then it is a kernel bug.
Right, that's not the problem I'm seeing. The problem I'm seeing is
that older kernels return -EINTR, which causes salinfo_decode to
silently exit.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] salinfo_decode silent exit in older 2.4s
2005-04-08 21:23 [PATCH] salinfo_decode silent exit in older 2.4s dann frazier
2005-04-10 23:58 ` Keith Owens
2005-04-11 21:03 ` dann frazier
@ 2005-04-11 23:03 ` Keith Owens
2005-04-13 19:51 ` dann frazier
` (3 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: Keith Owens @ 2005-04-11 23:03 UTC (permalink / raw)
To: linux-ia64
On Mon, 11 Apr 2005 15:03:06 -0600,
dann frazier <dannf@hp.com> wrote:
>On Mon, 2005-04-11 at 09:58 +1000, Keith Owens wrote:
>> On Fri, 08 Apr 2005 15:23:43 -0600,
>> dann frazier <dannf@hp.com> wrote:
>> >I was playing with salinfo_decode on an older kernel (2.4.21 era) and it
>> >would normally die silently right after exec.
>> >
>> >This no longer happens because of a semantic difference that occurred in
>> >later 2.4 kernels. Older 2.4s would return -EINTR when they wanted
>> >userspace to try again, while current 2.4s use -ERESTARTSYS. (The
>> >surrounding code is also somewhat different, but it looks like the idea
>> >is the same).
>>
>> ERESTARTSYS should never be seen by user space code. The kernel should
>> either restart the current syscall or convert the code to EINTR before
>> returning to user space. If you are seeing ERESTARTSYS in user space
>> then it is a kernel bug.
>
>Right, that's not the problem I'm seeing. The problem I'm seeing is
>that older kernels return -EINTR, which causes salinfo_decode to
>silently exit.
I coded that exit on the assumption that the only reason salinfo_decode
would get -EINTR is from a signal. salinfo_decode 0.7 does not have
alarms, so the only signal should be from an external event, i.e. when
the user wants to shut it down. Before changing the behaviour, can you
find out why -EINTR is being returned in the first place. IOW, what
event is causing -EINTR to be returned.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] salinfo_decode silent exit in older 2.4s
2005-04-08 21:23 [PATCH] salinfo_decode silent exit in older 2.4s dann frazier
` (2 preceding siblings ...)
2005-04-11 23:03 ` Keith Owens
@ 2005-04-13 19:51 ` dann frazier
2005-04-19 21:51 ` dann frazier
` (2 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: dann frazier @ 2005-04-13 19:51 UTC (permalink / raw)
To: linux-ia64
On Tue, 2005-04-12 at 09:03 +1000, Keith Owens wrote:
> I coded that exit on the assumption that the only reason salinfo_decode
> would get -EINTR is from a signal. salinfo_decode 0.7 does not have
> alarms, so the only signal should be from an external event, i.e. when
> the user wants to shut it down. Before changing the behaviour, can you
> find out why -EINTR is being returned in the first place. IOW, what
> event is causing -EINTR to be returned.
hey Keith,
An strace shows a SIGCHLD, for which a handler is registered.
Apparently this is the salinfo_decode_oem process?
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] salinfo_decode silent exit in older 2.4s
2005-04-08 21:23 [PATCH] salinfo_decode silent exit in older 2.4s dann frazier
` (3 preceding siblings ...)
2005-04-13 19:51 ` dann frazier
@ 2005-04-19 21:51 ` dann frazier
2005-04-20 0:04 ` Keith Owens
2005-04-20 2:14 ` dann frazier
6 siblings, 0 replies; 8+ messages in thread
From: dann frazier @ 2005-04-19 21:51 UTC (permalink / raw)
To: linux-ia64
On Wed, 2005-04-13 at 13:51 -0600, dann frazier wrote:
> On Tue, 2005-04-12 at 09:03 +1000, Keith Owens wrote:
> > I coded that exit on the assumption that the only reason salinfo_decode
> > would get -EINTR is from a signal. salinfo_decode 0.7 does not have
> > alarms, so the only signal should be from an external event, i.e. when
> > the user wants to shut it down. Before changing the behaviour, can you
> > find out why -EINTR is being returned in the first place. IOW, what
> > event is causing -EINTR to be returned.
>
> hey Keith,
> An strace shows a SIGCHLD, for which a handler is registered.
> Apparently this is the salinfo_decode_oem process?
hey Keith,
Did this reply answer your question, or do you need more information
from me? It seems SIGCHLD is the corner case. Does exit(0) make sense
for other signals?
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] salinfo_decode silent exit in older 2.4s
2005-04-08 21:23 [PATCH] salinfo_decode silent exit in older 2.4s dann frazier
` (4 preceding siblings ...)
2005-04-19 21:51 ` dann frazier
@ 2005-04-20 0:04 ` Keith Owens
2005-04-20 2:14 ` dann frazier
6 siblings, 0 replies; 8+ messages in thread
From: Keith Owens @ 2005-04-20 0:04 UTC (permalink / raw)
To: linux-ia64
On Tue, 19 Apr 2005 15:51:28 -0600,
dann frazier <dannf@hp.com> wrote:
>On Wed, 2005-04-13 at 13:51 -0600, dann frazier wrote:
>> On Tue, 2005-04-12 at 09:03 +1000, Keith Owens wrote:
>> > I coded that exit on the assumption that the only reason salinfo_decode
>> > would get -EINTR is from a signal. salinfo_decode 0.7 does not have
>> > alarms, so the only signal should be from an external event, i.e. when
>> > the user wants to shut it down. Before changing the behaviour, can you
>> > find out why -EINTR is being returned in the first place. IOW, what
>> > event is causing -EINTR to be returned.
>>
>> hey Keith,
>> An strace shows a SIGCHLD, for which a handler is registered.
>> Apparently this is the salinfo_decode_oem process?
>
>hey Keith,
> Did this reply answer your question, or do you need more information
>from me? It seems SIGCHLD is the corner case. Does exit(0) make sense
>for other signals?
Thanks, you answered my questions. I have a lot of updates queued for
salinfo_decode to make it more resilient, your patch has been included
in that set, which I am stil testing.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] salinfo_decode silent exit in older 2.4s
2005-04-08 21:23 [PATCH] salinfo_decode silent exit in older 2.4s dann frazier
` (5 preceding siblings ...)
2005-04-20 0:04 ` Keith Owens
@ 2005-04-20 2:14 ` dann frazier
6 siblings, 0 replies; 8+ messages in thread
From: dann frazier @ 2005-04-20 2:14 UTC (permalink / raw)
To: linux-ia64
On Wed, 2005-04-20 at 10:04 +1000, Keith Owens wrote:
> On Tue, 19 Apr 2005 15:51:28 -0600,
> dann frazier <dannf@hp.com> wrote:
> >On Wed, 2005-04-13 at 13:51 -0600, dann frazier wrote:
> >> On Tue, 2005-04-12 at 09:03 +1000, Keith Owens wrote:
> >> > I coded that exit on the assumption that the only reason salinfo_decode
> >> > would get -EINTR is from a signal. salinfo_decode 0.7 does not have
> >> > alarms, so the only signal should be from an external event, i.e. when
> >> > the user wants to shut it down. Before changing the behaviour, can you
> >> > find out why -EINTR is being returned in the first place. IOW, what
> >> > event is causing -EINTR to be returned.
> >>
> >> hey Keith,
> >> An strace shows a SIGCHLD, for which a handler is registered.
> >> Apparently this is the salinfo_decode_oem process?
> >
> >hey Keith,
> > Did this reply answer your question, or do you need more information
> >from me? It seems SIGCHLD is the corner case. Does exit(0) make sense
> >for other signals?
>
> Thanks, you answered my questions. I have a lot of updates queued for
> salinfo_decode to make it more resilient, your patch has been included
> in that set, which I am stil testing.
Great - I'll go ahead and add this patch to the Debian salinfo package,
since that's where the problem was reported and where I tested the fix.
I'll resync with your next release when it is available. Thanks.
--
dann frazier <dannf@hp.com>
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2005-04-20 2:14 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-04-08 21:23 [PATCH] salinfo_decode silent exit in older 2.4s dann frazier
2005-04-10 23:58 ` Keith Owens
2005-04-11 21:03 ` dann frazier
2005-04-11 23:03 ` Keith Owens
2005-04-13 19:51 ` dann frazier
2005-04-19 21:51 ` dann frazier
2005-04-20 0:04 ` Keith Owens
2005-04-20 2:14 ` dann frazier
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox