X-Git-Url: http://nsz.repo.hu/git/?p=musl;a=blobdiff_plain;f=src%2Fthread%2Fpthread_create.c;h=284b45a0f39c5639e8d7d4c0a1460d235c9e1983;hp=344b39f8d2031694132d88142f0a1786b8b401bc;hb=7fd3995282db788e33f1bfd7eea95b480d45c804;hpb=1ad049b7b60b2c1704b8bb5b94ee4f95d7540b3a diff --git a/src/thread/pthread_create.c b/src/thread/pthread_create.c index 344b39f8..284b45a0 100644 --- a/src/thread/pthread_create.c +++ b/src/thread/pthread_create.c @@ -85,7 +85,7 @@ static void rsyscall_handler(int sig, siginfo_t *si, void *ctx) /* Threads which have already decremented themselves from the * thread count must not increment rs.cnt or otherwise act. */ if (self->dead) { - sigaddset(&((ucontext_t *)ctx)->uc_sigmask, SIGSYSCALL); + sigfillset(&((ucontext_t *)ctx)->uc_sigmask); return; } @@ -151,13 +151,18 @@ static void init_threads() libc.lockfile = __lockfile; libc.cancelpt = cancelpt; libc.rsyscall = rsyscall; + + sigfillset(&sa.sa_mask); + sa.sa_sigaction = rsyscall_handler; + __libc_sigaction(SIGSYSCALL, &sa, 0); + + sigemptyset(&sa.sa_mask); sa.sa_sigaction = cancel_handler; __libc_sigaction(SIGCANCEL, &sa, 0); + sigaddset(&sa.sa_mask, SIGSYSCALL); sigaddset(&sa.sa_mask, SIGCANCEL); - sa.sa_sigaction = rsyscall_handler; - __libc_sigaction(SIGSYSCALL, &sa, 0); - sigprocmask(SIG_UNBLOCK, &sa.sa_mask, 0); + __libc_sigprocmask(SIG_UNBLOCK, &sa.sa_mask, 0); } static int start(void *p) @@ -190,7 +195,7 @@ int pthread_create(pthread_t *res, const pthread_attr_t *attr, void *(*entry)(vo unsigned char *map, *stack, *tsd; static const pthread_attr_t default_attr; - if (!self) return errno = ENOSYS; + if (!self) return ENOSYS; if (!init && ++init) init_threads(); if (!attr) attr = &default_attr;