Date: Sun, 10 Feb 2008 12:23:54 +0200 From: =?utf-8?B?Q2loYW4gS8O2bWXDp2/En2x1?= <cihan@enderunix.org> To: freebsd-hackers@freebsd.org Subject: abort? Message-ID: <1623050662.20080210122354@enderunix.org>
next in thread | raw e-mail | index | archive | help
Hello list
I cant understand why kill function is called two times to send
sigabort signal. One signal to send is enough, isn't it?
Thanks
void
abort(void) /* POSIX-style abort() function */
{
sigset_t mask;
struct sigaction action;
/*
* Caller can't ignore SIGABRT, if so reset to default.
*/
sigaction(SIGABRT, NULL, &action);
if (action.sa_handler =3D=3D SIG_IGN) {
action.sa_handler =3D SIG_DFL;
sigaction(SIGABRT, &action, NULL);
}
if (action.sa_handler =3D=3D SIG_DFL)
fflush(NULL); /* flush all open stdio streams */
/*
* Caller can't block SIGABRT; make sure it's unblocked.
*/
sigfillset(&mask);
sigdelset(&mask, SIGABRT); /* mask has only SIGABRT turned off */
sigprocmask(SIG_SETMASK, &mask, NULL);
kill(getpid(), SIGABRT); /* send the signal */
/*
* If we're here, process caught SIGABRT and returned.
*/
fflush(NULL); /* flush all open stdio streams */
action.sa_handler =3D SIG_DFL;
sigaction(SIGABRT, &action, NULL); /* reset to default */
sigprocmask(SIG_SETMASK, &mask, NULL); /* just in case ... */
kill(getpid(), SIGABRT); /* and one more time */
exit(1); /* this should never be executed ... */
}
=20
--=20
Cihan K=F6me=E7o=F0lu,
EnderUNIX SDT mailto:cihan@enderunix.org
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1623050662.20080210122354>
