1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
|
<table class="head">
<tr>
<td class="head-ltitle">PGET(9)</td>
<td class="head-vol">Kernel Developer's Manual</td>
<td class="head-rtitle">PGET(9)</td>
</tr>
</table>
<div class="manual-text">
<section class="Sh">
<h1 class="Sh" id="NAME"><a class="permalink" href="#NAME">NAME</a></h1>
<p class="Pp"><code class="Nm">pget</code> — <span class="Nd">locate a
process by number</span></p>
</section>
<section class="Sh">
<h1 class="Sh" id="SYNOPSIS"><a class="permalink" href="#SYNOPSIS">SYNOPSIS</a></h1>
<p class="Pp"><code class="In">#include
<<a class="In">sys/param.h</a>></code>
<br/>
<code class="In">#include <<a class="In">sys/proc.h</a>></code></p>
<p class="Pp"><var class="Ft">int</var>
<br/>
<code class="Fn">pget</code>(<var class="Fa" style="white-space: nowrap;">pid_t
pid</var>, <var class="Fa" style="white-space: nowrap;">int flags</var>,
<var class="Fa" style="white-space: nowrap;">struct proc **pp</var>);</p>
</section>
<section class="Sh">
<h1 class="Sh" id="DESCRIPTION"><a class="permalink" href="#DESCRIPTION">DESCRIPTION</a></h1>
<p class="Pp">This function takes a <var class="Fa">pid</var> as its argument,
which can be either a process or thread id, and fills a pointer to the
<var class="Vt">proc</var> structure in <var class="Fa">*pp</var>. In the
latter case, a process owning the specified thread is looked for. The
operation is performed by invoking the <a class="Xr">pfind(9)</a> function.
The found process is returned locked. For the
<code class="Dv">PGET_HOLD</code> case, it is returned unlocked (but held).
The
<a class="permalink" href="#pget"><code class="Fn" id="pget">pget</code></a>()
function can perform additional manipulations, depending on a
<var class="Fa">flags</var> argument.</p>
<p class="Pp">The <var class="Fa">flags</var> argument is the logical OR of some
subset of:</p>
<dl class="Bl-tag">
<dt id="PGET_HOLD"><a class="permalink" href="#PGET_HOLD"><code class="Dv">PGET_HOLD</code></a></dt>
<dd>If set, the found process will be held and unlocked.</dd>
<dt id="PGET_CANSEE"><a class="permalink" href="#PGET_CANSEE"><code class="Dv">PGET_CANSEE</code></a></dt>
<dd>If set, the found process will be checked for its visibility. See
<a class="Xr">p_cansee(9)</a>.</dd>
<dt id="PGET_CANDEBUG"><a class="permalink" href="#PGET_CANDEBUG"><code class="Dv">PGET_CANDEBUG</code></a></dt>
<dd>If set, the found process will be checked for its debuggability. See
<a class="Xr">p_candebug(9)</a>.</dd>
<dt id="PGET_ISCURRENT"><a class="permalink" href="#PGET_ISCURRENT"><code class="Dv">PGET_ISCURRENT</code></a></dt>
<dd>If set, the found process will be checked that it matches the current
process context.</dd>
<dt id="PGET_NOTWEXIT"><a class="permalink" href="#PGET_NOTWEXIT"><code class="Dv">PGET_NOTWEXIT</code></a></dt>
<dd>If set, the found process will be checked that it does not have the
process flag <code class="Dv">P_WEXIT</code> set.</dd>
<dt id="PGET_NOTINEXEC"><a class="permalink" href="#PGET_NOTINEXEC"><code class="Dv">PGET_NOTINEXEC</code></a></dt>
<dd>If set, the found process will be checked that it does not have the
process flag <code class="Dv">P_INEXEC</code> set.</dd>
<dt id="PGET_NOTID"><a class="permalink" href="#PGET_NOTID"><code class="Dv">PGET_NOTID</code></a></dt>
<dd>If set, <var class="Fa">pid</var> is not assumed as a thread id for values
larger than <code class="Dv">PID_MAX</code>.</dd>
<dt id="PGET_WANTREAD"><a class="permalink" href="#PGET_WANTREAD"><code class="Dv">PGET_WANTREAD</code></a></dt>
<dd>If set, the found process will be checked that the caller may get a read
access to its structure. A shorthand for
(<code class="Dv">PGET_HOLD</code> | <code class="Dv">PGET_CANDEBUG</code>
| <code class="Dv">PGET_NOTWEXIT</code>).</dd>
</dl>
</section>
<section class="Sh">
<h1 class="Sh" id="RETURN_VALUES"><a class="permalink" href="#RETURN_VALUES">RETURN
VALUES</a></h1>
<p class="Pp">If the process is found in the specified way, then zero is
returned, otherwise an appropriate error code is returned.</p>
</section>
<section class="Sh">
<h1 class="Sh" id="SEE_ALSO"><a class="permalink" href="#SEE_ALSO">SEE
ALSO</a></h1>
<p class="Pp"><a class="Xr">p_candebug(9)</a>, <a class="Xr">p_cansee(9)</a>,
<a class="Xr">pfind(9)</a></p>
</section>
</div>
<table class="foot">
<tr>
<td class="foot-date">May 3, 2014</td>
<td class="foot-os">FreeBSD 15.0</td>
</tr>
</table>
|