xref: /original-bsd/lib/libkvm/kvm_private.h (revision c3e32dec)
1 /*-
2  * Copyright (c) 1992, 1993
3  *	The Regents of the University of California.  All rights reserved.
4  *
5  * This code is derived from software developed by the Computer Systems
6  * Engineering group at Lawrence Berkeley Laboratory under DARPA contract
7  * BG 91-66 and contributed to Berkeley.
8  *
9  * %sccs.include.redist.c%
10  *
11  *	@(#)kvm_private.h	8.1 (Berkeley) 06/04/93
12  */
13 
14 struct __kvm {
15 	/*
16 	 * a string to be prepended to error messages
17 	 * provided for compatibility with sun's interface
18 	 * if this value is null, errors are saved in errbuf[]
19 	 */
20 	const char *program;
21 	char	*errp;		/* XXX this can probably go away */
22 	char	errbuf[_POSIX2_LINE_MAX];
23 	DB	*db;
24 #define ISALIVE(kd) ((kd)->vmfd >= 0)
25 	int	pmfd;		/* physical memory file (or crashdump) */
26 	int	vmfd;		/* virtual memory file (-1 if crashdump) */
27 	int	swfd;		/* swap file (e.g., /dev/drum) */
28 	int	nlfd;		/* namelist file (e.g., /vmunix) */
29 	struct kinfo_proc *procbase;
30 	char	*argspc;	/* (dynamic) storage for argv strings */
31 	int	arglen;		/* length of the above */
32 	char	**argv;		/* (dynamic) storage for argv pointers */
33 	int	argc;		/* length of above (not actual # present) */
34 	/*
35 	 * Kernel virtual address translation state.  This only gets filled
36 	 * in for dead kernels; otherwise, the running kernel (i.e. kmem)
37 	 * will do the translations for us.  It could be big, so we
38 	 * only allocate it if necessary.
39 	 */
40 	struct vmstate *vmst;
41 };
42 
43 /*
44  * Functions used internally by kvm, but across kvm modules.
45  */
46 void	 _kvm_err __P((kvm_t *kd, const char *program, const char *fmt, ...));
47 void	 _kvm_freeprocs __P((kvm_t *kd));
48 void	 _kvm_freevtop __P((kvm_t *));
49 int	 _kvm_initvtop __P((kvm_t *));
50 int	 _kvm_kvatop __P((kvm_t *, u_long, u_long *));
51 void	*_kvm_malloc __P((kvm_t *kd, size_t));
52 void	*_kvm_realloc __P((kvm_t *kd, void *, size_t));
53 void	 _kvm_syserr
54 	    __P((kvm_t *kd, const char *program, const char *fmt, ...));
55 int	 _kvm_uvatop __P((kvm_t *, const struct proc *, u_long, u_long *));
56