kern_exit.c (214158) | kern_exit.c (215664) |
---|---|
1/*- 2 * Copyright (c) 1982, 1986, 1989, 1991, 1993 3 * The Regents of the University of California. All rights reserved. 4 * (c) UNIX System Laboratories, Inc. 5 * All or some portions of this file are derived from material licensed 6 * to the University of California by American Telephone and Telegraph 7 * Co. or Unix System Laboratories, Inc. and are reproduced herein with 8 * the permission of UNIX System Laboratories, Inc. --- 21 unchanged lines hidden (view full) --- 30 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 31 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 32 * SUCH DAMAGE. 33 * 34 * @(#)kern_exit.c 8.7 (Berkeley) 2/12/94 35 */ 36 37#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 1982, 1986, 1989, 1991, 1993 3 * The Regents of the University of California. All rights reserved. 4 * (c) UNIX System Laboratories, Inc. 5 * All or some portions of this file are derived from material licensed 6 * to the University of California by American Telephone and Telegraph 7 * Co. or Unix System Laboratories, Inc. and are reproduced herein with 8 * the permission of UNIX System Laboratories, Inc. --- 21 unchanged lines hidden (view full) --- 30 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 31 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 32 * SUCH DAMAGE. 33 * 34 * @(#)kern_exit.c 8.7 (Berkeley) 2/12/94 35 */ 36 37#include <sys/cdefs.h> |
38__FBSDID("$FreeBSD: head/sys/kern/kern_exit.c 214158 2010-10-21 19:17:40Z jhb $"); | 38__FBSDID("$FreeBSD: head/sys/kern/kern_exit.c 215664 2010-11-22 09:06:59Z netchild $"); |
39 40#include "opt_compat.h" 41#include "opt_kdtrace.h" 42#include "opt_ktrace.h" 43 44#include <sys/param.h> 45#include <sys/systm.h> 46#include <sys/sysproto.h> --- 148 unchanged lines hidden (view full) --- 195 196 /* 197 * Wait for any processes that have a hold on our vmspace to 198 * release their reference. 199 */ 200 while (p->p_lock > 0) 201 msleep(&p->p_lock, &p->p_mtx, PWAIT, "exithold", 0); 202 | 39 40#include "opt_compat.h" 41#include "opt_kdtrace.h" 42#include "opt_ktrace.h" 43 44#include <sys/param.h> 45#include <sys/systm.h> 46#include <sys/sysproto.h> --- 148 unchanged lines hidden (view full) --- 195 196 /* 197 * Wait for any processes that have a hold on our vmspace to 198 * release their reference. 199 */ 200 while (p->p_lock > 0) 201 msleep(&p->p_lock, &p->p_mtx, PWAIT, "exithold", 0); 202 |
203 p->p_xstat = rv; /* Let event handler change exit status */ |
|
203 PROC_UNLOCK(p); 204 /* Drain the limit callout while we don't have the proc locked */ 205 callout_drain(&p->p_limco); 206 207#ifdef AUDIT 208 /* 209 * The Sun BSM exit token contains two components: an exit status as 210 * passed to exit(), and a return value to indicate what sort of exit --- 26 unchanged lines hidden (view full) --- 237 */ 238 EVENTHANDLER_INVOKE(process_exit, p); 239 240 /* 241 * If parent is waiting for us to exit or exec, 242 * P_PPWAIT is set; we will wakeup the parent below. 243 */ 244 PROC_LOCK(p); | 204 PROC_UNLOCK(p); 205 /* Drain the limit callout while we don't have the proc locked */ 206 callout_drain(&p->p_limco); 207 208#ifdef AUDIT 209 /* 210 * The Sun BSM exit token contains two components: an exit status as 211 * passed to exit(), and a return value to indicate what sort of exit --- 26 unchanged lines hidden (view full) --- 238 */ 239 EVENTHANDLER_INVOKE(process_exit, p); 240 241 /* 242 * If parent is waiting for us to exit or exec, 243 * P_PPWAIT is set; we will wakeup the parent below. 244 */ 245 PROC_LOCK(p); |
246 rv = p->p_xstat; /* Event handler could change exit status */ |
|
245 stopprofclock(p); 246 p->p_flag &= ~(P_TRACED | P_PPWAIT); 247 248 /* 249 * Stop the real interval timer. If the handler is currently 250 * executing, prevent it from rearming itself and let it finish. 251 */ 252 if (timevalisset(&p->p_realtimer.it_value) && --- 166 unchanged lines hidden (view full) --- 419 temp->td_dbgflags &= ~TDB_SUSPEND; 420 psignal(q, SIGKILL); 421 } 422 PROC_UNLOCK(q); 423 } 424 425 /* Save exit status. */ 426 PROC_LOCK(p); | 247 stopprofclock(p); 248 p->p_flag &= ~(P_TRACED | P_PPWAIT); 249 250 /* 251 * Stop the real interval timer. If the handler is currently 252 * executing, prevent it from rearming itself and let it finish. 253 */ 254 if (timevalisset(&p->p_realtimer.it_value) && --- 166 unchanged lines hidden (view full) --- 421 temp->td_dbgflags &= ~TDB_SUSPEND; 422 psignal(q, SIGKILL); 423 } 424 PROC_UNLOCK(q); 425 } 426 427 /* Save exit status. */ 428 PROC_LOCK(p); |
427 p->p_xstat = rv; | |
428 p->p_xthread = td; 429 430 /* Tell the prison that we are gone. */ 431 prison_proc_free(p->p_ucred->cr_prison); 432 433#ifdef KDTRACE_HOOKS 434 /* 435 * Tell the DTrace fasttrap provider about the exit if it --- 472 unchanged lines hidden --- | 429 p->p_xthread = td; 430 431 /* Tell the prison that we are gone. */ 432 prison_proc_free(p->p_ucred->cr_prison); 433 434#ifdef KDTRACE_HOOKS 435 /* 436 * Tell the DTrace fasttrap provider about the exit if it --- 472 unchanged lines hidden --- |