diff options
author | mtm <mtm@FreeBSD.org> | 2004-03-29 13:56:04 +0000 |
---|---|---|
committer | mtm <mtm@FreeBSD.org> | 2004-03-29 13:56:04 +0000 |
commit | f4172a5e78559e7f1eb4ea6afdd2937dfc673597 (patch) | |
tree | 15c07e5ffb5fa13e7923f73e4b5340c79a348314 /lib/libthr | |
parent | 1f163908e4a04272b1901eae8151f32d36ee0796 (diff) | |
download | FreeBSD-src-f4172a5e78559e7f1eb4ea6afdd2937dfc673597.zip FreeBSD-src-f4172a5e78559e7f1eb4ea6afdd2937dfc673597.tar.gz |
Make the minimum implementation of pthread_kill conform to the
functionality spelled out in SUSv3.
o Signal of 0 means do everything except send the signal
o Check that the signal is not invalid
o Check that the target thread is not dead/invalid
Diffstat (limited to 'lib/libthr')
-rw-r--r-- | lib/libthr/thread/thr_sig.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/lib/libthr/thread/thr_sig.c b/lib/libthr/thread/thr_sig.c index 0f7d173..efc6d5a 100644 --- a/lib/libthr/thread/thr_sig.c +++ b/lib/libthr/thread/thr_sig.c @@ -75,9 +75,22 @@ __weak_reference(_pthread_kill, pthread_kill); int _pthread_kill(pthread_t pthread, int sig) { + int error; + if (sig < 0 || sig > NSIG) + return (EINVAL); if (_thread_initial == NULL) _thread_init(); + error = _find_thread(pthread); + if (error != 0) + return (error); + + /* + * A 0 signal means do error-checking but don't send signal. + */ + if (sig == 0) + return (0); + return (thr_kill(pthread->thr_id, sig)); } |