Date: Sat, 3 May 2014 13:59:12 +0400 From: Sergey Kandaurov <pluknet@freebsd.org> To: Mikolaj Golub <trociny@freebsd.org> Cc: John-Mark Gurney <jmg@funkthat.com>, Mateusz Guzik <mjguzik@gmail.com>, FreeBSD Arch <freebsd-arch@freebsd.org> Subject: Re: safer alternative for pfind and pget? Message-ID: <CAE-mSO%2B7=0wkowLKse_KwsE7yMMETv_MDifgX5RgCt0LTTotCA@mail.gmail.com> In-Reply-To: <20140503091213.GA3876@gmail.com> References: <20140502220925.GB28158@dft-labs.eu> <20140502223609.GU43976@funkthat.com> <20140503091213.GA3876@gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
[-- Attachment #1 --] On 3 May 2014 13:12, Mikolaj Golub <trociny@freebsd.org> wrote: > On Fri, May 02, 2014 at 03:36:09PM -0700, John-Mark Gurney wrote: >> Mateusz Guzik wrote this message on Sat, May 03, 2014 at 00:09 +0200: >> > - pget which provides limited (mostly negative) filtering >> >> as pget is undocumented, please make it part of this project to >> document it.. > > pluknet had a man page for pget long time ago, reviewed by kib. I > thought it was committed. Don't know why it did not happen. This is something I have for pget(9). If it is good enough, I'll commit it. -- wbr, pluknet [-- Attachment #2 --] .\" Copyright (c) 2011 Sergey Kandaurov .\" 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 AUTHOR AND CONTRIBUTORS ``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 AUTHOR OR CONTRIBUTORS 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. .\" .\" $FreeBSD$ .\" .Dd December 21, 2011 .Dt PGET 9 .Os .Sh NAME .Nm pget .Nd locate a process by number .Sh SYNOPSIS .In sys/param.h .In sys/proc.h .Ft int .Fn pget "pid_t pid" "int flags" "struct proc **pp" .Sh DESCRIPTION This function takes a .Fa pid as its argument and fills a pointer to the .Vt proc structure in .Fa *pp . The actual operation is performed by invoking the .Xr pfind 9 function. The found process is returned locked. Only for .Dv PGET_HOLD case it is returned unlocked (but referenced). The .Fn pget function can perform additional manipulations, depending on a .Fa flags argument. .Pp The .Fa flags argument is the logical OR of some subset of: .Bl -tag -width ".Dv PGET_NOTINEXEC" .It Dv PGET_HOLD If set, the found process will be referenced and unlocked. .It Dv PGET_CANSEE If set, the found process will be checked for its visibility. See .Xr p_cansee 9 . .It Dv PGET_CANDEBUG If set, the found process will be checked for its debuggability. See .Xr p_candebug 9 . .It Dv PGET_ISCURRENT If set, the found process will be checked that it matches the current process context. .It Dv PGET_NOTWEXIT If set, the found process will be checked that it does not have the process flag .Dv P_WEXIT set. .It Dv PGET_NOTINEXEC If set, the found process will be checked that it does not have the process flag .Dv P_INEXEC set. .It Dv PGET_NOTID If set, .Fa pid is not assumed as a thread id for values larger than .Dv PID_MAX . .It Dv PGET_WANTREAD A shorthand for .Pq Dv PGET_HOLD | PGET_CANDEBUG | PGET_NOTWEXIT . .El .Sh RETURN VALUES If the process is found in the specified way, then zero is returned, otherwise an appropriate error code is returned. .Sh SEE ALSO .Xr p_candebug 9 , .Xr p_cansee 9 , .Xr pfind 9
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAE-mSO%2B7=0wkowLKse_KwsE7yMMETv_MDifgX5RgCt0LTTotCA>
