Merge commit 'b31ca922c7346747131aed07c0c171ec2f573aac' into merges
[unleashed.git] / share / man / man1 / preap.1
blob986c8d0da798c5ae472dca0f6f0d2015b98e965e
1 '\" te
2 .\" Copyright (c) 2006, Sun Microsystems, Inc.  All Rights Reserved
3 .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License").  You may not use this file except in compliance with the License.
4 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing.  See the License for the specific language governing permissions and limitations under the License.
5 .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE.  If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
6 .TH PREAP 1 "Jun 19, 2006"
7 .SH NAME
8 preap \- force a defunct process to be reaped by its parent
9 .SH SYNOPSIS
10 .LP
11 .nf
12 \fBpreap\fR [\fB-F\fR] \fIpid\fR...
13 .fi
15 .SH DESCRIPTION
16 .sp
17 .LP
18 A defunct (or zombie) process is one whose exit status has yet to be reaped by
19 its parent. The exit status is reaped by way of the \fBwait\fR(3C),
20 \fBwaitid\fR(2), or \fBwaitpid\fR(3C) system call. In the normal course of
21 system operation, zombies can occur, but are typically short-lived. This can
22 happen if a parent exits without having reaped the exit status of some or all
23 of its children. In that case, those children are reparented to \fBPID 1\fR.
24 See \fBinit\fR(8), which periodically reaps such processes.
25 .sp
26 .LP
27 An irresponsible parent process can not exit for a very long time and thus
28 leave zombies on the system. Since the operating system destroys nearly all
29 components of a process before it becomes defunct, such defunct processes do
30 not normally impact system operation. However, they do consume a small amount
31 of system memory.
32 .sp
33 .LP
34 \fBpreap\fR forces the parent of the process specified by \fIpid\fR to
35 \fBwaitid\fR(2) for \fIpid\fR, if \fIpid\fR represents a defunct process.
36 .sp
37 .LP
38 \fBpreap\fR attempts to prevent the administrator from unwisely reaping a child
39 process which might soon be reaped by the parent, if:
40 .RS +4
41 .TP
42 .ie t \(bu
43 .el o
44 The process is a child of \fBinit\fR(8).
45 .RE
46 .RS +4
47 .TP
48 .ie t \(bu
49 .el o
50 The parent process is stopped and might wait on the child when it is again
51 allowed to run.
52 .RE
53 .RS +4
54 .TP
55 .ie t \(bu
56 .el o
57 The process has been defunct for less than one minute.
58 .RE
59 .SH OPTIONS
60 .sp
61 .LP
62 The following option is supported:
63 .sp
64 .ne 2
65 .na
66 \fB\fB-F\fR\fR
67 .ad
68 .RS 6n
69 Forces the parent to reap the child, overriding safety checks.
70 .RE
72 .SH OPERANDS
73 .sp
74 .LP
75 The following operand is supported:
76 .sp
77 .ne 2
78 .na
79 \fB\fIpid\fR\fR
80 .ad
81 .RS 7n
82 Process \fBID\fR list.
83 .RE
85 .SH USAGE
86 .sp
87 .LP
88 Caution should be exercised when using the \fB-F\fR flag. Imposing two
89 controlling processes on one victim process can lead to chaos. Safety is
90 assured only if the primary controlling process, typically a debugger, has
91 stopped the victim process and the primary controlling process is doing nothing
92 at the moment of application of the \fBproc\fR tool in question.
93 .SH EXIT STATUS
94 .sp
95 .LP
96 The following exit values are returned by \fBpreap\fR, which prints the exit
97 status of each target process reaped:
98 .sp
99 .ne 2
101 \fB\fB0\fR\fR
103 .RS 12n
104 Successfully operation.
108 .ne 2
110 \fBnon-zero\fR
112 .RS 12n
113 Failure, such as no such process, permission denied, or invalid option.
116 .SH SEE ALSO
119 \fBproc\fR(1), \fBinit\fR(8), \fBwaitid\fR(2), \fBwait\fR(3C),
120 \fBwaitpid\fR(3C), \fBproc\fR(4), \fBattributes\fR(5)
121 .SH WARNINGS
124 \fBpreap\fR should be applied sparingly and only in situations in which the
125 administrator or developer has confirmed that defunct processes are not reaped
126 by the parent process. Otherwise, applying \fBpreap\fR can damage the parent
127 process in unpredictable ways.