1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-14 10:09:48 +00:00

o Since we're not using signals for thread synchronization anymore,

sigprocmask no longer needs to be wrapped.
o raise(3) is applied to the calling thread in a threaded program.
o In the sigaction wrapper reference the correct structure.
o Don't treat SIGTHR especially anymore (infact it won't exist in
  a little while).
This commit is contained in:
Mike Makonnen 2004-03-27 15:05:28 +00:00
parent 7c8aa41383
commit 8bd3b0415b
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=127486
2 changed files with 17 additions and 34 deletions

View File

@ -47,36 +47,6 @@
#define DBG_MSG(x...)
#endif
__weak_reference(_sigprocmask, sigprocmask);
int
_sigprocmask(int how, const sigset_t *set, sigset_t *oset)
{
sigset_t new;
/*
* Make sure applications can't unblock our synchronization
* signal. We always want to take this with sigwait().
*/
if (set != NULL) {
new = *set;
switch (how) {
case SIG_BLOCK:
case SIG_SETMASK:
SIGADDSET(new, SIGTHR);
break;
case SIG_UNBLOCK:
SIGDELSET(new, SIGTHR);
break;
default:
break;
}
set = &new;
}
return (__sys_sigprocmask(how, set, oset));
}
__weak_reference(_pthread_sigmask, pthread_sigmask);
int

View File

@ -272,6 +272,21 @@ pselect(int count, fd_set *rfds, fd_set *wfds, fd_set *efds,
return (ret);
}
__weak_reference(_raise, raise);
int
_raise(int sig)
{
int error;
error = pthread_kill(pthread_self(), sig);
if (error != 0) {
errno = error;
error = -1;
}
return (error);
}
__weak_reference(_read, read);
ssize_t
@ -324,13 +339,11 @@ _sigaction(int sig, const struct sigaction *act, struct sigaction *oact)
struct sigaction oldact, wrapperact;
int error;
/* Detect invalid signals. Signal SIGTHR is silently ignored */
/* Detect invalid signals. */
if (sig < 1 || sig > NSIG) {
errno = EINVAL;
return (-1);
}
if (sig == SIGTHR)
return (0);
/*
* If act is not NULL the library's signal wrapper is passed into the
@ -348,7 +361,7 @@ _sigaction(int sig, const struct sigaction *act, struct sigaction *oact)
tmpact->sa_handler != SIG_IGN) {
bcopy((const void *)tmpact, (void *)&wrapperact,
sizeof(struct sigaction));
tmpact->sa_flags &= SA_SIGINFO;
wrapperact.sa_flags |= SA_SIGINFO;
wrapperact.sa_sigaction = &_thread_sig_wrapper;
tmpact = &wrapperact;
}