[lkml]   [2003]   [Feb]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: Question about Linux signal handling
On Saturday 22 February 2003 22:45, Tom Sanders wrote:
> If I catch a signal (SIGUSR2) using "sigaction" call
> then is the signal handler replaced with default
> handling, if I don't install the signal handler again?
> I remember that in UNIX "signal" system call default
> signal bahavior was to replace the signal handler with
> default after everytime signal was received?
> My observation is that even if I get same signal
> twice, I get the same print (which I have in my signal
> handler) again, illustrating that signal handler was
> not replaced with default !!! Is that the correct
> behavior of "sigaction"?

Depends on the value of sa_flags parameter:

From the manpage SIGACTION(2):

sa_flags specifies a set of flags which modify the
behaviour of the signal handling process. It is formed by
the bitwise OR of zero or more of the following:

If signum is SIGCHLD, do not receive notifi-
cation when child processes stop (i.e., when
child processes receive one of SIGSTOP,

Restore the signal action to the default
state once the signal handler has been
called. (This is the default behavior of
the signal(2) system call.)

Provide behaviour compatible with BSD signal
semantics by making certain system calls
restartable across signals.

Do not prevent the signal from being
received from within its own signal handler.

The signal handler takes 3 arguments, not
one. In this case, sa_sigaction should be
set instead of sa_handler. (The sa_sigac-
tion field was added in Linux 2.1.86.)

You are describing SA_ONESHOT as what you think you should

I believe you are getting the correct result. With the ONESHOT option
you can/will loose signals, since the handler would be set back to the
default, and any subsequent signal lost. This loss of signals is one of the
original complaints about UNIX signal handling.

Now my manpage continues with the warning:

The POSIX spec only defines SA_NOCLDSTOP. Use of other
sa_flags is non-portable.


POSIX, SVr4. SVr4 does not document the EINTR condition.
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at

 \ /
  Last update: 2005-03-22 13:33    [W:0.047 / U:1.072 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site