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: releng/11.0/lib/libkvm/kvm.h 298840 2016-04-30 09:21:13Z ngie $ 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 54291406Sjhbtypedef uint64_t kvaddr_t; /* An address in a target image. */ 55291406Sjhb 56291406Sjhbstruct kvm_nlist { 57291406Sjhb const char *n_name; 58291406Sjhb unsigned char n_type; 59291406Sjhb kvaddr_t n_value; 60291406Sjhb}; 61291406Sjhb 621539Srgrimestypedef struct __kvm kvm_t; 631539Srgrimes 641539Srgrimesstruct kinfo_proc; 6541882Sbdestruct proc; 6641882Sbde 6743282Sbdestruct kvm_swap { 6843085Sdillon char ksw_devname[32]; 6943085Sdillon int ksw_used; 7043085Sdillon int ksw_total; 7143085Sdillon int ksw_flags; 7243085Sdillon int ksw_reserved1; 7343085Sdillon int ksw_reserved2; 7443282Sbde}; 7543085Sdillon 7643085Sdillon#define SWIF_DEV_PREFIX 0x0002 7743085Sdillon 7841882Sbde__BEGIN_DECLS 7992917Sobrienint kvm_close(kvm_t *); 80204511Srwatsonint kvm_dpcpu_setcpu(kvm_t *, unsigned int); 8192917Sobrienchar **kvm_getargv(kvm_t *, const struct kinfo_proc *, int); 82181880Sjhbint kvm_getcptime(kvm_t *, long *); 8392917Sobrienchar **kvm_getenvv(kvm_t *, const struct kinfo_proc *, int); 8492917Sobrienchar *kvm_geterr(kvm_t *); 8592917Sobrienint kvm_getloadavg(kvm_t *, double [], int); 86181876Sjhbint kvm_getmaxcpu(kvm_t *); 87261805Sglebiusint kvm_getncpus(kvm_t *); 88181876Sjhbvoid *kvm_getpcpu(kvm_t *, int); 89249344Sglebiusuint64_t kvm_counter_u64_fetch(kvm_t *, u_long); 901539Srgrimesstruct kinfo_proc * 9192917Sobrien kvm_getprocs(kvm_t *, int, int, int *); 9292917Sobrienint kvm_getswapinfo(kvm_t *, struct kvm_swap *, int, int); 93291406Sjhbint kvm_native(kvm_t *); 9492917Sobrienint kvm_nlist(kvm_t *, struct nlist *); 95291406Sjhbint kvm_nlist2(kvm_t *, struct kvm_nlist *); 961539Srgrimeskvm_t *kvm_open 97121060Sbde (const char *, const char *, const char *, int, const char *); 981539Srgrimeskvm_t *kvm_openfiles 99121060Sbde (const char *, const char *, const char *, int, char *); 100291406Sjhbkvm_t *kvm_open2 101291406Sjhb (const char *, const char *, int, char *, 102291406Sjhb int (*)(const char *, kvaddr_t *)); 10392917Sobrienssize_t kvm_read(kvm_t *, unsigned long, void *, size_t); 104261796Sglebiusssize_t kvm_read_zpcpu(kvm_t *, unsigned long, void *, size_t, int); 105291406Sjhbssize_t kvm_read2(kvm_t *, kvaddr_t, void *, size_t); 10692917Sobrienssize_t kvm_write(kvm_t *, unsigned long, const void *, size_t); 1071539Srgrimes__END_DECLS 1081539Srgrimes 1091539Srgrimes#endif /* !_KVM_H_ */ 110