kvm.h revision 50473
1252504Slstewart/*- 2252504Slstewart * Copyright (c) 1989, 1993 3252504Slstewart * The Regents of the University of California. All rights reserved. 4252504Slstewart * 5252504Slstewart * Redistribution and use in source and binary forms, with or without 6252504Slstewart * modification, are permitted provided that the following conditions 7252504Slstewart * are met: 8252504Slstewart * 1. Redistributions of source code must retain the above copyright 9252504Slstewart * notice, this list of conditions and the following disclaimer. 10252504Slstewart * 2. Redistributions in binary form must reproduce the above copyright 11252504Slstewart * notice, this list of conditions and the following disclaimer in the 12252504Slstewart * documentation and/or other materials provided with the distribution. 13252504Slstewart * 3. All advertising materials mentioning features or use of this software 14252504Slstewart * must display the following acknowledgement: 15252504Slstewart * This product includes software developed by the University of 16252504Slstewart * California, Berkeley and its contributors. 17252504Slstewart * 4. Neither the name of the University nor the names of its contributors 18252504Slstewart * may be used to endorse or promote products derived from this software 19252504Slstewart * without specific prior written permission. 20252504Slstewart * 21252504Slstewart * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 22252504Slstewart * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23252504Slstewart * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24252504Slstewart * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 25252504Slstewart * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 26252504Slstewart * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 27252504Slstewart * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28252504Slstewart * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 29252504Slstewart * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 30252504Slstewart * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31252504Slstewart * SUCH DAMAGE. 32252504Slstewart * 33252504Slstewart * @(#)kvm.h 8.1 (Berkeley) 6/2/93 34252504Slstewart * $FreeBSD: head/lib/libkvm/kvm.h 50473 1999-08-27 23:45:13Z peter $ 35252504Slstewart */ 36252504Slstewart 37252504Slstewart#ifndef _KVM_H_ 38252504Slstewart#define _KVM_H_ 39252504Slstewart 40252504Slstewart#include <sys/cdefs.h> 41252504Slstewart#include <machine/ansi.h> 42252504Slstewart#include <nlist.h> 43252504Slstewart 44252504Slstewart/* Default version symbol. */ 45252504Slstewart#define VRS_SYM "_version" 46252504Slstewart#define VRS_KEY "VERSION" 47252504Slstewart 48252504Slstewart#ifdef _BSD_SIZE_T_ 49252504Slstewarttypedef _BSD_SIZE_T_ size_t; 50252504Slstewart#undef _BSD_SIZE_T_ 51252504Slstewart#endif 52252504Slstewart 53252504Slstewart#ifdef _BSD_SSIZE_T_ 54252504Slstewarttypedef _BSD_SSIZE_T_ ssize_t; 55252504Slstewart#undef _BSD_SSIZE_T_ 56252504Slstewart#endif 57252504Slstewart 58252504Slstewarttypedef struct __kvm kvm_t; 59252504Slstewart 60252504Slstewartstruct kinfo_proc; 61252504Slstewartstruct proc; 62252504Slstewart 63252504Slstewartstruct kvm_swap { 64252504Slstewart char ksw_devname[32]; 65252504Slstewart int ksw_used; 66252504Slstewart int ksw_total; 67252504Slstewart int ksw_flags; 68252504Slstewart int ksw_reserved1; 69252504Slstewart int ksw_reserved2; 70252504Slstewart}; 71252504Slstewart 72252504Slstewart#define SWIF_DUMP_TREE 0x0001 73252504Slstewart#define SWIF_DEV_PREFIX 0x0002 74252504Slstewart 75252504Slstewart__BEGIN_DECLS 76252504Slstewartint kvm_close __P((kvm_t *)); 77252504Slstewartchar **kvm_getargv __P((kvm_t *, const struct kinfo_proc *, int)); 78252504Slstewartchar **kvm_getenvv __P((kvm_t *, const struct kinfo_proc *, int)); 79252504Slstewartchar *kvm_geterr __P((kvm_t *)); 80252504Slstewartchar *kvm_getfiles __P((kvm_t *, int, int, int *)); 81252504Slstewartint kvm_getloadavg __P((kvm_t *, double [], int)); 82252504Slstewartstruct kinfo_proc * 83252504Slstewart kvm_getprocs __P((kvm_t *, int, int, int *)); 84252504Slstewartint kvm_getswapinfo __P((kvm_t *, struct kvm_swap *, int, int)); 85252504Slstewartint kvm_nlist __P((kvm_t *, struct nlist *)); 86252504Slstewartkvm_t *kvm_open 87252504Slstewart __P((const char *, const char *, const char *, int, const char *)); 88252504Slstewartkvm_t *kvm_openfiles 89252504Slstewart __P((const char *, const char *, const char *, int, char *)); 90252504Slstewartssize_t kvm_read __P((kvm_t *, unsigned long, void *, size_t)); 91252504Slstewartssize_t kvm_uread 92252504Slstewart __P((kvm_t *, const struct proc *, unsigned long, char *, size_t)); 93252504Slstewartssize_t kvm_write __P((kvm_t *, unsigned long, const void *, size_t)); 94252504Slstewart__END_DECLS 95252504Slstewart 96252504Slstewart#endif /* !_KVM_H_ */ 97252504Slstewart