diff options
| author | d <> | 1998-11-20 11:18:51 +0000 |
|---|---|---|
| committer | d <> | 1998-11-20 11:18:51 +0000 |
| commit | c1f295aa8666eb1c08a1edf944ac5617659a066c (patch) | |
| tree | efe0a5dfb4f9767f96ab03ce9c00dc5bcc98074c /src/lib/libc/stdlib/abort.c | |
| parent | 5a11336d3f08469f2747ebcf26ae777dba46fd22 (diff) | |
| download | openbsd-c1f295aa8666eb1c08a1edf944ac5617659a066c.tar.gz openbsd-c1f295aa8666eb1c08a1edf944ac5617659a066c.tar.bz2 openbsd-c1f295aa8666eb1c08a1edf944ac5617659a066c.zip | |
Add thread-safety to libc, so that libc_r will build (on i386 at least).
All POSIX libc api now there (to P1003.1c/D10)
(more md stuff is needed for other libc/arch/*)
(setlogin is no longer a special syscall)
Add -pthread option to gcc (that makes it use -lc_r and -D_POSIX_THREADS).
Doc some re-entrant routines
Add libc_r to intro(3)
dig() uses some libc srcs and an extra -I was needed there.
Add more md stuff to libc_r.
Update includes for the pthreads api
Update libc_r TODO
Diffstat (limited to 'src/lib/libc/stdlib/abort.c')
| -rw-r--r-- | src/lib/libc/stdlib/abort.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/lib/libc/stdlib/abort.c b/src/lib/libc/stdlib/abort.c index 4ea8a2ca4b..4cc6257acb 100644 --- a/src/lib/libc/stdlib/abort.c +++ b/src/lib/libc/stdlib/abort.c | |||
| @@ -32,12 +32,13 @@ | |||
| 32 | */ | 32 | */ |
| 33 | 33 | ||
| 34 | #if defined(LIBC_SCCS) && !defined(lint) | 34 | #if defined(LIBC_SCCS) && !defined(lint) |
| 35 | static char *rcsid = "$OpenBSD: abort.c,v 1.5 1997/06/22 20:21:25 tholo Exp $"; | 35 | static char *rcsid = "$OpenBSD: abort.c,v 1.6 1998/11/20 11:18:49 d Exp $"; |
| 36 | #endif /* LIBC_SCCS and not lint */ | 36 | #endif /* LIBC_SCCS and not lint */ |
| 37 | 37 | ||
| 38 | #include <signal.h> | 38 | #include <signal.h> |
| 39 | #include <stdlib.h> | 39 | #include <stdlib.h> |
| 40 | #include <unistd.h> | 40 | #include <unistd.h> |
| 41 | #include "thread_private.h" | ||
| 41 | 42 | ||
| 42 | void (*__cleanup)(); | 43 | void (*__cleanup)(); |
| 43 | 44 | ||
| @@ -54,7 +55,11 @@ abort() | |||
| 54 | * any errors -- X311J doesn't allow abort to return anyway. | 55 | * any errors -- X311J doesn't allow abort to return anyway. |
| 55 | */ | 56 | */ |
| 56 | sigdelset(&mask, SIGABRT); | 57 | sigdelset(&mask, SIGABRT); |
| 58 | #ifdef _THREAD_SAFE | ||
| 59 | (void)_thread_sys_sigprocmask(SIG_SETMASK, &mask, (sigset_t *)NULL); | ||
| 60 | #else _THREAD_SAFE | ||
| 57 | (void)sigprocmask(SIG_SETMASK, &mask, (sigset_t *)NULL); | 61 | (void)sigprocmask(SIG_SETMASK, &mask, (sigset_t *)NULL); |
| 62 | #endif _THREAD_SAFE | ||
| 58 | 63 | ||
| 59 | /* | 64 | /* |
| 60 | * POSIX requires we flush stdio buffers on abort | 65 | * POSIX requires we flush stdio buffers on abort |
| @@ -71,7 +76,11 @@ abort() | |||
| 71 | * it again, only harder. | 76 | * it again, only harder. |
| 72 | */ | 77 | */ |
| 73 | (void)signal(SIGABRT, SIG_DFL); | 78 | (void)signal(SIGABRT, SIG_DFL); |
| 79 | #ifdef _THREAD_SAFE | ||
| 80 | (void)_thread_sys_sigprocmask(SIG_SETMASK, &mask, (sigset_t *)NULL); | ||
| 81 | #else _THREAD_SAFE | ||
| 74 | (void)sigprocmask(SIG_SETMASK, &mask, (sigset_t *)NULL); | 82 | (void)sigprocmask(SIG_SETMASK, &mask, (sigset_t *)NULL); |
| 83 | #endif _THREAD_SAFE | ||
| 75 | (void)kill(getpid(), SIGABRT); | 84 | (void)kill(getpid(), SIGABRT); |
| 76 | exit(1); | 85 | exit(1); |
| 77 | } | 86 | } |
