kvm.h revision 92917
11539Srgrimes/*- 21539Srgrimes * Copyright (c) 1989, 1993 31539Srgrimes * The Regents of the University of California. All rights reserved. 41539Srgrimes * 51539Srgrimes * Redistribution and use in source and binary forms, with or without 61539Srgrimes * modification, are permitted provided that the following conditions 71539Srgrimes * are met: 81539Srgrimes * 1. Redistributions of source code must retain the above copyright 91539Srgrimes * notice, this list of conditions and the following disclaimer. 101539Srgrimes * 2. Redistributions in binary form must reproduce the above copyright 111539Srgrimes * notice, this list of conditions and the following disclaimer in the 121539Srgrimes * documentation and/or other materials provided with the distribution. 131539Srgrimes * 3. All advertising materials mentioning features or use of this software 141539Srgrimes * must display the following acknowledgement: 151539Srgrimes * This product includes software developed by the University of 161539Srgrimes * California, Berkeley and its contributors. 171539Srgrimes * 4. Neither the name of the University nor the names of its contributors 181539Srgrimes * may be used to endorse or promote products derived from this software 191539Srgrimes * without specific prior written permission. 201539Srgrimes * 211539Srgrimes * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 221539Srgrimes * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 231539Srgrimes * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 241539Srgrimes * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 251539Srgrimes * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 261539Srgrimes * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 271539Srgrimes * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 281539Srgrimes * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 291539Srgrimes * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 301539Srgrimes * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 311539Srgrimes * SUCH DAMAGE. 321539Srgrimes * 331539Srgrimes * @(#)kvm.h 8.1 (Berkeley) 6/2/93 3450473Speter * $FreeBSD: head/lib/libkvm/kvm.h 92917 2002-03-21 23:54:04Z obrien $ 351539Srgrimes */ 361539Srgrimes 371539Srgrimes#ifndef _KVM_H_ 381539Srgrimes#define _KVM_H_ 391539Srgrimes 4045513Sbde#include <sys/cdefs.h> 4145513Sbde#include <machine/ansi.h> 4245513Sbde#include <nlist.h> 4345513Sbde 441539Srgrimes/* Default version symbol. */ 451539Srgrimes#define VRS_SYM "_version" 461539Srgrimes#define VRS_KEY "VERSION" 471539Srgrimes 4841882Sbde#ifdef _BSD_SIZE_T_ 4941882Sbdetypedef _BSD_SIZE_T_ size_t; 5041882Sbde#undef _BSD_SIZE_T_ 5141882Sbde#endif 521539Srgrimes 5341882Sbde#ifdef _BSD_SSIZE_T_ 5441882Sbdetypedef _BSD_SSIZE_T_ ssize_t; 5541882Sbde#undef _BSD_SSIZE_T_ 5641882Sbde#endif 5741882Sbde 581539Srgrimestypedef struct __kvm kvm_t; 591539Srgrimes 601539Srgrimesstruct kinfo_proc; 6141882Sbdestruct proc; 6241882Sbde 6343282Sbdestruct kvm_swap { 6443085Sdillon char ksw_devname[32]; 6543085Sdillon int ksw_used; 6643085Sdillon int ksw_total; 6743085Sdillon int ksw_flags; 6843085Sdillon int ksw_reserved1; 6943085Sdillon int ksw_reserved2; 7043282Sbde}; 7143085Sdillon 7243085Sdillon#define SWIF_DUMP_TREE 0x0001 7343085Sdillon#define SWIF_DEV_PREFIX 0x0002 7443085Sdillon 7541882Sbde__BEGIN_DECLS 7692917Sobrienint kvm_close(kvm_t *); 7792917Sobrienchar **kvm_getargv(kvm_t *, const struct kinfo_proc *, int); 7892917Sobrienchar **kvm_getenvv(kvm_t *, const struct kinfo_proc *, int); 7992917Sobrienchar *kvm_geterr(kvm_t *); 8092917Sobrienchar *kvm_getfiles(kvm_t *, int, int, int *); 8192917Sobrienint kvm_getloadavg(kvm_t *, double [], int); 821539Srgrimesstruct kinfo_proc * 8392917Sobrien kvm_getprocs(kvm_t *, int, int, int *); 8492917Sobrienint kvm_getswapinfo(kvm_t *, struct kvm_swap *, int, int); 8592917Sobrienint kvm_nlist(kvm_t *, struct nlist *); 861539Srgrimeskvm_t *kvm_open 8792917Sobrien(const char *, const char *, const char *, int, const char *); 881539Srgrimeskvm_t *kvm_openfiles 8992917Sobrien(const char *, const char *, const char *, int, char *); 9092917Sobrienssize_t kvm_read(kvm_t *, unsigned long, void *, size_t); 9141882Sbdessize_t kvm_uread 9292917Sobrien(kvm_t *, struct kinfo_proc *, unsigned long, char *, size_t); 9392917Sobrienssize_t kvm_write(kvm_t *, unsigned long, const void *, size_t); 941539Srgrimes__END_DECLS 951539Srgrimes 961539Srgrimes#endif /* !_KVM_H_ */ 97