xref: /freebsd/share/man/man9/p_cansee.9 (revision c76f07938c44264c7ebd400c23f218e561960d23)
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.\" $FreeBSD$
28.\"
29.Dd November 19, 2006
30.Dt P_CANSEE 9
31.Os
32.Sh NAME
33.Nm p_cansee
34.Nd determine visibility of a process
35.Sh SYNOPSIS
36.In sys/param.h
37.In sys/proc.h
38.Ft int
39.Fn p_cansee "struct thread *td" "struct proc *p"
40.Sh DESCRIPTION
41This function can be used to determine if a given process
42.Fa p
43is visible to the thread
44.Fa td ,
45where the notion of
46.Dq visibility
47may be read as
48.Dq "awareness of existence" .
49.Pp
50The function is implemented using
51.Xr cr_cansee 9 ,
52and the dependencies on
53.Xr sysctl 8
54variables documented in the
55.Xr cr_cansee 9
56manual page apply.
57.Sh RETURN VALUES
58The
59.Fn p_cansee
60function
61returns
62.Li 0
63if the process denoted by
64.Fa p
65is visible by thread
66.Fa td ,
67or a non-zero error return value otherwise.
68.Sh ERRORS
69.Bl -tag -width Er
70.It Bq Er ESRCH
71Process
72.Fa p
73is not visible to thread
74.Fa td
75as determined by
76.Xr cr_cansee 9 .
77.It Bq Er ESRCH
78Thread
79.Fa td
80has been jailed and process
81.Fa p
82does not belong to the same jail as
83.Fa td .
84.It Bq Er ESRCH
85The MAC subsystem denied visibility.
86.El
87.Sh SEE ALSO
88.Xr jail 2 ,
89.Xr sysctl 8 ,
90.Xr cr_cansee 9 ,
91.Xr mac 9 ,
92.Xr p_candebug 9 ,
93.Xr prison_check 9
94