1
0
mirror of https://sourceware.org/git/glibc.git synced 2025-07-30 22:43:12 +03:00

nptl: SIGCANCEL, SIGTIMER, SIGSETXID are always defined

All nptl targets have these signal definitions nowadays.  This
changes also replaces the nptl-generic version of pthread_sigmask
with the Linux version.

Tested on x86_64-linux-gnu and i686-linux-gnu.  Built with
build-many-glibcs.py.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
This commit is contained in:
Florian Weimer
2019-10-18 14:29:04 +02:00
parent 5e20aae5ee
commit e4b3707cea
10 changed files with 34 additions and 128 deletions

View File

@ -114,9 +114,7 @@ static const struct pthread_functions pthread_functions =
.ptr_nthreads = &__nptl_nthreads,
.ptr___pthread_unwind = &__pthread_unwind,
.ptr__nptl_deallocate_tsd = __nptl_deallocate_tsd,
# ifdef SIGSETXID
.ptr__nptl_setxid = __nptl_setxid,
# endif
.ptr_set_robust = __nptl_set_robust
};
# define ptr_pthread_functions &pthread_functions
@ -139,7 +137,6 @@ __nptl_set_robust (struct pthread *self)
}
#ifdef SIGCANCEL
/* For asynchronous cancellation we use a signal. This is the handler. */
static void
sigcancel_handler (int sig, siginfo_t *si, void *ctx)
@ -185,10 +182,8 @@ sigcancel_handler (int sig, siginfo_t *si, void *ctx)
oldval = curval;
}
}
#endif
#ifdef SIGSETXID
struct xid_command *__xidcmd attribute_hidden;
/* We use the SIGSETXID signal in the setuid, setgid, etc. implementations to
@ -234,7 +229,6 @@ sighandler_setxid (int sig, siginfo_t *si, void *ctx)
if (atomic_decrement_val (&__xidcmd->cntr) == 0)
futex_wake ((unsigned int *) &__xidcmd->cntr, 1, FUTEX_PRIVATE);
}
#endif
/* When using __thread for this, we do it in libc so as not
@ -285,41 +279,31 @@ __pthread_initialize_minimal_internal (void)
had to set __nptl_initial_report_events. Propagate its setting. */
THREAD_SETMEM (pd, report_events, __nptl_initial_report_events);
#if defined SIGCANCEL || defined SIGSETXID
struct sigaction sa;
__sigemptyset (&sa.sa_mask);
# ifdef SIGCANCEL
/* Install the cancellation signal handler. If for some reason we
cannot install the handler we do not abort. Maybe we should, but
it is only asynchronous cancellation which is affected. */
sa.sa_sigaction = sigcancel_handler;
sa.sa_flags = SA_SIGINFO;
(void) __libc_sigaction (SIGCANCEL, &sa, NULL);
# endif
# ifdef SIGSETXID
/* Install the handle to change the threads' uid/gid. */
sa.sa_sigaction = sighandler_setxid;
sa.sa_flags = SA_SIGINFO | SA_RESTART;
(void) __libc_sigaction (SIGSETXID, &sa, NULL);
# endif
/* The parent process might have left the signals blocked. Just in
case, unblock it. We reuse the signal mask in the sigaction
structure. It is already cleared. */
# ifdef SIGCANCEL
__sigaddset (&sa.sa_mask, SIGCANCEL);
# endif
# ifdef SIGSETXID
__sigaddset (&sa.sa_mask, SIGSETXID);
# endif
{
INTERNAL_SYSCALL_DECL (err);
(void) INTERNAL_SYSCALL (rt_sigprocmask, err, 4, SIG_UNBLOCK, &sa.sa_mask,
NULL, _NSIG / 8);
}
#endif
/* Get the size of the static and alignment requirements for the TLS
block. */