freebsd-src/share/man/man9/p_cansee.9
Olivier Certner 2ede38aff5 p_cansee(9): Bring up-to-date, misc fixes
Essentially defer to cr_cansee(9), except for the specifics.

Be more specific on the return codes.

Reviewed by:            bcr, pauamma_gundo.com
MFC after:              2 weeks
Sponsored by:           Kumacom SAS
Differential Revision:  https://reviews.freebsd.org/D40637
2023-09-28 12:05:46 -03:00

80 lines
2.3 KiB
Groff

.\"
.\" Copyright (c) 2003 Joseph Koshy <jkoshy@FreeBSD.org>
.\" Copyright (c) 2006 Ceri Davies <ceri@FreeBSD.org>
.\"
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR
.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
.\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd August 18, 2023
.Dt P_CANSEE 9
.Os
.Sh NAME
.Nm p_cansee
.Nd determine visibility of a process
.Sh SYNOPSIS
.In sys/proc.h
.Ft int
.Fn p_cansee "struct thread *td" "struct proc *p"
.Sh DESCRIPTION
This function determines if a given process
.Fa p
is visible to the thread
.Fa td ,
where the notion of
.Dq visibility
may be read as
.Dq "awareness of existence" .
.Pp
This function explicitly allows a thread to always see its own process,
even with pending credentials changes
.Po
see
.Xr ucred 9
.Pc .
Otherwise, it simply defers to
.Xr cr_cansee 9 .
.Sh RETURN VALUES
The
.Fn p_cansee
function
returns
.Li 0
if the process denoted by
.Fa p
is visible by thread
.Fa td ,
or ESRCH otherwise.
.Sh ERRORS
.Bl -tag -width Er
.It Bq Er ESRCH
Thread
.Fa td
is not part of process
.Fa p
and cannot see it as determined by
.Xr cr_cansee 9 .
.El
.Sh SEE ALSO
.Xr ucred 9 ,
.Xr cr_cansee 9 ,
.Xr p_candebug 9