lkml.org 
[lkml]   [2007]   [Jul]   [31]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: which signal is sent to freeze process?
Hi!

> >Can you generate small testcase that demonstrates the problem?
> >
> >> Then what would be the correct way to handle resume process. The other
> >> way of course is to make all the applications check the errno in case of
> >> failure. But that seems more more problematic then system call checking.
> >> What do you say?
> >
> >Hmm, does that testcase behave correctly over SIGSTOP/SIGCONT? I'm not
> >saying kernel behaves nicely here, but perhaps fixing the apps to
> >check errno properly is the right thing to do? :-)
> Perhaps the kernel should use ERESTARTNOHAND instead of EINTR?
> The current code is more than odd:
> - select() and sys_ppoll() both use ERESTARTNOHAND (i.e.:
> the functions do not return to user space with SIGSTOP/SIGCONT or freezer())
>
> - sys_poll() uses EINTR (i.e.: SIGSTOP/SIGCONT/freezer() return to user
> space)
>
> Attached is a patch that switches sys_poll to ERESTARTNOHAND and a poll
> test app.
> Boot tested with FC6.
>
> What do you think? With ERESTARTNOHAND, poll would only return to user
> space if the app has a SIGCONT handler installed.

I think the patch looks okay... but I expected some discussoin here
and it did not happen :-(. Can you try to send it to andrew?

> --- 2.6/fs/select.c 2007-05-20 09:52:32.000000000 +0200
> +++ build-2.6/fs/select.c 2007-07-23 22:10:21.000000000 +0200
> @@ -723,7 +723,7 @@
> }
> err = fdcount;
> if (!fdcount && signal_pending(current))
> - err = -EINTR;
> + err = -ERESTARTNOHAND;
> out_fds:
> walk = head;
> while(walk!=NULL) {
> @@ -794,7 +794,7 @@
> ret = do_sys_poll(ufds, nfds, &timeout);
>
> /* We can restart this syscall, usually */
> - if (ret == -EINTR) {
> + if (ret == -ERESTARTNOHAND) {
> /*
> * Don't restore the signal mask yet. Let do_signal() deliver
> * the signal on the way back to userspace, before the signal
> @@ -805,7 +805,6 @@
> sizeof(sigsaved));
> set_thread_flag(TIF_RESTORE_SIGMASK);
> }
> - ret = -ERESTARTNOHAND;
> } else if (sigmask)
> sigprocmask(SIG_SETMASK, &sigsaved, NULL);
>

--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
-
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: 2007-07-31 09:59    [W:0.062 / U:0.072 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site