Re: Question about Linux signal handling

Albert Cahalan (albert@users.sourceforge.net)
23 Feb 2003 17:29:00 -0500


Tom Sanders writes:

> 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?

That depends on how you set sa_flags. Read the
sigaction man page.

> I remember that in UNIX "signal" system call default
> signal bahavior was to replace the signal handler with
> default after everytime signal was received?

Yes. This is the behavior of all SysV UNIX systems
and Linux kernels. Unfortunately, BSD got it wrong.
Worse, the glibc developers saw fit to ignore both
UNIX history and Linus. They implemented BSD behavior
by making signal() use the sigaction system call
instead of the signal system call. This of course
makes it harder to port apps from SysV UNIX systems
to Linux. Use sigaction() in all new code.

-
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/