use tkill instead of tgkill in implementing raise
authorRich Felker <dalias@aerifal.cx>
Fri, 19 Dec 2014 01:44:51 +0000 (20:44 -0500)
committerRich Felker <dalias@aerifal.cx>
Fri, 19 Dec 2014 01:44:51 +0000 (20:44 -0500)
this shaves off a useless syscall for getting the caller's pid and
brings raise into alignment with other functions which were adapted to
use tkill rather than tgkill.

commit 83dc6eb087633abcf5608ad651d3b525ca2ec35e documents the
rationale for this change, and in particular why the tgkill syscall is
useless for its designed purpose of avoiding races.

src/signal/raise.c

index 35063c5..717b1c9 100644 (file)
@@ -5,12 +5,11 @@
 
 int raise(int sig)
 {
-       int pid, tid, ret;
+       int tid, ret;
        sigset_t set;
        __block_app_sigs(&set);
        tid = __syscall(SYS_gettid);
-       pid = __syscall(SYS_getpid);
-       ret = syscall(SYS_tgkill, pid, tid, sig);
+       ret = syscall(SYS_tkill, tid, sig);
        __restore_sigs(&set);
        return ret;
 }