11539Srgrimes/*-
21539Srgrimes * Copyright (c) 1989, 1993
31539Srgrimes *	The Regents of the University of California.  All rights reserved.
41539Srgrimes *
51539Srgrimes * Redistribution and use in source and binary forms, with or without
61539Srgrimes * modification, are permitted provided that the following conditions
71539Srgrimes * are met:
81539Srgrimes * 1. Redistributions of source code must retain the above copyright
91539Srgrimes *    notice, this list of conditions and the following disclaimer.
101539Srgrimes * 2. Redistributions in binary form must reproduce the above copyright
111539Srgrimes *    notice, this list of conditions and the following disclaimer in the
121539Srgrimes *    documentation and/or other materials provided with the distribution.
131539Srgrimes * 4. Neither the name of the University nor the names of its contributors
141539Srgrimes *    may be used to endorse or promote products derived from this software
151539Srgrimes *    without specific prior written permission.
161539Srgrimes *
171539Srgrimes * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
181539Srgrimes * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
191539Srgrimes * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
201539Srgrimes * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
211539Srgrimes * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
221539Srgrimes * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
231539Srgrimes * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
241539Srgrimes * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
251539Srgrimes * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
261539Srgrimes * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
271539Srgrimes * SUCH DAMAGE.
281539Srgrimes *
291539Srgrimes *	@(#)kvm.h	8.1 (Berkeley) 6/2/93
3050473Speter * $FreeBSD$
311539Srgrimes */
321539Srgrimes
331539Srgrimes#ifndef _KVM_H_
341539Srgrimes#define	_KVM_H_
351539Srgrimes
3645513Sbde#include <sys/cdefs.h>
37249355Sglebius#include <sys/types.h>
3845513Sbde#include <nlist.h>
3945513Sbde
401539Srgrimes/* Default version symbol. */
411539Srgrimes#define	VRS_SYM		"_version"
421539Srgrimes#define	VRS_KEY		"VERSION"
431539Srgrimes
44102227Smike#ifndef _SIZE_T_DECLARED
45102227Smiketypedef	__size_t	size_t;
46102227Smike#define	_SIZE_T_DECLARED
4741882Sbde#endif
481539Srgrimes
49102227Smike#ifndef _SSIZE_T_DECLARED
50102227Smiketypedef	__ssize_t	ssize_t;
51102227Smike#define	_SSIZE_T_DECLARED
5241882Sbde#endif
5341882Sbde
541539Srgrimestypedef struct __kvm kvm_t;
551539Srgrimes
561539Srgrimesstruct kinfo_proc;
5741882Sbdestruct proc;
5841882Sbde
5943282Sbdestruct kvm_swap {
6043085Sdillon	char	ksw_devname[32];
6143085Sdillon	int	ksw_used;
6243085Sdillon	int	ksw_total;
6343085Sdillon	int	ksw_flags;
6443085Sdillon	int	ksw_reserved1;
6543085Sdillon	int	ksw_reserved2;
6643282Sbde};
6743085Sdillon
6843085Sdillon#define SWIF_DEV_PREFIX	0x0002
6943085Sdillon
7041882Sbde__BEGIN_DECLS
7192917Sobrienint	  kvm_close(kvm_t *);
72204511Srwatsonint	  kvm_dpcpu_setcpu(kvm_t *, unsigned int);
7392917Sobrienchar	**kvm_getargv(kvm_t *, const struct kinfo_proc *, int);
74181880Sjhbint	  kvm_getcptime(kvm_t *, long *);
7592917Sobrienchar	**kvm_getenvv(kvm_t *, const struct kinfo_proc *, int);
7692917Sobrienchar	 *kvm_geterr(kvm_t *);
7792917Sobrienchar	 *kvm_getfiles(kvm_t *, int, int, int *);
7892917Sobrienint	  kvm_getloadavg(kvm_t *, double [], int);
79181876Sjhbint	  kvm_getmaxcpu(kvm_t *);
80262740Sglebiusint	  kvm_getncpus(kvm_t *);
81181876Sjhbvoid	 *kvm_getpcpu(kvm_t *, int);
82249344Sglebiusuint64_t  kvm_counter_u64_fetch(kvm_t *, u_long);
831539Srgrimesstruct kinfo_proc *
8492917Sobrien	  kvm_getprocs(kvm_t *, int, int, int *);
8592917Sobrienint	  kvm_getswapinfo(kvm_t *, struct kvm_swap *, int, int);
8692917Sobrienint	  kvm_nlist(kvm_t *, struct nlist *);
871539Srgrimeskvm_t	 *kvm_open
88121060Sbde	    (const char *, const char *, const char *, int, const char *);
891539Srgrimeskvm_t	 *kvm_openfiles
90121060Sbde	    (const char *, const char *, const char *, int, char *);
9192917Sobrienssize_t	  kvm_read(kvm_t *, unsigned long, void *, size_t);
92262740Sglebiusssize_t	  kvm_read_zpcpu(kvm_t *, unsigned long, void *, size_t, int);
9392917Sobrienssize_t	  kvm_write(kvm_t *, unsigned long, const void *, size_t);
941539Srgrimes__END_DECLS
951539Srgrimes
961539Srgrimes#endif /* !_KVM_H_ */
97