lkml.org 
[lkml]   [2005]   [Aug]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
SubjectRe: [ACPI] S3 and sigwait (was Re: 2.6.13-rc3: swsusp works (TP 600X))
From
Date
On Mon, 2005-08-01 at 09:09 +0200, Pavel Machek wrote:
> Hi!
>
> > > If you think it is a linux bug, can you produce small test case doing
> > > just the sigwait, and post it on l-k with big title "sigwait() breaks
> > > when straced, and on suspend"?
> > >
> > > That way it is going to get some attetion, and you'll get either
> > > documentation or kernel fixed.
> > Looks like a linux bug to me. The refrigerator fake signal waked the
> > task up and without restart for the sigwait case. How about below
> > patch:
>
> Is there chance to fix strace case, too? sigwait() is broken in more
> than one way it seems...
This patch should fix two cases. Can anybody familiar with signal
handling look at it?
The posix standard said for sigtimedwait:
"If no signal in set is pending at the time of the call, the calling
thread shall be suspended until one or more signals in set become
pending or until it is interrupted by an unblocked, caught signal."
Systemcall might be restarted if it's not interrupted by a caught
signal.

Thanks,
Shaohua



---

linux-2.6.13-rc4-root/kernel/signal.c | 5 +++--
1 files changed, 3 insertions(+), 2 deletions(-)

diff -puN kernel/signal.c~sigwait-suspend-resume kernel/signal.c
--- linux-2.6.13-rc4/kernel/signal.c~sigwait-suspend-resume 2005-08-02 10:33:16.798179984 +0800
+++ linux-2.6.13-rc4-root/kernel/signal.c 2005-08-02 12:49:06.688208376 +0800
@@ -2231,7 +2231,8 @@ sys_rt_sigtimedwait(const sigset_t __use
current->state = TASK_INTERRUPTIBLE;
timeout = schedule_timeout(timeout);

- try_to_freeze();
+ if (freezing(current))
+ return -ERESTARTNOINTR;
spin_lock_irq(&current->sighand->siglock);
sig = dequeue_signal(current, &these, &info);
current->blocked = current->real_blocked;
@@ -2250,7 +2251,7 @@ sys_rt_sigtimedwait(const sigset_t __use
} else {
ret = -EAGAIN;
if (timeout)
- ret = -EINTR;
+ ret = -ERESTARTNOHAND;
}

return ret;
_


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-08-02 07:21    [W:0.525 / U:0.812 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site