Return reschedule_signals() to being static again.

It was used after sigfastblock_setpend() call in in ast() when current
thread fast-blocks signals.  Add a flag to sigfastblock_setpend() to
request reschedule, and remove the direct use of the function from
subr_trap.c

Tested by:	pho
Sponsored by:	The FreeBSD Foundation
This commit is contained in:
kib 2020-03-10 20:04:38 +00:00
parent 6bbb82c277
commit 762b178152
3 changed files with 21 additions and 11 deletions

View File

@ -108,6 +108,7 @@ static int coredump(struct thread *);
static int killpg1(struct thread *td, int sig, int pgid, int all,
ksiginfo_t *ksi);
static int issignal(struct thread *td);
static void reschedule_signals(struct proc *p, sigset_t block, int flags);
static int sigprop(int sig);
static void tdsigwakeup(struct thread *, int, sig_t, int);
static int sig_suspend_threads(struct thread *, struct proc *, int);
@ -2683,7 +2684,7 @@ ptracestop(struct thread *td, int sig, ksiginfo_t *si)
return (td->td_xsig);
}
void
static void
reschedule_signals(struct proc *p, sigset_t block, int flags)
{
struct sigacts *ps;
@ -4124,8 +4125,8 @@ sigfastblock_fetch(struct thread *td)
(void)sigfastblock_fetch_sig(td, true, &val);
}
void
sigfastblock_setpend(struct thread *td)
static void
sigfastblock_setpend1(struct thread *td)
{
int res;
uint32_t oldval;
@ -4154,3 +4155,17 @@ sigfastblock_setpend(struct thread *td)
break;
}
}
void
sigfastblock_setpend(struct thread *td, bool resched)
{
struct proc *p;
sigfastblock_setpend1(td);
if (resched) {
p = td->td_proc;
PROC_LOCK(p);
reschedule_signals(p, fastblock_mask, SIGPROCMASK_FASTBLK);
PROC_UNLOCK(p);
}
}

View File

@ -328,11 +328,7 @@ ast(struct trapframe *framep)
sigfastblock_fetch(td);
if ((td->td_pflags & TDP_SIGFASTBLOCK) != 0 &&
td->td_sigblock_val != 0) {
sigfastblock_setpend(td);
PROC_LOCK(p);
reschedule_signals(p, fastblock_mask,
SIGPROCMASK_FASTBLK);
PROC_UNLOCK(p);
sigfastblock_setpend(td, true);
} else {
PROC_LOCK(p);
mtx_lock(&p->p_sigacts->ps_mtx);
@ -350,7 +346,7 @@ ast(struct trapframe *framep)
* the postsig() loop was performed.
*/
if (td->td_pflags & TDP_SIGFASTPENDING)
sigfastblock_setpend(td);
sigfastblock_setpend(td, false);
/*
* We need to check to see if we have to exit or wait due to a

View File

@ -393,7 +393,6 @@ void pgsignal(struct pgrp *pgrp, int sig, int checkctty, ksiginfo_t *ksi);
int postsig(int sig);
void kern_psignal(struct proc *p, int sig);
int ptracestop(struct thread *td, int sig, ksiginfo_t *si);
void reschedule_signals(struct proc *p, sigset_t block, int flags);
void sendsig(sig_t catcher, ksiginfo_t *ksi, sigset_t *retmask);
struct sigacts *sigacts_alloc(void);
void sigacts_copy(struct sigacts *dest, struct sigacts *src);
@ -406,7 +405,7 @@ int sigev_findtd(struct proc *p, struct sigevent *sigev, struct thread **);
int sig_ffs(sigset_t *set);
void sigfastblock_clear(struct thread *td);
void sigfastblock_fetch(struct thread *td);
void sigfastblock_setpend(struct thread *td);
void sigfastblock_setpend(struct thread *td, bool resched);
void siginit(struct proc *p);
void signotify(struct thread *td);
void sigqueue_delete(struct sigqueue *queue, int sig);