xref: /csrg-svn/lib/libkvm/kvm_private.h (revision 61278)
153112Smckusick /*-
2*61278Sbostic  * Copyright (c) 1992, 1993
3*61278Sbostic  *	The Regents of the University of California.  All rights reserved.
453112Smckusick  *
553658Sbostic  * This code is derived from software developed by the Computer Systems
653658Sbostic  * Engineering group at Lawrence Berkeley Laboratory under DARPA contract
753658Sbostic  * BG 91-66 and contributed to Berkeley.
853658Sbostic  *
953112Smckusick  * %sccs.include.redist.c%
1053112Smckusick  *
11*61278Sbostic  *	@(#)kvm_private.h	8.1 (Berkeley) 06/04/93
1253112Smckusick  */
1353112Smckusick 
1453112Smckusick struct __kvm {
1553112Smckusick 	/*
1653112Smckusick 	 * a string to be prepended to error messages
1753112Smckusick 	 * provided for compatibility with sun's interface
1853112Smckusick 	 * if this value is null, errors are saved in errbuf[]
1953112Smckusick 	 */
2053112Smckusick 	const char *program;
2153112Smckusick 	char	*errp;		/* XXX this can probably go away */
2253112Smckusick 	char	errbuf[_POSIX2_LINE_MAX];
2353616Ssklower 	DB	*db;
2453112Smckusick #define ISALIVE(kd) ((kd)->vmfd >= 0)
2553112Smckusick 	int	pmfd;		/* physical memory file (or crashdump) */
2653112Smckusick 	int	vmfd;		/* virtual memory file (-1 if crashdump) */
2753112Smckusick 	int	swfd;		/* swap file (e.g., /dev/drum) */
2853112Smckusick 	int	nlfd;		/* namelist file (e.g., /vmunix) */
2953112Smckusick 	struct kinfo_proc *procbase;
3053112Smckusick 	char	*argspc;	/* (dynamic) storage for argv strings */
3153112Smckusick 	int	arglen;		/* length of the above */
3253112Smckusick 	char	**argv;		/* (dynamic) storage for argv pointers */
3353112Smckusick 	int	argc;		/* length of above (not actual # present) */
3453112Smckusick 	/*
3553112Smckusick 	 * Kernel virtual address translation state.  This only gets filled
3653112Smckusick 	 * in for dead kernels; otherwise, the running kernel (i.e. kmem)
3753112Smckusick 	 * will do the translations for us.  It could be big, so we
3853112Smckusick 	 * only allocate it if necessary.
3953112Smckusick 	 */
4053112Smckusick 	struct vmstate *vmst;
4153112Smckusick };
4253112Smckusick 
4353112Smckusick /*
4453112Smckusick  * Functions used internally by kvm, but across kvm modules.
4553112Smckusick  */
4653616Ssklower void	 _kvm_err __P((kvm_t *kd, const char *program, const char *fmt, ...));
4753616Ssklower void	 _kvm_freeprocs __P((kvm_t *kd));
4853616Ssklower void	 _kvm_freevtop __P((kvm_t *));
4953616Ssklower int	 _kvm_initvtop __P((kvm_t *));
5053616Ssklower int	 _kvm_kvatop __P((kvm_t *, u_long, u_long *));
5153616Ssklower void	*_kvm_malloc __P((kvm_t *kd, size_t));
5253616Ssklower void	*_kvm_realloc __P((kvm_t *kd, void *, size_t));
5353616Ssklower void	 _kvm_syserr
5453616Ssklower 	    __P((kvm_t *kd, const char *program, const char *fmt, ...));
5553616Ssklower int	 _kvm_uvatop __P((kvm_t *, const struct proc *, u_long, u_long *));
56