Add curproc_sigkilled()

Function returns an indicator that the process was killed with SIGKILL

Reviewed by:	imp, markj
Tested by:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D32313
This commit is contained in:
Konstantin Belousov 2021-10-05 08:08:51 +03:00
parent 7a9775e9d0
commit 244ab56611
2 changed files with 24 additions and 0 deletions

View File

@ -3296,6 +3296,29 @@ sig_intr(void)
return (ret);
}
bool
curproc_sigkilled(void)
{
struct thread *td;
struct proc *p;
struct sigacts *ps;
bool res;
td = curthread;
if ((td->td_flags & TDF_NEEDSIGCHK) == 0)
return (false);
p = td->td_proc;
PROC_LOCK(p);
ps = p->p_sigacts;
mtx_lock(&ps->ps_mtx);
res = SIGISMEMBER(td->td_sigqueue.sq_signals, SIGKILL) ||
SIGISMEMBER(p->p_sigqueue.sq_signals, SIGKILL);
mtx_unlock(&ps->ps_mtx);
PROC_UNLOCK(p);
return (res);
}
void
proc_wkilled(struct proc *p)
{

View File

@ -1161,6 +1161,7 @@ int cpu_idle_wakeup(int);
extern void (*cpu_idle_hook)(sbintime_t); /* Hook to machdep CPU idler. */
void cpu_switch(struct thread *, struct thread *, struct mtx *);
void cpu_throw(struct thread *, struct thread *) __dead2;
bool curproc_sigkilled(void);
void userret(struct thread *, struct trapframe *);
void cpu_exit(struct thread *);