diff options
author | Daniel Eischen <deischen@FreeBSD.org> | 2001-01-24 13:01:12 +0000 |
---|---|---|
committer | Daniel Eischen <deischen@FreeBSD.org> | 2001-01-24 13:01:12 +0000 |
commit | d201fe46e355212750b727061e6a7ac005267852 (patch) | |
tree | d949d903e602687ee53252807dc4281a27c4f0c4 /lib/libc/stdlib | |
parent | e0aa5ab7184d7449e4c2e2e65107898ad23b31f7 (diff) |
Notes
Diffstat (limited to 'lib/libc/stdlib')
-rw-r--r-- | lib/libc/stdlib/abort.c | 33 | ||||
-rw-r--r-- | lib/libc/stdlib/exit.c | 9 | ||||
-rw-r--r-- | lib/libc/stdlib/malloc.c | 2 | ||||
-rw-r--r-- | lib/libc/stdlib/random.c | 2 | ||||
-rw-r--r-- | lib/libc/stdlib/realpath.c | 2 | ||||
-rw-r--r-- | lib/libc/stdlib/system.c | 24 |
6 files changed, 41 insertions, 31 deletions
diff --git a/lib/libc/stdlib/abort.c b/lib/libc/stdlib/abort.c index b6b4be950341..0b85182c9715 100644 --- a/lib/libc/stdlib/abort.c +++ b/lib/libc/stdlib/abort.c @@ -29,6 +29,8 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. + * + * $FreeBSD$ */ #if defined(LIBC_SCCS) && !defined(lint) @@ -39,17 +41,18 @@ static char sccsid[] = "@(#)abort.c 8.1 (Berkeley) 6/4/93"; #include <stdlib.h> #include <stddef.h> #include <unistd.h> -#ifdef _THREAD_SAFE #include <pthread.h> -#include "pthread_private.h" -#endif void (*__cleanup)(); +extern int __sys_sigprocmask(int, const sigset_t *, sigset_t *); +extern int __sys_sigaction(int, const struct sigaction *, + struct sigaction *); + void abort() { - sigset_t mask; + struct sigaction act; /* * POSIX requires we flush stdio buffers on abort @@ -57,29 +60,25 @@ abort() if (__cleanup) (*__cleanup)(); - sigfillset(&mask); + sigfillset(&act.sa_mask); /* * don't block SIGABRT to give any handler a chance; we ignore * any errors -- X311J doesn't allow abort to return anyway. */ - sigdelset(&mask, SIGABRT); -#ifdef _THREAD_SAFE - (void) _thread_sys_sigprocmask(SIG_SETMASK, &mask, (sigset_t *)NULL); -#else - (void)sigprocmask(SIG_SETMASK, &mask, (sigset_t *)NULL); -#endif + sigdelset(&act.sa_mask, SIGABRT); + (void)__sys_sigprocmask(SIG_SETMASK, &act.sa_mask, NULL); (void)kill(getpid(), SIGABRT); /* * if SIGABRT ignored, or caught and the handler returns, do * it again, only harder. */ - (void)signal(SIGABRT, SIG_DFL); -#ifdef _THREAD_SAFE - (void) _thread_sys_sigprocmask(SIG_SETMASK, &mask, (sigset_t *)NULL); -#else - (void)sigprocmask(SIG_SETMASK, &mask, (sigset_t *)NULL); -#endif + act.sa_handler = SIG_DFL; + act.sa_flags = 0; + sigfillset(&act.sa_mask); + (void)__sys_sigaction(SIGABRT, &act, NULL); + sigdelset(&act.sa_mask, SIGABRT); + (void)__sys_sigprocmask(SIG_SETMASK, &act.sa_mask, NULL); (void)kill(getpid(), SIGABRT); exit(1); } diff --git a/lib/libc/stdlib/exit.c b/lib/libc/stdlib/exit.c index b0f6d3a51882..32f51d427302 100644 --- a/lib/libc/stdlib/exit.c +++ b/lib/libc/stdlib/exit.c @@ -29,14 +29,18 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. + * + * $FreeBSD$ */ #if defined(LIBC_SCCS) && !defined(lint) static char sccsid[] = "@(#)exit.c 8.1 (Berkeley) 6/4/93"; #endif /* LIBC_SCCS and not lint */ +#include "namespace.h" #include <stdlib.h> #include <unistd.h> +#include "un-namespace.h" #include "atexit.h" void (*__cleanup)(); @@ -60,11 +64,10 @@ exit(status) register struct atexit *p; register int n; -#ifdef _THREAD_SAFE - extern int _thread_autoinit_dummy_decl; /* Ensure that the auto-initialization routine is linked in: */ + extern int _thread_autoinit_dummy_decl; + _thread_autoinit_dummy_decl = 1; -#endif for (p = __atexit; p; p = p->next) for (n = p->ind; --n >= 0;) diff --git a/lib/libc/stdlib/malloc.c b/lib/libc/stdlib/malloc.c index 91236df211a5..bf6a495063a9 100644 --- a/lib/libc/stdlib/malloc.c +++ b/lib/libc/stdlib/malloc.c @@ -42,6 +42,7 @@ * */ +#include "namespace.h" #if defined(__FreeBSD__) # if defined(__i386__) # define malloc_pageshift 12U @@ -97,6 +98,7 @@ #include <stdlib.h> #include <string.h> #include <unistd.h> +#include "un-namespace.h" /* * This structure describes a page worth of chunks. diff --git a/lib/libc/stdlib/random.c b/lib/libc/stdlib/random.c index e8e82544d99c..a271669f5064 100644 --- a/lib/libc/stdlib/random.c +++ b/lib/libc/stdlib/random.c @@ -38,11 +38,13 @@ static char sccsid[] = "@(#)random.c 8.2 (Berkeley) 5/19/95"; #endif /* LIBC_SCCS and not lint */ +#include "namespace.h" #include <sys/time.h> /* for srandomdev() */ #include <fcntl.h> /* for srandomdev() */ #include <stdio.h> #include <stdlib.h> #include <unistd.h> /* for srandomdev() */ +#include "un-namespace.h" /* * random.c: diff --git a/lib/libc/stdlib/realpath.c b/lib/libc/stdlib/realpath.c index 0217dde5f6a6..2bb8c893b595 100644 --- a/lib/libc/stdlib/realpath.c +++ b/lib/libc/stdlib/realpath.c @@ -40,6 +40,7 @@ static char sccsid[] = "@(#)realpath.c 8.1 (Berkeley) 2/16/94"; #endif /* LIBC_SCCS and not lint */ +#include "namespace.h" #include <sys/param.h> #include <sys/stat.h> @@ -48,6 +49,7 @@ static char sccsid[] = "@(#)realpath.c 8.1 (Berkeley) 2/16/94"; #include <stdlib.h> #include <string.h> #include <unistd.h> +#include "un-namespace.h" /* * char *realpath(const char *path, char resolved_path[MAXPATHLEN]); diff --git a/lib/libc/stdlib/system.c b/lib/libc/stdlib/system.c index c7e68bae69b7..3b1645414069 100644 --- a/lib/libc/stdlib/system.c +++ b/lib/libc/stdlib/system.c @@ -37,6 +37,7 @@ static char sccsid[] = "@(#)system.c 8.1 (Berkeley) 6/4/93"; #endif /* LIBC_SCCS and not lint */ +#include "namespace.h" #include <sys/types.h> #include <sys/wait.h> #include <signal.h> @@ -45,6 +46,8 @@ static char sccsid[] = "@(#)system.c 8.1 (Berkeley) 6/4/93"; #include <unistd.h> #include <paths.h> #include <errno.h> +#include "un-namespace.h" +#include "libc_private.h" int __system(command) @@ -65,11 +68,11 @@ __system(command) ign.sa_handler = SIG_IGN; (void)sigemptyset(&ign.sa_mask); ign.sa_flags = 0; - (void)sigaction(SIGINT, &ign, &intact); - (void)sigaction(SIGQUIT, &ign, &quitact); + (void)_sigaction(SIGINT, &ign, &intact); + (void)_sigaction(SIGQUIT, &ign, &quitact); (void)sigemptyset(&newsigblock); (void)sigaddset(&newsigblock, SIGCHLD); - (void)sigprocmask(SIG_BLOCK, &newsigblock, &oldsigblock); + (void)_sigprocmask(SIG_BLOCK, &newsigblock, &oldsigblock); switch(pid = fork()) { case -1: /* error */ break; @@ -77,9 +80,9 @@ __system(command) /* * Restore original signal dispositions and exec the command. */ - (void)sigaction(SIGINT, &intact, NULL); - (void)sigaction(SIGQUIT, &quitact, NULL); - (void)sigprocmask(SIG_SETMASK, &oldsigblock, NULL); + (void)_sigaction(SIGINT, &intact, NULL); + (void)_sigaction(SIGQUIT, &quitact, NULL); + (void)_sigprocmask(SIG_SETMASK, &oldsigblock, NULL); execl(_PATH_BSHELL, "sh", "-c", command, (char *)NULL); _exit(127); default: /* parent */ @@ -88,12 +91,11 @@ __system(command) } while (pid == -1 && errno == EINTR); break; } - (void)sigaction(SIGINT, &intact, NULL); - (void)sigaction(SIGQUIT, &quitact, NULL); - (void)sigprocmask(SIG_SETMASK, &oldsigblock, NULL); + (void)_sigaction(SIGINT, &intact, NULL); + (void)_sigaction(SIGQUIT, &quitact, NULL); + (void)_sigprocmask(SIG_SETMASK, &oldsigblock, NULL); return(pid == -1 ? -1 : pstat); } -#ifndef _THREAD_SAFE __weak_reference(__system, system); -#endif +__weak_reference(__system, _system); |