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