xref: /onnv-gate/usr/src/lib/libkvm/kvm.h (revision 0:68f95e015346)
1*0Sstevel@tonic-gate /*
2*0Sstevel@tonic-gate  * CDDL HEADER START
3*0Sstevel@tonic-gate  *
4*0Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5*0Sstevel@tonic-gate  * Common Development and Distribution License, Version 1.0 only
6*0Sstevel@tonic-gate  * (the "License").  You may not use this file except in compliance
7*0Sstevel@tonic-gate  * with the License.
8*0Sstevel@tonic-gate  *
9*0Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10*0Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
11*0Sstevel@tonic-gate  * See the License for the specific language governing permissions
12*0Sstevel@tonic-gate  * and limitations under the License.
13*0Sstevel@tonic-gate  *
14*0Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
15*0Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16*0Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
17*0Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
18*0Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
19*0Sstevel@tonic-gate  *
20*0Sstevel@tonic-gate  * CDDL HEADER END
21*0Sstevel@tonic-gate  */
22*0Sstevel@tonic-gate /*
23*0Sstevel@tonic-gate  * Copyright (c) 1987-1998 by Sun Microsystems, Inc.
24*0Sstevel@tonic-gate  * All rights reserved.
25*0Sstevel@tonic-gate  */
26*0Sstevel@tonic-gate 
27*0Sstevel@tonic-gate #ifndef	_KVM_H
28*0Sstevel@tonic-gate #define	_KVM_H
29*0Sstevel@tonic-gate 
30*0Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
31*0Sstevel@tonic-gate 
32*0Sstevel@tonic-gate #include <sys/types.h>
33*0Sstevel@tonic-gate #include <nlist.h>
34*0Sstevel@tonic-gate #include <sys/user.h>
35*0Sstevel@tonic-gate #include <sys/proc.h>
36*0Sstevel@tonic-gate 
37*0Sstevel@tonic-gate 
38*0Sstevel@tonic-gate #ifdef __cplusplus
39*0Sstevel@tonic-gate extern "C" {
40*0Sstevel@tonic-gate #endif
41*0Sstevel@tonic-gate 
42*0Sstevel@tonic-gate /* define a 'cookie' to pass around between user code and the library */
43*0Sstevel@tonic-gate typedef struct _kvmd kvm_t;
44*0Sstevel@tonic-gate 
45*0Sstevel@tonic-gate /* libkvm routine definitions */
46*0Sstevel@tonic-gate 
47*0Sstevel@tonic-gate #ifdef __STDC__
48*0Sstevel@tonic-gate 
49*0Sstevel@tonic-gate extern kvm_t	*kvm_open(const char *, const char *, const char *,
50*0Sstevel@tonic-gate 		int, const char *);
51*0Sstevel@tonic-gate extern int	kvm_close(kvm_t *);
52*0Sstevel@tonic-gate extern int	kvm_nlist(kvm_t *, struct nlist []);
53*0Sstevel@tonic-gate extern ssize_t	kvm_read(kvm_t *, uintptr_t, void *, size_t);
54*0Sstevel@tonic-gate extern ssize_t	kvm_kread(kvm_t *, uintptr_t, void *, size_t);
55*0Sstevel@tonic-gate extern ssize_t	kvm_uread(kvm_t *, uintptr_t, void *, size_t);
56*0Sstevel@tonic-gate extern ssize_t	kvm_aread(kvm_t *, uintptr_t, void *, size_t, struct as *);
57*0Sstevel@tonic-gate extern ssize_t	kvm_pread(kvm_t *, uint64_t, void *, size_t);
58*0Sstevel@tonic-gate extern ssize_t	kvm_write(kvm_t *, uintptr_t, const void *, size_t);
59*0Sstevel@tonic-gate extern ssize_t	kvm_kwrite(kvm_t *, uintptr_t, const void *, size_t);
60*0Sstevel@tonic-gate extern ssize_t	kvm_uwrite(kvm_t *, uintptr_t, const void *, size_t);
61*0Sstevel@tonic-gate extern ssize_t	kvm_awrite(kvm_t *, uintptr_t, const void *, size_t,
62*0Sstevel@tonic-gate 		struct as *);
63*0Sstevel@tonic-gate extern ssize_t	kvm_pwrite(kvm_t *, uint64_t, const void *, size_t);
64*0Sstevel@tonic-gate extern uint64_t	kvm_physaddr(kvm_t *, struct as *, uintptr_t);
65*0Sstevel@tonic-gate extern proc_t	*kvm_getproc(kvm_t *, pid_t);
66*0Sstevel@tonic-gate extern proc_t	*kvm_nextproc(kvm_t *);
67*0Sstevel@tonic-gate extern int	kvm_setproc(kvm_t *);
68*0Sstevel@tonic-gate extern user_t	*kvm_getu(kvm_t *, struct proc *);
69*0Sstevel@tonic-gate extern int	kvm_getcmd(kvm_t *, proc_t *, user_t *, char ***, char ***);
70*0Sstevel@tonic-gate 
71*0Sstevel@tonic-gate #else
72*0Sstevel@tonic-gate 
73*0Sstevel@tonic-gate extern kvm_t	*kvm_open();
74*0Sstevel@tonic-gate extern int	kvm_close();
75*0Sstevel@tonic-gate extern int	kvm_nlist();
76*0Sstevel@tonic-gate extern ssize_t	kvm_read();
77*0Sstevel@tonic-gate extern ssize_t	kvm_kread();
78*0Sstevel@tonic-gate extern ssize_t	kvm_uread();
79*0Sstevel@tonic-gate extern ssize_t	kvm_aread();
80*0Sstevel@tonic-gate extern ssize_t	kvm_pread();
81*0Sstevel@tonic-gate extern ssize_t	kvm_write();
82*0Sstevel@tonic-gate extern ssize_t	kvm_kwrite();
83*0Sstevel@tonic-gate extern ssize_t	kvm_uwrite();
84*0Sstevel@tonic-gate extern ssize_t	kvm_awrite();
85*0Sstevel@tonic-gate extern ssize_t	kvm_pwrite();
86*0Sstevel@tonic-gate extern uint64_t	Kvm_physaddr();
87*0Sstevel@tonic-gate extern proc_t	*kvm_getproc();
88*0Sstevel@tonic-gate extern proc_t	*kvm_nextproc();
89*0Sstevel@tonic-gate extern int	kvm_setproc();
90*0Sstevel@tonic-gate extern user_t	*kvm_getu();
91*0Sstevel@tonic-gate extern int	kvm_getcmd();
92*0Sstevel@tonic-gate 
93*0Sstevel@tonic-gate #endif	/* __STDC__ */
94*0Sstevel@tonic-gate 
95*0Sstevel@tonic-gate #ifdef	__cplusplus
96*0Sstevel@tonic-gate }
97*0Sstevel@tonic-gate #endif
98*0Sstevel@tonic-gate 
99*0Sstevel@tonic-gate #endif	/* _KVM_H */
100