Skip to content

Commit

Permalink
VT_WAITACTIVE: Avoid returning EINTR when not necessary
Browse files Browse the repository at this point in the history
We should generally prefer to return ERESTARTNOHAND rather than EINTR,
so that processes with unhandled signals that get ignored don't return
EINTR.

This can help with X startup issues:

    Fatal server error:
    xf86OpenConsole: VT_WAITACTIVE failed: Interrupted system call

although the real fix is having the X server always retry EINTR
regardless (since EINTR does happen for signals that have handlers
installed). Keithp has a patch for that.

Regardless, ERESTARTNOHAND is the correct thing to use.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  • Loading branch information
Linus Torvalds committed Oct 7, 2007
1 parent fc8b28a commit 70cb979
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/char/vt_ioctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -1032,7 +1032,7 @@ static DECLARE_WAIT_QUEUE_HEAD(vt_activate_queue);

/*
* Sleeps until a vt is activated, or the task is interrupted. Returns
* 0 if activation, -EINTR if interrupted.
* 0 if activation, -EINTR if interrupted by a signal handler.
*/
int vt_waitactive(int vt)
{
Expand All @@ -1057,7 +1057,7 @@ int vt_waitactive(int vt)
break;
}
release_console_sem();
retval = -EINTR;
retval = -ERESTARTNOHAND;
if (signal_pending(current))
break;
schedule();
Expand Down

0 comments on commit 70cb979

Please sign in to comment.