xref: /netbsd-src/lib/libkvm/kvm_getfiles.3 (revision 86a5a956695e92122d545a1d7f799ffbec153314)
1*86a5a956Sjoerg.\"	$NetBSD: kvm_getfiles.3,v 1.11 2009/03/10 23:49:07 joerg Exp $
2346e67f8Sthorpej.\"
30215cc7dScgd.\" Copyright (c) 1992, 1993
40215cc7dScgd.\"	The Regents of the University of California.  All rights reserved.
50215cc7dScgd.\"
60215cc7dScgd.\" This code is derived from software developed by the Computer Systems
70215cc7dScgd.\" Engineering group at Lawrence Berkeley Laboratory under DARPA contract
80215cc7dScgd.\" BG 91-66 and contributed to Berkeley.
90215cc7dScgd.\"
100215cc7dScgd.\" Redistribution and use in source and binary forms, with or without
110215cc7dScgd.\" modification, are permitted provided that the following conditions
120215cc7dScgd.\" are met:
130215cc7dScgd.\" 1. Redistributions of source code must retain the above copyright
140215cc7dScgd.\"    notice, this list of conditions and the following disclaimer.
150215cc7dScgd.\" 2. Redistributions in binary form must reproduce the above copyright
160215cc7dScgd.\"    notice, this list of conditions and the following disclaimer in the
170215cc7dScgd.\"    documentation and/or other materials provided with the distribution.
18eb7c1594Sagc.\" 3. Neither the name of the University nor the names of its contributors
190215cc7dScgd.\"    may be used to endorse or promote products derived from this software
200215cc7dScgd.\"    without specific prior written permission.
210215cc7dScgd.\"
220215cc7dScgd.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
230215cc7dScgd.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
240215cc7dScgd.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
250215cc7dScgd.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
260215cc7dScgd.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
270215cc7dScgd.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
280215cc7dScgd.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
290215cc7dScgd.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
300215cc7dScgd.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
310215cc7dScgd.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
320215cc7dScgd.\" SUCH DAMAGE.
330215cc7dScgd.\"
340215cc7dScgd.\"     @(#)kvm_getfiles.3	8.2 (Berkeley) 4/19/94
350215cc7dScgd.\"
360215cc7dScgd.Dd April 19, 1994
370215cc7dScgd.Dt KVM_GETFILES 3
380215cc7dScgd.Os
390215cc7dScgd.Sh NAME
400215cc7dScgd.Nm kvm_getfiles
410215cc7dScgd.Nd survey open files
42312aca53Sperry.Sh LIBRARY
43312aca53Sperry.Lb libkvm
440215cc7dScgd.Sh SYNOPSIS
45472351e1Swiz.In kvm.h
46472351e1Swiz.In sys/kinfo.h
47a5c856b8Sjtc.Fd #define _KERNEL
48472351e1Swiz.In sys/file.h
49a5c856b8Sjtc.Fd #undef _KERNEL
500215cc7dScgd.\" .Fa kvm_t *kd
510215cc7dScgd.Ft char *
520215cc7dScgd.Fn kvm_getfiles "kvm_t *kd" "int op" "int arg" "int *cnt"
530215cc7dScgd.Sh DESCRIPTION
540215cc7dScgd.Fn kvm_getfiles
550215cc7dScgdreturns a (sub-)set of the open files in the kernel indicated by
560215cc7dScgd.Fa kd .
570215cc7dScgdThe
580215cc7dScgd.Fa op
590215cc7dScgdand
600215cc7dScgd.Fa arg
610215cc7dScgdarguments constitute a predicate which limits the set of files
62bec910b3Swizreturned.
63bec910b3SwizNo predicates are currently defined.
640215cc7dScgd.Pp
650215cc7dScgdThe number of processes found is returned in the reference parameter
660215cc7dScgd.Fa cnt .
670215cc7dScgdThe files are returned as a contiguous array of file structures,
680215cc7dScgdpreceded by the address of the first file entry in the kernel.
690215cc7dScgdThis memory is owned by kvm and is not guaranteed to be persistent across
70bec910b3Swizsubsequent kvm library calls.
71bec910b3SwizData should be copied out if it needs to be saved.
720215cc7dScgd.Sh RETURN VALUES
730215cc7dScgd.Fn kvm_getfiles
742923fb70Scgdwill return
752923fb70Scgd.Dv NULL
762923fb70Scgdon failure.
770215cc7dScgd.Sh SEE ALSO
780215cc7dScgd.Xr kvm 3 ,
79923580f4Swiz.Xr kvm_close 3 ,
80923580f4Swiz.Xr kvm_geterr 3 ,
81923580f4Swiz.Xr kvm_nlist 3 ,
820215cc7dScgd.Xr kvm_open 3 ,
830215cc7dScgd.Xr kvm_openfiles 3 ,
840215cc7dScgd.Xr kvm_read 3 ,
85923580f4Swiz.Xr kvm_write 3
86923580f4Swiz.Sh BUGS
87923580f4SwizThis routine does not belong in the kvm interface.
88