This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH] Refactor Linux raise implementation (BZ#15368)
- From: Andreas Schwab <schwab at suse dot de>
- To: Adhemerval Zanella <adhemerval dot zanella at linaro dot org>
- Cc: Zack Weinberg <zackw at panix dot com>, GNU C Library <libc-alpha at sourceware dot org>
- Date: Thu, 07 Jul 2016 17:30:14 +0200
- Subject: Re: [PATCH] Refactor Linux raise implementation (BZ#15368)
- Authentication-results: sourceware.org; auth=none
- References: <1466188988-19954-1-git-send-email-adhemerval.zanella@linaro.org> <CAKCAbMgJvz1QagpX8kAtCjEgJE8D0SPABvcJ6VFZ-Vt+cDMTNA@mail.gmail.com> <57658427.2090902@linaro.org>
Adhemerval Zanella <adhemerval.zanella@linaro.org> writes:
> + /* raise is an async-safe function so it could be called while the
> + fork/vfork function temporarily invalidated the PID field. To avoid
> + relying in the cached value we block all user-defined signal handler
> + (which might call fork/vfork) and issues the getpid and gettid
> + directly. */
s/issues/issue/; s/^/ syscalls/
> + sigset_t set;
> + __libc_signal_block_app (&set);
> +
> + INTERNAL_SYSCALL_DECL (err);
> + pid_t pid = INTERNAL_SYSCALL (getpid, err, 0);
> + pid_t tid = INTERNAL_SYSCALL (gettid, err, 0);
> +
> + int ret = INLINE_SYSCALL (tgkill, 3, pid, tid, sig);
> +
> + __libc_signal_restore_set (&set);
What if block/unblock fail?
Andreas.
--
Andreas Schwab, SUSE Labs, schwab@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE 1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."