kvm.h revision 121060
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 121060 2003-10-13 04:44:55Z bde $ 351539Srgrimes */ 361539Srgrimes 371539Srgrimes#ifndef _KVM_H_ 381539Srgrimes#define _KVM_H_ 391539Srgrimes 4045513Sbde#include <sys/cdefs.h> 41102227Smike#include <sys/_types.h> 4245513Sbde#include <nlist.h> 4345513Sbde 441539Srgrimes/* Default version symbol. */ 451539Srgrimes#define VRS_SYM "_version" 461539Srgrimes#define VRS_KEY "VERSION" 471539Srgrimes 48102227Smike#ifndef _SIZE_T_DECLARED 49102227Smiketypedef __size_t size_t; 50102227Smike#define _SIZE_T_DECLARED 5141882Sbde#endif 521539Srgrimes 53102227Smike#ifndef _SSIZE_T_DECLARED 54102227Smiketypedef __ssize_t ssize_t; 55102227Smike#define _SSIZE_T_DECLARED 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_DEV_PREFIX 0x0002 7343085Sdillon 7441882Sbde__BEGIN_DECLS 7592917Sobrienint kvm_close(kvm_t *); 7692917Sobrienchar **kvm_getargv(kvm_t *, const struct kinfo_proc *, int); 7792917Sobrienchar **kvm_getenvv(kvm_t *, const struct kinfo_proc *, int); 7892917Sobrienchar *kvm_geterr(kvm_t *); 7992917Sobrienchar *kvm_getfiles(kvm_t *, int, int, int *); 8092917Sobrienint kvm_getloadavg(kvm_t *, double [], int); 811539Srgrimesstruct kinfo_proc * 8292917Sobrien kvm_getprocs(kvm_t *, int, int, int *); 8392917Sobrienint kvm_getswapinfo(kvm_t *, struct kvm_swap *, int, int); 8492917Sobrienint kvm_nlist(kvm_t *, struct nlist *); 851539Srgrimeskvm_t *kvm_open 86121060Sbde (const char *, const char *, const char *, int, const char *); 871539Srgrimeskvm_t *kvm_openfiles 88121060Sbde (const char *, const char *, const char *, int, char *); 8992917Sobrienssize_t kvm_read(kvm_t *, unsigned long, void *, size_t); 9041882Sbdessize_t kvm_uread 91121060Sbde (kvm_t *, struct kinfo_proc *, unsigned long, char *, size_t); 9292917Sobrienssize_t kvm_write(kvm_t *, unsigned long, const void *, size_t); 931539Srgrimes__END_DECLS 941539Srgrimes 951539Srgrimes#endif /* !_KVM_H_ */ 96