kvm.h revision 181880
1253544Shselasky/*- 2253544Shselasky * Copyright (c) 1989, 1993 3253544Shselasky * The Regents of the University of California. All rights reserved. 4253544Shselasky * 5253544Shselasky * Redistribution and use in source and binary forms, with or without 6253544Shselasky * modification, are permitted provided that the following conditions 7253544Shselasky * are met: 8253544Shselasky * 1. Redistributions of source code must retain the above copyright 9253544Shselasky * notice, this list of conditions and the following disclaimer. 10253544Shselasky * 2. Redistributions in binary form must reproduce the above copyright 11253544Shselasky * notice, this list of conditions and the following disclaimer in the 12253544Shselasky * documentation and/or other materials provided with the distribution. 13253544Shselasky * 4. Neither the name of the University nor the names of its contributors 14253544Shselasky * may be used to endorse or promote products derived from this software 15253544Shselasky * without specific prior written permission. 16253544Shselasky * 17253544Shselasky * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 18253544Shselasky * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19253544Shselasky * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 20253544Shselasky * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 21253544Shselasky * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 22253544Shselasky * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 23253544Shselasky * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 24253544Shselasky * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 25253544Shselasky * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 26253544Shselasky * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27253544Shselasky * SUCH DAMAGE. 28253544Shselasky * 29253544Shselasky * @(#)kvm.h 8.1 (Berkeley) 6/2/93 30253544Shselasky * $FreeBSD: head/lib/libkvm/kvm.h 181880 2008-08-19 21:30:36Z jhb $ 31253544Shselasky */ 32253618Sobrien 33253618Sobrien#ifndef _KVM_H_ 34253618Sobrien#define _KVM_H_ 35253544Shselasky 36253544Shselasky#include <sys/cdefs.h> 37253544Shselasky#include <sys/_types.h> 38253544Shselasky#include <nlist.h> 39253544Shselasky 40253544Shselasky/* Default version symbol. */ 41253544Shselasky#define VRS_SYM "_version" 42253544Shselasky#define VRS_KEY "VERSION" 43253544Shselasky 44253544Shselasky#ifndef _SIZE_T_DECLARED 45253544Shselaskytypedef __size_t size_t; 46253544Shselasky#define _SIZE_T_DECLARED 47253544Shselasky#endif 48253544Shselasky 49253544Shselasky#ifndef _SSIZE_T_DECLARED 50253544Shselaskytypedef __ssize_t ssize_t; 51253544Shselasky#define _SSIZE_T_DECLARED 52253544Shselasky#endif 53253544Shselasky 54253544Shselaskytypedef struct __kvm kvm_t; 55253544Shselasky 56253544Shselaskystruct kinfo_proc; 57253544Shselaskystruct proc; 58253544Shselasky 59253544Shselaskystruct kvm_swap { 60253544Shselasky char ksw_devname[32]; 61253544Shselasky int ksw_used; 62253544Shselasky int ksw_total; 63253544Shselasky int ksw_flags; 64253544Shselasky int ksw_reserved1; 65253544Shselasky int ksw_reserved2; 66253544Shselasky}; 67253544Shselasky 68253544Shselasky#define SWIF_DEV_PREFIX 0x0002 69253544Shselasky 70253544Shselasky__BEGIN_DECLS 71253544Shselaskyint kvm_close(kvm_t *); 72253544Shselaskychar **kvm_getargv(kvm_t *, const struct kinfo_proc *, int); 73253544Shselaskyint kvm_getcptime(kvm_t *, long *); 74253544Shselaskychar **kvm_getenvv(kvm_t *, const struct kinfo_proc *, int); 75253544Shselaskychar *kvm_geterr(kvm_t *); 76253544Shselaskychar *kvm_getfiles(kvm_t *, int, int, int *); 77253544Shselaskyint kvm_getloadavg(kvm_t *, double [], int); 78253544Shselaskyint kvm_getmaxcpu(kvm_t *); 79253544Shselaskyvoid *kvm_getpcpu(kvm_t *, int); 80253544Shselaskystruct kinfo_proc * 81253544Shselasky kvm_getprocs(kvm_t *, int, int, int *); 82253544Shselaskyint kvm_getswapinfo(kvm_t *, struct kvm_swap *, int, int); 83253544Shselaskyint kvm_nlist(kvm_t *, struct nlist *); 84253544Shselaskykvm_t *kvm_open 85253544Shselasky (const char *, const char *, const char *, int, const char *); 86253544Shselaskykvm_t *kvm_openfiles 87253544Shselasky (const char *, const char *, const char *, int, char *); 88253544Shselaskyssize_t kvm_read(kvm_t *, unsigned long, void *, size_t); 89253544Shselaskyssize_t kvm_uread 90253544Shselasky (kvm_t *, struct kinfo_proc *, unsigned long, char *, size_t); 91253544Shselaskyssize_t kvm_write(kvm_t *, unsigned long, const void *, size_t); 92253544Shselasky__END_DECLS 93253544Shselasky 94253544Shselasky#endif /* !_KVM_H_ */ 95253544Shselasky