kvm_private.h revision 92941
156055Srwatson/*- 256055Srwatson * Copyright (c) 1992, 1993 356055Srwatson * The Regents of the University of California. All rights reserved. 456055Srwatson * 556055Srwatson * This code is derived from software developed by the Computer Systems 656055Srwatson * Engineering group at Lawrence Berkeley Laboratory under DARPA contract 756055Srwatson * BG 91-66 and contributed to Berkeley. 856055Srwatson * 956055Srwatson * Redistribution and use in source and binary forms, with or without 1056055Srwatson * modification, are permitted provided that the following conditions 1156055Srwatson * are met: 1256055Srwatson * 1. Redistributions of source code must retain the above copyright 1356055Srwatson * notice, this list of conditions and the following disclaimer. 1456055Srwatson * 2. Redistributions in binary form must reproduce the above copyright 1556055Srwatson * notice, this list of conditions and the following disclaimer in the 1656055Srwatson * documentation and/or other materials provided with the distribution. 1756055Srwatson * 3. All advertising materials mentioning features or use of this software 1856055Srwatson * must display the following acknowledgement: 1956055Srwatson * This product includes software developed by the University of 2056055Srwatson * California, Berkeley and its contributors. 2156055Srwatson * 4. Neither the name of the University nor the names of its contributors 2256055Srwatson * may be used to endorse or promote products derived from this software 2356055Srwatson * without specific prior written permission. 2456055Srwatson * 2556055Srwatson * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 2656055Srwatson * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 2756055Srwatson * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 2856055Srwatson * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 2956055Srwatson * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 3056625Srwatson * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 3156625Srwatson * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 3256055Srwatson * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 3356055Srwatson * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 3456055Srwatson * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 3556055Srwatson * SUCH DAMAGE. 3656055Srwatson * 3756055Srwatson * @(#)kvm_private.h 8.1 (Berkeley) 6/4/93 3856055Srwatson * $FreeBSD: head/lib/libkvm/kvm_private.h 92941 2002-03-22 09:22:15Z obrien $ 3956055Srwatson */ 4056055Srwatson 4156055Srwatsonstruct __kvm { 4256055Srwatson /* 4356055Srwatson * a string to be prepended to error messages 4456055Srwatson * provided for compatibility with sun's interface 4556274Srwatson * if this value is null, errors are saved in errbuf[] 4656055Srwatson */ 4771142Srwatson const char *program; 4856055Srwatson char *errp; /* XXX this can probably go away */ 4956055Srwatson char errbuf[_POSIX2_LINE_MAX]; 5056274Srwatson#define ISALIVE(kd) ((kd)->vmfd >= 0) 5156055Srwatson int pmfd; /* physical memory file (or crashdump) */ 5256055Srwatson int vmfd; /* virtual memory file (-1 if crashdump) */ 5371142Srwatson int unused; /* was: swap file (e.g., /dev/drum) */ 5456055Srwatson int nlfd; /* namelist file (e.g., /kernel) */ 5556055Srwatson struct kinfo_proc *procbase; 5656055Srwatson char *argspc; /* (dynamic) storage for argv strings */ 5756055Srwatson int arglen; /* length of the above */ 5856055Srwatson char **argv; /* (dynamic) storage for argv pointers */ 5956625Srwatson int argc; /* length of above (not actual # present) */ 6056625Srwatson char *argbuf; /* (dynamic) temporary storage */ 6156625Srwatson /* 6256625Srwatson * Kernel virtual address translation state. This only gets filled 6356625Srwatson * in for dead kernels; otherwise, the running kernel (i.e. kmem) 6456055Srwatson * will do the translations for us. It could be big, so we 6556625Srwatson * only allocate it if necessary. 6656625Srwatson */ 6771142Srwatson struct vmstate *vmst; 6856625Srwatson}; 6956625Srwatson 7056625Srwatson/* 7156625Srwatson * Functions used internally by kvm, but across kvm modules. 7256625Srwatson */ 7371142Srwatsonvoid _kvm_err(kvm_t *kd, const char *program, const char *fmt, ...) 7456625Srwatson __printflike(3, 4); 7556625Srwatsonvoid _kvm_freeprocs(kvm_t *kd); 7656625Srwatsonvoid _kvm_freevtop(kvm_t *); 7756625Srwatsonint _kvm_initvtop(kvm_t *); 7856625Srwatsonint _kvm_kvatop(kvm_t *, u_long, u_long *); 7956055Srwatsonvoid *_kvm_malloc(kvm_t *kd, size_t); 8056625Srwatsonvoid *_kvm_realloc(kvm_t *kd, void *, size_t); 8156055Srwatsonvoid _kvm_syserr (kvm_t *kd, const char *program, const char *fmt, ...) 8256055Srwatson __printflike(3, 4); 8356055Srwatsonint _kvm_uvatop(kvm_t *, const struct proc *, u_long, u_long *); 8456055Srwatson