Module Name: src Committed By: christos Date: Sun Apr 3 02:28:46 UTC 2016
Modified Files: src/sys/kern: kern_exit.c Log Message: implement WCONTINUED, untested fill out more siginfo fields. use geteuid instead of getuid To generate a diff of this commit: cvs rdiff -u -r1.249 -r1.250 src/sys/kern/kern_exit.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/kern/kern_exit.c diff -u src/sys/kern/kern_exit.c:1.249 src/sys/kern/kern_exit.c:1.250 --- src/sys/kern/kern_exit.c:1.249 Sat Apr 2 16:38:40 2016 +++ src/sys/kern/kern_exit.c Sat Apr 2 22:28:46 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: kern_exit.c,v 1.249 2016/04/02 20:38:40 christos Exp $ */ +/* $NetBSD: kern_exit.c,v 1.250 2016/04/03 02:28:46 christos Exp $ */ /*- * Copyright (c) 1998, 1999, 2006, 2007, 2008 The NetBSD Foundation, Inc. @@ -67,7 +67,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: kern_exit.c,v 1.249 2016/04/02 20:38:40 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: kern_exit.c,v 1.250 2016/04/03 02:28:46 christos Exp $"); #include "opt_ktrace.h" #include "opt_dtrace.h" @@ -823,11 +823,11 @@ match_process(struct proc *pp, struct pr goto out; break; case P_UID: - if (kauth_cred_getuid(p->p_cred) != (uid_t)id) + if (kauth_cred_geteuid(p->p_cred) != (uid_t)id) goto out; break; case P_GID: - if (kauth_cred_getgid(p->p_cred) != (gid_t)id) + if (kauth_cred_getegid(p->p_cred) != (gid_t)id) goto out; break; case P_CID: @@ -870,14 +870,9 @@ match_process(struct proc *pp, struct pr } siginfo->si_pid = p->p_pid; - siginfo->si_uid = kauth_cred_getuid(p->p_cred); - - /* - * The si_addr field would be useful additional - * detail, but apparently the PC value may be lost - * when we reach this point. bzero() above sets - * siginfo->si_addr to NULL. - */ + siginfo->si_uid = kauth_cred_geteuid(p->p_cred); + siginfo->si_utime = p->p_stats->p_ru.ru_utime.tv_sec; + siginfo->si_stime = p->p_stats->p_ru.ru_stime.tv_sec; } /* @@ -980,18 +975,33 @@ find_stopped_child(struct proc *parent, } } - if ((options & WTRAPPED) != 0 && + if ((options & WCONTINUED) != 0 && + child->p_xstat == SIGCONT) { + if ((options & WNOWAIT) == 0) { + child->p_waited = 1; + parent->p_nstopchild--; + } + if (si) { + si->si_status = child->p_xstat; + si->si_code = CLD_CONTINUED; + } + break; + } + + if ((options & (WTRAPPED|WSTOPPED)) != 0 && child->p_stat == SSTOP && child->p_waited == 0 && - (child->p_slflag & PSL_TRACED || - options & WUNTRACED)) { + ((child->p_slflag & PSL_TRACED) || + options & (WUNTRACED|WSTOPPED))) { if ((options & WNOWAIT) == 0) { child->p_waited = 1; parent->p_nstopchild--; } if (si) { si->si_status = child->p_xstat; - si->si_code = CLD_TRAPPED; + si->si_code = + (child->p_slflag & PSL_TRACED) ? + CLD_TRAPPED : CLD_STOPPED; } break; }