xref: /freebsd/share/man/man9/p_cansee.9 (revision 06c3fb27)
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 August 18, 2023
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/proc.h
35.Ft int
36.Fn p_cansee "struct thread *td" "struct proc *p"
37.Sh DESCRIPTION
38This function determines if a given process
39.Fa p
40is visible to the thread
41.Fa td ,
42where the notion of
43.Dq visibility
44may be read as
45.Dq "awareness of existence" .
46.Pp
47This function explicitly allows a thread to always see its own process,
48even with pending credentials changes
49.Po
50see
51.Xr ucred 9
52.Pc .
53Otherwise, it simply defers to
54.Xr cr_cansee 9 .
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 ESRCH otherwise.
66.Sh ERRORS
67.Bl -tag -width Er
68.It Bq Er ESRCH
69Thread
70.Fa td
71is not part of process
72.Fa p
73and cannot see it as determined by
74.Xr cr_cansee 9 .
75.El
76.Sh SEE ALSO
77.Xr ucred 9 ,
78.Xr cr_cansee 9 ,
79.Xr p_candebug 9
80