xref: /illumos-gate/usr/src/lib/libkvm/kvm.h (revision 1320caf7)
17c478bd9Sstevel@tonic-gate /*
27c478bd9Sstevel@tonic-gate  * CDDL HEADER START
37c478bd9Sstevel@tonic-gate  *
47c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
57c478bd9Sstevel@tonic-gate  * Common Development and Distribution License, Version 1.0 only
67c478bd9Sstevel@tonic-gate  * (the "License").  You may not use this file except in compliance
77c478bd9Sstevel@tonic-gate  * with the License.
87c478bd9Sstevel@tonic-gate  *
97c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
107c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
117c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
127c478bd9Sstevel@tonic-gate  * and limitations under the License.
137c478bd9Sstevel@tonic-gate  *
147c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
157c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
167c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
177c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
187c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
197c478bd9Sstevel@tonic-gate  *
207c478bd9Sstevel@tonic-gate  * CDDL HEADER END
217c478bd9Sstevel@tonic-gate  */
227c478bd9Sstevel@tonic-gate /*
237c478bd9Sstevel@tonic-gate  * Copyright (c) 1987-1998 by Sun Microsystems, Inc.
247c478bd9Sstevel@tonic-gate  * All rights reserved.
257c478bd9Sstevel@tonic-gate  */
267c478bd9Sstevel@tonic-gate 
27*1320caf7SBryan Cantrill /*
28*1320caf7SBryan Cantrill  * Copyright (c) 2013, Joyent, Inc.  All rights reserved.
29*1320caf7SBryan Cantrill  */
30*1320caf7SBryan Cantrill 
317c478bd9Sstevel@tonic-gate #ifndef	_KVM_H
327c478bd9Sstevel@tonic-gate #define	_KVM_H
337c478bd9Sstevel@tonic-gate 
347c478bd9Sstevel@tonic-gate #include <sys/types.h>
357c478bd9Sstevel@tonic-gate #include <nlist.h>
367c478bd9Sstevel@tonic-gate #include <sys/user.h>
377c478bd9Sstevel@tonic-gate #include <sys/proc.h>
387c478bd9Sstevel@tonic-gate 
397c478bd9Sstevel@tonic-gate 
407c478bd9Sstevel@tonic-gate #ifdef __cplusplus
417c478bd9Sstevel@tonic-gate extern "C" {
427c478bd9Sstevel@tonic-gate #endif
437c478bd9Sstevel@tonic-gate 
447c478bd9Sstevel@tonic-gate /* define a 'cookie' to pass around between user code and the library */
457c478bd9Sstevel@tonic-gate typedef struct _kvmd kvm_t;
467c478bd9Sstevel@tonic-gate 
477c478bd9Sstevel@tonic-gate /* libkvm routine definitions */
487c478bd9Sstevel@tonic-gate 
497c478bd9Sstevel@tonic-gate #ifdef __STDC__
507c478bd9Sstevel@tonic-gate 
517c478bd9Sstevel@tonic-gate extern kvm_t	*kvm_open(const char *, const char *, const char *,
527c478bd9Sstevel@tonic-gate 		int, const char *);
537c478bd9Sstevel@tonic-gate extern int	kvm_close(kvm_t *);
547c478bd9Sstevel@tonic-gate extern int	kvm_nlist(kvm_t *, struct nlist []);
557c478bd9Sstevel@tonic-gate extern ssize_t	kvm_read(kvm_t *, uintptr_t, void *, size_t);
567c478bd9Sstevel@tonic-gate extern ssize_t	kvm_kread(kvm_t *, uintptr_t, void *, size_t);
577c478bd9Sstevel@tonic-gate extern ssize_t	kvm_uread(kvm_t *, uintptr_t, void *, size_t);
587c478bd9Sstevel@tonic-gate extern ssize_t	kvm_aread(kvm_t *, uintptr_t, void *, size_t, struct as *);
597c478bd9Sstevel@tonic-gate extern ssize_t	kvm_pread(kvm_t *, uint64_t, void *, size_t);
607c478bd9Sstevel@tonic-gate extern ssize_t	kvm_write(kvm_t *, uintptr_t, const void *, size_t);
617c478bd9Sstevel@tonic-gate extern ssize_t	kvm_kwrite(kvm_t *, uintptr_t, const void *, size_t);
627c478bd9Sstevel@tonic-gate extern ssize_t	kvm_uwrite(kvm_t *, uintptr_t, const void *, size_t);
637c478bd9Sstevel@tonic-gate extern ssize_t	kvm_awrite(kvm_t *, uintptr_t, const void *, size_t,
647c478bd9Sstevel@tonic-gate 		struct as *);
657c478bd9Sstevel@tonic-gate extern ssize_t	kvm_pwrite(kvm_t *, uint64_t, const void *, size_t);
667c478bd9Sstevel@tonic-gate extern uint64_t	kvm_physaddr(kvm_t *, struct as *, uintptr_t);
677c478bd9Sstevel@tonic-gate extern proc_t	*kvm_getproc(kvm_t *, pid_t);
687c478bd9Sstevel@tonic-gate extern proc_t	*kvm_nextproc(kvm_t *);
697c478bd9Sstevel@tonic-gate extern int	kvm_setproc(kvm_t *);
707c478bd9Sstevel@tonic-gate extern user_t	*kvm_getu(kvm_t *, struct proc *);
717c478bd9Sstevel@tonic-gate extern int	kvm_getcmd(kvm_t *, proc_t *, user_t *, char ***, char ***);
72*1320caf7SBryan Cantrill extern const char *kvm_namelist(kvm_t *);
737c478bd9Sstevel@tonic-gate 
747c478bd9Sstevel@tonic-gate #else
757c478bd9Sstevel@tonic-gate 
767c478bd9Sstevel@tonic-gate extern kvm_t	*kvm_open();
777c478bd9Sstevel@tonic-gate extern int	kvm_close();
787c478bd9Sstevel@tonic-gate extern int	kvm_nlist();
797c478bd9Sstevel@tonic-gate extern ssize_t	kvm_read();
807c478bd9Sstevel@tonic-gate extern ssize_t	kvm_kread();
817c478bd9Sstevel@tonic-gate extern ssize_t	kvm_uread();
827c478bd9Sstevel@tonic-gate extern ssize_t	kvm_aread();
837c478bd9Sstevel@tonic-gate extern ssize_t	kvm_pread();
847c478bd9Sstevel@tonic-gate extern ssize_t	kvm_write();
857c478bd9Sstevel@tonic-gate extern ssize_t	kvm_kwrite();
867c478bd9Sstevel@tonic-gate extern ssize_t	kvm_uwrite();
877c478bd9Sstevel@tonic-gate extern ssize_t	kvm_awrite();
887c478bd9Sstevel@tonic-gate extern ssize_t	kvm_pwrite();
897c478bd9Sstevel@tonic-gate extern uint64_t	Kvm_physaddr();
907c478bd9Sstevel@tonic-gate extern proc_t	*kvm_getproc();
917c478bd9Sstevel@tonic-gate extern proc_t	*kvm_nextproc();
927c478bd9Sstevel@tonic-gate extern int	kvm_setproc();
937c478bd9Sstevel@tonic-gate extern user_t	*kvm_getu();
947c478bd9Sstevel@tonic-gate extern int	kvm_getcmd();
957c478bd9Sstevel@tonic-gate 
967c478bd9Sstevel@tonic-gate #endif	/* __STDC__ */
977c478bd9Sstevel@tonic-gate 
987c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
997c478bd9Sstevel@tonic-gate }
1007c478bd9Sstevel@tonic-gate #endif
1017c478bd9Sstevel@tonic-gate 
1027c478bd9Sstevel@tonic-gate #endif	/* _KVM_H */
103