Make threaded programs die correctly:
kill(getpid(), SIGFOO) -> raise(SIGFOO)
This commit is contained in:
parent
1f73905f59
commit
c984f259af
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: stack_protector.c,v 1.2 2008/06/03 19:22:37 ad Exp $ */
|
||||
/* $NetBSD: stack_protector.c,v 1.3 2009/01/30 23:21:02 ad Exp $ */
|
||||
/* $OpenBSD: stack_protector.c,v 1.10 2006/03/31 05:34:44 deraadt Exp $ */
|
||||
|
||||
/*
|
||||
@ -28,7 +28,7 @@
|
||||
*
|
||||
*/
|
||||
#include <sys/cdefs.h>
|
||||
__RCSID("$NetBSD: stack_protector.c,v 1.2 2008/06/03 19:22:37 ad Exp $");
|
||||
__RCSID("$NetBSD: stack_protector.c,v 1.3 2009/01/30 23:21:02 ad Exp $");
|
||||
|
||||
#ifdef _LIBC
|
||||
#include "namespace.h"
|
||||
@ -105,7 +105,7 @@ __fail(const char *msg)
|
||||
sa.sa_flags = 0;
|
||||
sa.sa_handler = SIG_DFL;
|
||||
(void)sigaction(SIGABRT, &sa, NULL);
|
||||
(void)kill(getpid(), SIGABRT);
|
||||
(void)raise(SIGABRT);
|
||||
_exit(127);
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: abort.c,v 1.12 2003/08/07 16:43:37 agc Exp $ */
|
||||
/* $NetBSD: abort.c,v 1.13 2009/01/30 23:21:03 ad Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1985, 1993
|
||||
@ -34,7 +34,7 @@
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)abort.c 8.1 (Berkeley) 6/4/93";
|
||||
#else
|
||||
__RCSID("$NetBSD: abort.c,v 1.12 2003/08/07 16:43:37 agc Exp $");
|
||||
__RCSID("$NetBSD: abort.c,v 1.13 2009/01/30 23:21:03 ad Exp $");
|
||||
#endif
|
||||
#endif /* LIBC_SCCS and not lint */
|
||||
|
||||
@ -71,7 +71,7 @@ abort()
|
||||
(*__cleanup)();
|
||||
}
|
||||
|
||||
(void)kill(getpid(), SIGABRT);
|
||||
(void)raise(SIGABRT);
|
||||
|
||||
/*
|
||||
* if SIGABRT ignored, or caught and the handler returns, do
|
||||
@ -79,6 +79,6 @@ abort()
|
||||
*/
|
||||
(void)signal(SIGABRT, SIG_DFL);
|
||||
(void)sigprocmask(SIG_SETMASK, &mask, (sigset_t *)NULL);
|
||||
(void)kill(getpid(), SIGABRT);
|
||||
(void)raise(SIGABRT);
|
||||
_exit(1);
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
/* $NetBSD: thread-stub.c,v 1.20 2008/04/28 20:23:01 martin Exp $ */
|
||||
/* $NetBSD: thread-stub.c,v 1.21 2009/01/30 23:21:03 ad Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2003 The NetBSD Foundation, Inc.
|
||||
* Copyright (c) 2003, 2009 The NetBSD Foundation, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to The NetBSD Foundation
|
||||
@ -31,7 +31,7 @@
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#if defined(LIBC_SCCS) && !defined(lint)
|
||||
__RCSID("$NetBSD: thread-stub.c,v 1.20 2008/04/28 20:23:01 martin Exp $");
|
||||
__RCSID("$NetBSD: thread-stub.c,v 1.21 2009/01/30 23:21:03 ad Exp $");
|
||||
#endif /* LIBC_SCCS and not lint */
|
||||
|
||||
/*
|
||||
@ -53,7 +53,7 @@ __RCSID("$NetBSD: thread-stub.c,v 1.20 2008/04/28 20:23:01 martin Exp $");
|
||||
|
||||
extern int __isthreaded;
|
||||
|
||||
#define DIE() (void)kill(getpid(), SIGABRT)
|
||||
#define DIE() (void)raise(SIGABRT)
|
||||
|
||||
#define CHECK_NOT_THREADED_ALWAYS() \
|
||||
do { \
|
||||
|
Loading…
Reference in New Issue
Block a user