kvm_getfile2 man page on OpenBSD

Man page or keyword search:  
man Server   11362 pages
apropos Keyword Search (all sections)
Output format
OpenBSD logo
[printable version]

KVM_GETFILES(3)		  OpenBSD Programmer's Manual	       KVM_GETFILES(3)

NAME
     kvm_getfiles - survey open files

SYNOPSIS
     #include <kvm.h>
     #include <sys/types.h>
     #define _KERNEL
     #include <sys/file.h>
     #undef _KERNEL

     char *
     kvm_getfiles(kvm_t *kd, int op, int arg, int *cnt);

     struct kinfo_file2 *
     kvm_getfile2(kvm_t *kd, int op, int arg, size_t elemsize, int *cnt);

DESCRIPTION
     kvm_getfiles() returns a (sub-)set of the open files in the kernel
     indicated by kd.  The op and arg arguments constitute a predicate which
     limits the set of files returned.	No predicates are currently defined.

     The number of processes found is returned in the reference parameter cnt.
     The files are returned as a contiguous array of file structures, preceded
     by the address of the first file entry in the kernel.  This memory is
     owned by kvm and is not guaranteed to be persistent across subsequent kvm
     library calls.  Data should be copied out if it needs to be saved.

     kvm_getfile2() is similar to kvm_getfiles() but returns an array of
     kinfo_file2 structures.  Additionally, only the first elemsize bytes of
     each array entry are returned.  If the size of the kinfo_file2 structure
     increases in size in a future release of OpenBSD, the kernel will only
     return the requested amount of data for each array entry and programs
     that use kvm_getfile2() will continue to function without the need for
     recompilation.  The op and arg arguments constitute a predicate which
     limits the set of processes returned.  The value of op describes the
     filtering predicate as follows:

	   KERN_FILE_BYFILE	 all open files
	   KERN_PROC_BYPID	 files opened by process ID arg (-1 for all
				 processes)
	   KERN_FILE_BYUID	 files opened by processes with effective user
				 ID arg

     Files associated with a process will include information about the
     process that has the file open.

     The files are returned as a contiguous array of kinfo_file2 structures.
     The number of structures found is returned in the reference parameter
     cnt.  This memory is owned by kvm and will be overwritten by subsequent
     calls to kvm_getfile2() and destroyed by kvm_close().  Data should be
     copied out if it needs to be saved.

RETURN VALUES
     kvm_getfiles() and kvm_getfile2() will return NULL on failure.

SEE ALSO
     kvm(3), kvm_close(3), kvm_geterr(3), kvm_nlist(3), kvm_open(3),
     kvm_openfiles(3), kvm_read(3), kvm_write(3)

BUGS
     This routine does not belong in the kvm interface.

OpenBSD 4.9			 June 7, 2009			   OpenBSD 4.9
[top]

List of man pages available for OpenBSD

Copyright (c) for man pages and the logo by the respective OS vendor.

For those who want to learn more, the polarhome community provides shell access and support.

[legal] [privacy] [GNU] [policy] [cookies] [netiquette] [sponsors] [FAQ]
Tweet
Polarhome, production since 1999.
Member of Polarhome portal.
Based on Fawad Halim's script.
....................................................................
Vote for polarhome
Free Shell Accounts :: the biggest list on the net