From owner-svn-src-head@FreeBSD.ORG Sat May 3 18:50:48 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id C0DC6307; Sat, 3 May 2014 18:50:48 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id AD36B184F; Sat, 3 May 2014 18:50:48 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.8/8.14.8) with ESMTP id s43IomeL004257; Sat, 3 May 2014 18:50:48 GMT (envelope-from pluknet@svn.freebsd.org) Received: (from pluknet@localhost) by svn.freebsd.org (8.14.8/8.14.8/Submit) id s43Iom8Q004254; Sat, 3 May 2014 18:50:48 GMT (envelope-from pluknet@svn.freebsd.org) Message-Id: <201405031850.s43Iom8Q004254@svn.freebsd.org> From: Sergey Kandaurov Date: Sat, 3 May 2014 18:50:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r265285 - head/share/man/man9 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 03 May 2014 18:50:48 -0000 Author: pluknet Date: Sat May 3 18:50:47 2014 New Revision: 265285 URL: http://svnweb.freebsd.org/changeset/base/265285 Log: Documented the pget(9) system kernel interface. Reviewed by: trociny, kib MFC after: 1 week Added: head/share/man/man9/pget.9 (contents, props changed) Modified: head/share/man/man9/Makefile Modified: head/share/man/man9/Makefile ============================================================================== --- head/share/man/man9/Makefile Sat May 3 18:12:26 2014 (r265284) +++ head/share/man/man9/Makefile Sat May 3 18:50:47 2014 (r265285) @@ -192,6 +192,7 @@ MAN= accept_filter.9 \ pci.9 \ pfil.9 \ pfind.9 \ + pget.9 \ pgfind.9 \ physio.9 \ pmap.9 \ Added: head/share/man/man9/pget.9 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/share/man/man9/pget.9 Sat May 3 18:50:47 2014 (r265285) @@ -0,0 +1,105 @@ +.\" 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 May 3, 2014 +.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, +which can be either a process or thread id, +and fills a pointer to the +.Vt proc +structure in +.Fa *pp . +In the latter case, a process owning the specified thread is looked for. +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 held). +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