kvm.h revision 217744
11541Srgrimes/*-
21541Srgrimes * Copyright (c) 1989, 1993
31541Srgrimes *	The Regents of the University of California.  All rights reserved.
41541Srgrimes *
51541Srgrimes * Redistribution and use in source and binary forms, with or without
61541Srgrimes * modification, are permitted provided that the following conditions
71541Srgrimes * are met:
81541Srgrimes * 1. Redistributions of source code must retain the above copyright
91541Srgrimes *    notice, this list of conditions and the following disclaimer.
101541Srgrimes * 2. Redistributions in binary form must reproduce the above copyright
111541Srgrimes *    notice, this list of conditions and the following disclaimer in the
121541Srgrimes *    documentation and/or other materials provided with the distribution.
131541Srgrimes * 4. Neither the name of the University nor the names of its contributors
141541Srgrimes *    may be used to endorse or promote products derived from this software
151541Srgrimes *    without specific prior written permission.
161541Srgrimes *
171541Srgrimes * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
181541Srgrimes * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
191541Srgrimes * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
201541Srgrimes * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
211541Srgrimes * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
221541Srgrimes * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
231541Srgrimes * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
241541Srgrimes * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
251541Srgrimes * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
261541Srgrimes * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
271541Srgrimes * SUCH DAMAGE.
281541Srgrimes *
291541Srgrimes *	@(#)kvm.h	8.1 (Berkeley) 6/2/93
301541Srgrimes * $FreeBSD: head/lib/libkvm/kvm.h 217744 2011-01-23 11:08:28Z uqs $
311541Srgrimes */
321541Srgrimes
331541Srgrimes#ifndef _KVM_H_
341541Srgrimes#define	_KVM_H_
351541Srgrimes
361541Srgrimes#include <sys/cdefs.h>
371541Srgrimes#include <sys/_types.h>
381541Srgrimes#include <nlist.h>
391541Srgrimes
402807Sbde/* Default version symbol. */
411541Srgrimes#define	VRS_SYM		"_version"
421541Srgrimes#define	VRS_KEY		"VERSION"
431541Srgrimes
441541Srgrimes#ifndef _SIZE_T_DECLARED
451541Srgrimestypedef	__size_t	size_t;
461541Srgrimes#define	_SIZE_T_DECLARED
471541Srgrimes#endif
481541Srgrimes
491541Srgrimes#ifndef _SSIZE_T_DECLARED
501541Srgrimestypedef	__ssize_t	ssize_t;
511541Srgrimes#define	_SSIZE_T_DECLARED
521541Srgrimes#endif
531541Srgrimes
541541Srgrimestypedef struct __kvm kvm_t;
551541Srgrimes
561541Srgrimesstruct kinfo_proc;
571541Srgrimesstruct proc;
581541Srgrimes
591541Srgrimesstruct kvm_swap {
601541Srgrimes	char	ksw_devname[32];
611541Srgrimes	int	ksw_used;
621541Srgrimes	int	ksw_total;
631541Srgrimes	int	ksw_flags;
641541Srgrimes	int	ksw_reserved1;
651541Srgrimes	int	ksw_reserved2;
661541Srgrimes};
671541Srgrimes
681541Srgrimes#define SWIF_DEV_PREFIX	0x0002
691541Srgrimes
701541Srgrimes__BEGIN_DECLS
711541Srgrimesint	  kvm_close(kvm_t *);
721541Srgrimesint	  kvm_dpcpu_setcpu(kvm_t *, unsigned int);
731541Srgrimeschar	**kvm_getargv(kvm_t *, const struct kinfo_proc *, int);
741541Srgrimesint	  kvm_getcptime(kvm_t *, long *);
751541Srgrimeschar	**kvm_getenvv(kvm_t *, const struct kinfo_proc *, int);
761541Srgrimeschar	 *kvm_geterr(kvm_t *);
771541Srgrimeschar	 *kvm_getfiles(kvm_t *, int, int, int *);
781541Srgrimesint	  kvm_getloadavg(kvm_t *, double [], int);
791541Srgrimesint	  kvm_getmaxcpu(kvm_t *);
801541Srgrimesvoid	 *kvm_getpcpu(kvm_t *, int);
811541Srgrimesstruct kinfo_proc *
821541Srgrimes	  kvm_getprocs(kvm_t *, int, int, int *);
831541Srgrimesint	  kvm_getswapinfo(kvm_t *, struct kvm_swap *, int, int);
841541Srgrimesint	  kvm_nlist(kvm_t *, struct nlist *);
851541Srgrimeskvm_t	 *kvm_open
861541Srgrimes	    (const char *, const char *, const char *, int, const char *);
871541Srgrimeskvm_t	 *kvm_openfiles
881541Srgrimes	    (const char *, const char *, const char *, int, char *);
891541Srgrimesssize_t	  kvm_read(kvm_t *, unsigned long, void *, size_t);
901541Srgrimesssize_t	  kvm_uread
911541Srgrimes	    (kvm_t *, const struct kinfo_proc *, unsigned long, char *, size_t);
921541Srgrimesssize_t	  kvm_write(kvm_t *, unsigned long, const void *, size_t);
931541Srgrimes__END_DECLS
941541Srgrimes
951541Srgrimes#endif /* !_KVM_H_ */
961541Srgrimes