| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | .\" $NetBSD: pfind.9,v 1.1 2010/03/25 10:09:54 jruoho Exp $ | | 1 | .\" $NetBSD: pfind.9,v 1.2 2010/03/26 19:43:04 wiz Exp $ |
2 | .\" | | 2 | .\" |
3 | .\" Copyright (c) 2010 The NetBSD Foundation, Inc. | | 3 | .\" Copyright (c) 2010 The NetBSD Foundation, Inc. |
4 | .\" All rights reserved. | | 4 | .\" All rights reserved. |
5 | .\" | | 5 | .\" |
6 | .\" This code is derived from software contributed to The NetBSD Foundation | | 6 | .\" This code is derived from software contributed to The NetBSD Foundation |
7 | .\" by Jukka Ruohonen. | | 7 | .\" by Jukka Ruohonen. |
8 | .\" | | 8 | .\" |
9 | .\" Redistribution and use in source and binary forms, with or without | | 9 | .\" Redistribution and use in source and binary forms, with or without |
10 | .\" modification, are permitted provided that the following conditions | | 10 | .\" modification, are permitted provided that the following conditions |
11 | .\" are met: | | 11 | .\" are met: |
12 | .\" 1. Redistributions of source code must retain the above copyright | | 12 | .\" 1. Redistributions of source code must retain the above copyright |
13 | .\" notice, this list of conditions and the following disclaimer. | | 13 | .\" notice, this list of conditions and the following disclaimer. |
14 | .\" 2. Redistributions in binary form must reproduce the above copyright | | 14 | .\" 2. Redistributions in binary form must reproduce the above copyright |
| @@ -18,27 +18,27 @@ | | | @@ -18,27 +18,27 @@ |
18 | .\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS | | 18 | .\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS |
19 | .\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED | | 19 | .\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED |
20 | .\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | | 20 | .\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
21 | .\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS | | 21 | .\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS |
22 | .\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | | 22 | .\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
23 | .\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | | 23 | .\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
24 | .\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | | 24 | .\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
25 | .\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | | 25 | .\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
26 | .\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | | 26 | .\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
27 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | | 27 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
28 | .\" POSSIBILITY OF SUCH DAMAGE. | | 28 | .\" POSSIBILITY OF SUCH DAMAGE. |
29 | .\" | | 29 | .\" |
30 | .Dd March 25, 2010 | | 30 | .Dd March 25, 2010 |
31 | .Dt pfind 9 | | 31 | .Dt PFIND 9 |
32 | .Os | | 32 | .Os |
33 | .Sh NAME | | 33 | .Sh NAME |
34 | .Nm pfind | | 34 | .Nm pfind |
35 | .Nd find process or process group by a number | | 35 | .Nd find process or process group by a number |
36 | .Sh SYNOPSIS | | 36 | .Sh SYNOPSIS |
37 | .In sys/proc.h | | 37 | .In sys/proc.h |
38 | .Ft struct proc * | | 38 | .Ft struct proc * |
39 | .Fn p_find "pid_t pid" "uint flags" | | 39 | .Fn p_find "pid_t pid" "uint flags" |
40 | .Ft struct proc * | | 40 | .Ft struct proc * |
41 | .Fn pfind "pid_t pid" | | 41 | .Fn pfind "pid_t pid" |
42 | .Ft struct pgrp * | | 42 | .Ft struct pgrp * |
43 | .Fn pg_find "pid_t pgid" "uint flags" | | 43 | .Fn pg_find "pid_t pgid" "uint flags" |
44 | .Ft struct pgrp * | | 44 | .Ft struct pgrp * |
| @@ -78,36 +78,36 @@ The list of processes is unlocked upon f | | | @@ -78,36 +78,36 @@ The list of processes is unlocked upon f |
78 | The list of processes is unlocked upon success. | | 78 | The list of processes is unlocked upon success. |
79 | .It Dv PFIND_UNLOCK | | 79 | .It Dv PFIND_UNLOCK |
80 | The implementation releases the | | 80 | The implementation releases the |
81 | .Xr mutex 9 | | 81 | .Xr mutex 9 |
82 | on | | 82 | on |
83 | .Va proc_lock | | 83 | .Va proc_lock |
84 | both upon failure and success. | | 84 | both upon failure and success. |
85 | .El | | 85 | .El |
86 | .Pp | | 86 | .Pp |
87 | The | | 87 | The |
88 | .Fn pfind | | 88 | .Fn pfind |
89 | and | | 89 | and |
90 | .Fn pgfind | | 90 | .Fn pgfind |
91 | are equivalent to | | 91 | functions are equivalent to |
92 | .Fn p_find | | 92 | .Fn p_find |
93 | and | | 93 | and |
94 | .Fn pg_find | | 94 | .Fn pg_find |
95 | with the | | 95 | with the |
96 | .Fa flags | | 96 | .Fa flags |
97 | argument specified as | | 97 | argument specified as |
98 | .Dv PFIND_UNLOCK . | | 98 | .Dv PFIND_UNLOCK . |
99 | .Sh RETURN VALUES | | 99 | .Sh RETURN VALUES |
100 | Upon succesful completion, the described functions return a pointer to either | | 100 | Upon successful completion, the described functions return a pointer to either |
101 | .Em struct proc | | 101 | .Em struct proc |
102 | or | | 102 | or |
103 | .Em struct pgrp . | | 103 | .Em struct pgrp . |
104 | Otherwise, if the requested | | 104 | Otherwise, if the requested |
105 | .Tn ID | | 105 | .Tn ID |
106 | was not found, | | 106 | was not found, |
107 | .Dv NULL | | 107 | .Dv NULL |
108 | is returned. | | 108 | is returned. |
109 | .Sh EXAMPLES | | 109 | .Sh EXAMPLES |
110 | The following example demonstrates the use of | | 110 | The following example demonstrates the use of |
111 | .Fn p_find : | | 111 | .Fn p_find : |
112 | .Bd -literal -offset indent | | 112 | .Bd -literal -offset indent |
113 | struct proc *p; | | 113 | struct proc *p; |