Simplify jail ID printing on process exit
As suggested by kib@, we don't need to check p_ucred, because that's only NULL during process creation, and cr_prison is never NULL.
This commit is contained in:
parent
a0483764f3
commit
4ae4822d6a
@ -3094,16 +3094,12 @@ proc_wkilled(struct proc *p)
|
||||
void
|
||||
killproc(struct proc *p, char *why)
|
||||
{
|
||||
int jid = -1;
|
||||
|
||||
if (p->p_ucred && p->p_ucred->cr_prison)
|
||||
jid = p->p_ucred->cr_prison->pr_id;
|
||||
|
||||
PROC_LOCK_ASSERT(p, MA_OWNED);
|
||||
CTR3(KTR_PROC, "killproc: proc %p (pid %d, %s)", p, p->p_pid,
|
||||
p->p_comm);
|
||||
log(LOG_ERR, "pid %d (%s), jid %d, uid %d, was killed: %s\n",
|
||||
p->p_pid, p->p_comm, jid,
|
||||
p->p_pid, p->p_comm, p->p_ucred->cr_prison->pr_id,
|
||||
p->p_ucred ? p->p_ucred->cr_uid : -1, why);
|
||||
proc_wkilled(p);
|
||||
kern_psignal(p, SIGKILL);
|
||||
@ -3121,10 +3117,6 @@ void
|
||||
sigexit(struct thread *td, int sig)
|
||||
{
|
||||
struct proc *p = td->td_proc;
|
||||
int jid = -1;
|
||||
|
||||
if (p->p_ucred && p->p_ucred->cr_prison)
|
||||
jid = p->p_ucred->cr_prison->pr_id;
|
||||
|
||||
PROC_LOCK_ASSERT(p, MA_OWNED);
|
||||
p->p_acflag |= AXSIG;
|
||||
@ -3152,7 +3144,8 @@ sigexit(struct thread *td, int sig)
|
||||
if (kern_logsigexit)
|
||||
log(LOG_INFO,
|
||||
"pid %d (%s), jid %d, uid %d: exited on "
|
||||
"signal %d%s\n", p->p_pid, p->p_comm, jid,
|
||||
"signal %d%s\n", p->p_pid, p->p_comm,
|
||||
p->p_ucred->cr_prison->pr_id,
|
||||
td->td_ucred ? td->td_ucred->cr_uid : -1,
|
||||
sig &~ WCOREFLAG,
|
||||
sig & WCOREFLAG ? " (core dumped)" : "");
|
||||
|
Loading…
Reference in New Issue
Block a user