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