-/* $OpenBSD: kern_proc.c,v 1.66 2016/03/04 14:09:37 deraadt Exp $ */
+/* $OpenBSD: kern_proc.c,v 1.67 2016/06/27 19:55:02 jca Exp $ */
/* $NetBSD: kern_proc.c,v 1.14 1996/02/09 18:59:41 christos Exp $ */
/*
return (NULL);
}
+/*
+ * Locate a zombie process
+ */
+struct process *
+zombiefind(pid_t pid)
+{
+ struct process *pr;
+
+ LIST_FOREACH(pr, &zombprocess, ps_list)
+ if (pr->ps_mainproc->p_pid == pid)
+ return (pr);
+ return (NULL);
+}
+
/*
* Move p to a new or existing process group (and session)
* Caller provides a pre-allocated pgrp and session that should
-/* $OpenBSD: kern_sig.c,v 1.199 2016/06/27 16:49:45 jsing Exp $ */
+/* $OpenBSD: kern_sig.c,v 1.200 2016/06/27 19:55:02 jca Exp $ */
/* $NetBSD: kern_sig.c,v 1.54 1996/04/22 01:38:32 christos Exp $ */
/*
int pid = SCARG(uap, pid);
int signum = SCARG(uap, signum);
int error;
+ int zombie = 0;
if ((error = pledge_kill(cp, pid)) != 0)
return (error);
if (((u_int)signum) >= NSIG)
return (EINVAL);
if (pid > 0) {
- if ((pr = prfind(pid)) == NULL)
- return (ESRCH);
+ if ((pr = prfind(pid)) == NULL) {
+ if ((pr = zombiefind(pid)) == NULL)
+ return (ESRCH);
+ else
+ zombie = 1;
+ }
if (!cansignal(cp, pr, signum))
return (EPERM);
/* kill single process */
- if (signum)
+ if (signum && !zombie)
prsignal(pr, signum);
return (0);
}
-/* $OpenBSD: proc.h,v 1.223 2016/05/30 21:31:27 deraadt Exp $ */
+/* $OpenBSD: proc.h,v 1.224 2016/06/27 19:55:02 jca Exp $ */
/* $NetBSD: proc.h,v 1.44 1996/04/22 01:23:21 christos Exp $ */
/*-
void freepid(pid_t);
struct process *prfind(pid_t); /* Find process by id. */
+struct process *zombiefind(pid_t); /* Find zombie process by id. */
struct proc *pfind(pid_t); /* Find thread by id. */
struct pgrp *pgfind(pid_t); /* Find process group by id. */
void proc_printit(struct proc *p, const char *modif,