xref: /freebsd/share/man/man9/p_cansee.9 (revision 315ee00f)
1.\"
2.\" Copyright (c) 2003 Joseph Koshy <jkoshy@FreeBSD.org>
3.\" Copyright (c) 2006 Ceri Davies <ceri@FreeBSD.org>
4.\"
5.\" All rights reserved.
6.\"
7.\" Redistribution and use in source and binary forms, with or without
8.\" modification, are permitted provided that the following conditions
9.\" are met:
10.\" 1. Redistributions of source code must retain the above copyright
11.\"    notice, this list of conditions and the following disclaimer.
12.\" 2. Redistributions in binary form must reproduce the above copyright
13.\"    notice, this list of conditions and the following disclaimer in the
14.\"    documentation and/or other materials provided with the distribution.
15.\"
16.\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR
17.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
18.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19.\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
20.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26.\"
27.Dd November 19, 2006
28.Dt P_CANSEE 9
29.Os
30.Sh NAME
31.Nm p_cansee
32.Nd determine visibility of a process
33.Sh SYNOPSIS
34.In sys/param.h
35.In sys/proc.h
36.Ft int
37.Fn p_cansee "struct thread *td" "struct proc *p"
38.Sh DESCRIPTION
39This function can be used to determine if a given process
40.Fa p
41is visible to the thread
42.Fa td ,
43where the notion of
44.Dq visibility
45may be read as
46.Dq "awareness of existence" .
47.Pp
48The function is implemented using
49.Xr cr_cansee 9 ,
50and the dependencies on
51.Xr sysctl 8
52variables documented in the
53.Xr cr_cansee 9
54manual page apply.
55.Sh RETURN VALUES
56The
57.Fn p_cansee
58function
59returns
60.Li 0
61if the process denoted by
62.Fa p
63is visible by thread
64.Fa td ,
65or a non-zero error return value otherwise.
66.Sh ERRORS
67.Bl -tag -width Er
68.It Bq Er ESRCH
69Process
70.Fa p
71is not visible to thread
72.Fa td
73as determined by
74.Xr cr_cansee 9 .
75.It Bq Er ESRCH
76Thread
77.Fa td
78has been jailed and process
79.Fa p
80does not belong to the same jail as
81.Fa td .
82.It Bq Er ESRCH
83The MAC subsystem denied visibility.
84.El
85.Sh SEE ALSO
86.Xr jail 2 ,
87.Xr sysctl 8 ,
88.Xr cr_cansee 9 ,
89.Xr mac 9 ,
90.Xr p_candebug 9 ,
91.Xr prison_check 9
92