10daf62d9SStanislav Sedov.\" 20daf62d9SStanislav Sedov.\" Copyright (c) 2009 Ulf Lilleengen 30daf62d9SStanislav Sedov.\" All rights reserved. 40daf62d9SStanislav Sedov.\" 50daf62d9SStanislav Sedov.\" Redistribution and use in source and binary forms, with or without 60daf62d9SStanislav Sedov.\" modification, are permitted provided that the following conditions 70daf62d9SStanislav Sedov.\" are met: 80daf62d9SStanislav Sedov.\" 1. Redistributions of source code must retain the above copyright 90daf62d9SStanislav Sedov.\" notice, this list of conditions and the following disclaimer. 100daf62d9SStanislav Sedov.\" 2. Redistributions in binary form must reproduce the above copyright 110daf62d9SStanislav Sedov.\" notice, this list of conditions and the following disclaimer in the 120daf62d9SStanislav Sedov.\" documentation and/or other materials provided with the distribution. 130daf62d9SStanislav Sedov.\" 140daf62d9SStanislav Sedov.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 150daf62d9SStanislav Sedov.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 160daf62d9SStanislav Sedov.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 170daf62d9SStanislav Sedov.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 180daf62d9SStanislav Sedov.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 190daf62d9SStanislav Sedov.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 200daf62d9SStanislav Sedov.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 210daf62d9SStanislav Sedov.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 220daf62d9SStanislav Sedov.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 230daf62d9SStanislav Sedov.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 240daf62d9SStanislav Sedov.\" SUCH DAMAGE. 250daf62d9SStanislav Sedov.\" 260daf62d9SStanislav Sedov.\" $FreeBSD$ 270daf62d9SStanislav Sedov.\" 28*d1a0cea4SRuslan Ermilov.Dd March 1, 2013 290daf62d9SStanislav Sedov.Dt KINFO_GETPROC 3 30bea977e7SJoel Dahl.Os 310daf62d9SStanislav Sedov.Sh NAME 320daf62d9SStanislav Sedov.Nm kinfo_getproc 330daf62d9SStanislav Sedov.Nd function for getting process information from kernel 340daf62d9SStanislav Sedov.Sh LIBRARY 350daf62d9SStanislav Sedov.Lb libutil 360daf62d9SStanislav Sedov.Sh SYNOPSIS 370daf62d9SStanislav Sedov.In sys/types.h 380daf62d9SStanislav Sedov.In libutil.h 390daf62d9SStanislav Sedov.Ft struct kinfo_proc * 40*d1a0cea4SRuslan Ermilov.Fn kinfo_getproc "pid_t pid" 410daf62d9SStanislav Sedov.Sh DESCRIPTION 420daf62d9SStanislav SedovThis function is used for obtaining process information from the kernel. 430daf62d9SStanislav Sedov.Pp 440daf62d9SStanislav SedovThe 450daf62d9SStanislav Sedov.Ar pid 460daf62d9SStanislav Sedovfield contains the process identifier. 473102cfe2SGlen BarberThis should be a process that you have privilege to access. 480daf62d9SStanislav SedovThis function is a wrapper around 490daf62d9SStanislav Sedov.Xr sysctl 3 500daf62d9SStanislav Sedovwith the 510daf62d9SStanislav Sedov.Dv KERN_PROC_PID 520daf62d9SStanislav Sedovmib. 530daf62d9SStanislav SedovWhile the kernel returns a packed structure, this function expands the 540daf62d9SStanislav Sedovdata into a fixed record format. 550daf62d9SStanislav Sedov.Sh RETURN VALUES 560daf62d9SStanislav SedovOn success the 570daf62d9SStanislav Sedov.Fn kinfo_getproc 580daf62d9SStanislav Sedovfunction returns a pointer to a 590daf62d9SStanislav Sedov.Vt struct kinfo_proc 600daf62d9SStanislav Sedovstructure as defined by 610daf62d9SStanislav Sedov.In sys/user.h . 620daf62d9SStanislav SedovThe pointer was obtained by an internal call to 630daf62d9SStanislav Sedov.Xr malloc 3 640daf62d9SStanislav Sedovand must be freed by the caller with a call to 650daf62d9SStanislav Sedov.Xr free 3 . 660daf62d9SStanislav SedovOn failure the 670daf62d9SStanislav Sedov.Fn kinfo_getproc 680daf62d9SStanislav Sedovfunction returns 690daf62d9SStanislav Sedov.Dv NULL . 700daf62d9SStanislav Sedov.Sh SEE ALSO 710daf62d9SStanislav Sedov.Xr free 3 , 720daf62d9SStanislav Sedov.Xr malloc 3 , 730daf62d9SStanislav Sedov.Xr sysctl 3 74