1239310Sdim/*- 2239310Sdim * Copyright (c) 1989, 1993 3239310Sdim * The Regents of the University of California. All rights reserved. 4239310Sdim * 5239310Sdim * Redistribution and use in source and binary forms, with or without 6239310Sdim * modification, are permitted provided that the following conditions 7239310Sdim * are met: 8239310Sdim * 1. Redistributions of source code must retain the above copyright 9239310Sdim * notice, this list of conditions and the following disclaimer. 10239310Sdim * 2. Redistributions in binary form must reproduce the above copyright 11239310Sdim * notice, this list of conditions and the following disclaimer in the 12239310Sdim * documentation and/or other materials provided with the distribution. 13239310Sdim * 4. Neither the name of the University nor the names of its contributors 14239310Sdim * may be used to endorse or promote products derived from this software 15249423Sdim * without specific prior written permission. 16239310Sdim * 17249423Sdim * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 18239310Sdim * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19239310Sdim * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 20239310Sdim * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 21239310Sdim * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 22239310Sdim * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 23239310Sdim * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 24243830Sdim * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 25249423Sdim * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 26249423Sdim * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27249423Sdim * SUCH DAMAGE. 28239310Sdim * 29239310Sdim * @(#)kvm.h 8.1 (Berkeley) 6/2/93 30239310Sdim * $FreeBSD: stable/10/lib/libkvm/kvm.h 312253 2017-01-16 03:52:20Z pfg $ 31239310Sdim */ 32249423Sdim 33249423Sdim#ifndef _KVM_H_ 34249423Sdim#define _KVM_H_ 35263508Sdim 36263508Sdim#include <sys/cdefs.h> 37263508Sdim#include <sys/types.h> 38263508Sdim#include <nlist.h> 39263508Sdim 40263508Sdim/* Default version symbol. */ 41263508Sdim#define VRS_SYM "_version" 42263508Sdim#define VRS_KEY "VERSION" 43263508Sdim 44263508Sdim#ifndef _SIZE_T_DECLARED 45263508Sdimtypedef __size_t size_t; 46263508Sdim#define _SIZE_T_DECLARED 47263508Sdim#endif 48263508Sdim 49263508Sdim#ifndef _SSIZE_T_DECLARED 50251662Sdimtypedef __ssize_t ssize_t; 51251662Sdim#define _SSIZE_T_DECLARED 52249423Sdim#endif 53251662Sdim 54249423Sdimtypedef struct __kvm kvm_t; 55249423Sdim 56249423Sdimstruct kinfo_proc; 57249423Sdimstruct proc; 58251662Sdim 59251662Sdimstruct kvm_swap { 60251662Sdim char ksw_devname[32]; 61263508Sdim u_int ksw_used; 62263508Sdim u_int ksw_total; 63251662Sdim int ksw_flags; 64263508Sdim u_int ksw_reserved1; 65263508Sdim u_int ksw_reserved2; 66249423Sdim}; 67249423Sdim 68249423Sdim#define SWIF_DEV_PREFIX 0x0002 69249423Sdim 70249423Sdim__BEGIN_DECLS 71249423Sdimint kvm_close(kvm_t *); 72251662Sdimint kvm_dpcpu_setcpu(kvm_t *, unsigned int); 73263508Sdimchar **kvm_getargv(kvm_t *, const struct kinfo_proc *, int); 74249423Sdimint kvm_getcptime(kvm_t *, long *); 75251662Sdimchar **kvm_getenvv(kvm_t *, const struct kinfo_proc *, int); 76249423Sdimchar *kvm_geterr(kvm_t *); 77249423Sdimchar *kvm_getfiles(kvm_t *, int, int, int *); 78249423Sdimint kvm_getloadavg(kvm_t *, double [], int); 79249423Sdimint kvm_getmaxcpu(kvm_t *); 80249423Sdimint kvm_getncpus(kvm_t *); 81249423Sdimvoid *kvm_getpcpu(kvm_t *, int); 82249423Sdimuint64_t kvm_counter_u64_fetch(kvm_t *, u_long); 83249423Sdimstruct kinfo_proc * 84249423Sdim kvm_getprocs(kvm_t *, int, int, int *); 85249423Sdimint kvm_getswapinfo(kvm_t *, struct kvm_swap *, int, int); 86251662Sdimint kvm_nlist(kvm_t *, struct nlist *); 87249423Sdimkvm_t *kvm_open 88251662Sdim (const char *, const char *, const char *, int, const char *); 89251662Sdimkvm_t *kvm_openfiles 90251662Sdim (const char *, const char *, const char *, int, char *); 91251662Sdimssize_t kvm_read(kvm_t *, unsigned long, void *, size_t); 92251662Sdimssize_t kvm_read_zpcpu(kvm_t *, unsigned long, void *, size_t, int); 93251662Sdimssize_t kvm_write(kvm_t *, unsigned long, const void *, size_t); 94263508Sdim__END_DECLS 95263508Sdim 96251662Sdim#endif /* !_KVM_H_ */ 97249423Sdim