agent/src/os/solaris/proc/salibproc.h

Fri, 24 Jul 2009 12:40:40 -0700

author
never
date
Fri, 24 Jul 2009 12:40:40 -0700
changeset 1327
a94af87c3357
parent 435
a61af66fc99e
child 1907
c18cbe5936b8
permissions
-rw-r--r--

6861984: solaris version of libsaproc.so should support SA_ALTROOT directly
Reviewed-by: kvn, twisti

duke@435 1 /*
duke@435 2 * Copyright 2003-2005 Sun Microsystems, Inc. All Rights Reserved.
duke@435 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
duke@435 4 *
duke@435 5 * This code is free software; you can redistribute it and/or modify it
duke@435 6 * under the terms of the GNU General Public License version 2 only, as
duke@435 7 * published by the Free Software Foundation.
duke@435 8 *
duke@435 9 * This code is distributed in the hope that it will be useful, but WITHOUT
duke@435 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
duke@435 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
duke@435 12 * version 2 for more details (a copy is included in the LICENSE file that
duke@435 13 * accompanied this code).
duke@435 14 *
duke@435 15 * You should have received a copy of the GNU General Public License version
duke@435 16 * 2 along with this work; if not, write to the Free Software Foundation,
duke@435 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
duke@435 18 *
duke@435 19 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
duke@435 20 * CA 95054 USA or visit www.sun.com if you need additional information or
duke@435 21 * have any questions.
duke@435 22 *
duke@435 23 */
duke@435 24 #ifndef _SALIBPROC_H_
duke@435 25 #define _SALIBPROC_H_
duke@435 26
duke@435 27 /*
duke@435 28 * The following definitions, prototypes are from Solaris libproc.h.
duke@435 29 * We used to use the copy of it from Solaris 8.0. But there are
duke@435 30 * problems with that approach in building this library across Solaris
duke@435 31 * versions. Solaris 10 has libproc.h in /usr/include. And libproc.h
duke@435 32 * varies slightly across Solaris versions. On Solaris 9, we get
duke@435 33 * 'sysret_t multiply defined' error. This is common minimum subset we
duke@435 34 * really need from libproc.h. The libproc.h in the current dir has
duke@435 35 * been left for reference and not used in build.
duke@435 36 */
duke@435 37
duke@435 38 #include <dlfcn.h>
duke@435 39 #include <gelf.h>
duke@435 40 #include <procfs.h>
duke@435 41 #include <proc_service.h>
duke@435 42 #include <fcntl.h>
duke@435 43 #include <unistd.h>
duke@435 44
duke@435 45 #ifdef __cplusplus
duke@435 46 extern "C" {
duke@435 47 #endif
duke@435 48
duke@435 49 /*
duke@435 50 * 'object_name' is the name of a load object obtained from an
duke@435 51 * iteration over the process's address space mappings (Pmapping_iter),
duke@435 52 * or an iteration over the process's mapped objects (Pobject_iter),
duke@435 53 * or else it is one of the special PR_OBJ_* values above.
duke@435 54 */
duke@435 55
duke@435 56 extern int Plookup_by_addr(struct ps_prochandle *,
duke@435 57 uintptr_t, char *, size_t, GElf_Sym *);
duke@435 58
duke@435 59 typedef int proc_map_f(void *, const prmap_t *, const char *);
duke@435 60 extern int Pobject_iter(struct ps_prochandle *, proc_map_f *, void *);
duke@435 61
duke@435 62 /*
duke@435 63 * Utility functions for processing arguments which should be /proc files,
duke@435 64 * pids, and/or core files. The returned error code can be passed to
duke@435 65 * Pgrab_error() in order to convert it to an error string.
duke@435 66 */
duke@435 67 #define PR_ARG_PIDS 0x1 /* Allow pid and /proc file arguments */
duke@435 68 #define PR_ARG_CORES 0x2 /* Allow core file arguments */
duke@435 69 #define PR_ARG_ANY (PR_ARG_PIDS | PR_ARG_CORES)
duke@435 70
duke@435 71 /* Flags accepted by Pgrab() (partial) */
duke@435 72 #define PGRAB_FORCE 0x02 /* Open the process w/o O_EXCL */
duke@435 73
duke@435 74 /* Error codes from Pgrab(), Pfgrab_core(), and Pgrab_core() */
duke@435 75 #define G_STRANGE -1 /* Unanticipated error, errno is meaningful */
duke@435 76 #define G_NOPROC 1 /* No such process */
duke@435 77 #define G_NOCORE 2 /* No such core file */
duke@435 78 #define G_NOPROCORCORE 3 /* No such proc or core (for proc_arg_grab) */
duke@435 79 #define G_NOEXEC 4 /* Cannot locate executable file */
duke@435 80 #define G_ZOMB 5 /* Zombie process */
duke@435 81 #define G_PERM 6 /* No permission */
duke@435 82 #define G_BUSY 7 /* Another process has control */
duke@435 83 #define G_SYS 8 /* System process */
duke@435 84 #define G_SELF 9 /* Process is self */
duke@435 85 #define G_INTR 10 /* Interrupt received while grabbing */
duke@435 86 #define G_LP64 11 /* Process is _LP64, self is ILP32 */
duke@435 87 #define G_FORMAT 12 /* File is not an ELF format core file */
duke@435 88 #define G_ELF 13 /* Libelf error, elf_errno() is meaningful */
duke@435 89 #define G_NOTE 14 /* Required PT_NOTE Phdr not present in core */
duke@435 90
duke@435 91 extern struct ps_prochandle *proc_arg_grab(const char *, int, int, int *);
duke@435 92 extern const pstatus_t *Pstatus(struct ps_prochandle *);
duke@435 93
duke@435 94 /* Flags accepted by Prelease (partial) */
duke@435 95 #define PRELEASE_CLEAR 0x10 /* Clear all tracing flags */
duke@435 96
duke@435 97 extern void Prelease(struct ps_prochandle *, int);
duke@435 98 extern int Psetrun(struct ps_prochandle *, int, int);
duke@435 99 extern int Pstop(struct ps_prochandle *, uint_t);
duke@435 100
duke@435 101 /*
duke@435 102 * Stack frame iteration interface.
duke@435 103 */
duke@435 104 typedef int proc_stack_f(void *, const prgregset_t, uint_t, const long *);
duke@435 105 extern int Pstack_iter(struct ps_prochandle *,
duke@435 106 const prgregset_t, proc_stack_f *, void *);
duke@435 107
duke@435 108 #define PR_OBJ_EVERY ((const char *)-1) /* search every load object */
duke@435 109
duke@435 110
duke@435 111 #ifdef __cplusplus
duke@435 112 }
duke@435 113 #endif
duke@435 114
duke@435 115 #endif /* _SALIBPROC_H_ */

mercurial