annotate agent/src/os/solaris/proc/salibproc.h @ 9968:3df534c97af1

Create Suites instance in runtime.
author Roland Schatz <roland.schatz@oracle.com>
date Mon, 10 Jun 2013 16:06:09 +0200
parents 405c634f4aaa
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1 /*
3306
405c634f4aaa 7028172: 3/4 SA needs to adapt to Solaris libproc change made in 6748307
dcubed
parents: 1552
diff changeset
2 * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
0
a61af66fc99e Initial load
duke
parents:
diff changeset
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
a61af66fc99e Initial load
duke
parents:
diff changeset
4 *
a61af66fc99e Initial load
duke
parents:
diff changeset
5 * This code is free software; you can redistribute it and/or modify it
a61af66fc99e Initial load
duke
parents:
diff changeset
6 * under the terms of the GNU General Public License version 2 only, as
a61af66fc99e Initial load
duke
parents:
diff changeset
7 * published by the Free Software Foundation.
a61af66fc99e Initial load
duke
parents:
diff changeset
8 *
a61af66fc99e Initial load
duke
parents:
diff changeset
9 * This code is distributed in the hope that it will be useful, but WITHOUT
a61af66fc99e Initial load
duke
parents:
diff changeset
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
a61af66fc99e Initial load
duke
parents:
diff changeset
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
a61af66fc99e Initial load
duke
parents:
diff changeset
12 * version 2 for more details (a copy is included in the LICENSE file that
a61af66fc99e Initial load
duke
parents:
diff changeset
13 * accompanied this code).
a61af66fc99e Initial load
duke
parents:
diff changeset
14 *
a61af66fc99e Initial load
duke
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License version
a61af66fc99e Initial load
duke
parents:
diff changeset
16 * 2 along with this work; if not, write to the Free Software Foundation,
a61af66fc99e Initial load
duke
parents:
diff changeset
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
a61af66fc99e Initial load
duke
parents:
diff changeset
18 *
1552
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 0
diff changeset
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 0
diff changeset
20 * or visit www.oracle.com if you need additional information or have any
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 0
diff changeset
21 * questions.
0
a61af66fc99e Initial load
duke
parents:
diff changeset
22 *
a61af66fc99e Initial load
duke
parents:
diff changeset
23 */
a61af66fc99e Initial load
duke
parents:
diff changeset
24 #ifndef _SALIBPROC_H_
a61af66fc99e Initial load
duke
parents:
diff changeset
25 #define _SALIBPROC_H_
a61af66fc99e Initial load
duke
parents:
diff changeset
26
a61af66fc99e Initial load
duke
parents:
diff changeset
27 /*
a61af66fc99e Initial load
duke
parents:
diff changeset
28 * The following definitions, prototypes are from Solaris libproc.h.
a61af66fc99e Initial load
duke
parents:
diff changeset
29 * We used to use the copy of it from Solaris 8.0. But there are
a61af66fc99e Initial load
duke
parents:
diff changeset
30 * problems with that approach in building this library across Solaris
a61af66fc99e Initial load
duke
parents:
diff changeset
31 * versions. Solaris 10 has libproc.h in /usr/include. And libproc.h
a61af66fc99e Initial load
duke
parents:
diff changeset
32 * varies slightly across Solaris versions. On Solaris 9, we get
a61af66fc99e Initial load
duke
parents:
diff changeset
33 * 'sysret_t multiply defined' error. This is common minimum subset we
a61af66fc99e Initial load
duke
parents:
diff changeset
34 * really need from libproc.h. The libproc.h in the current dir has
a61af66fc99e Initial load
duke
parents:
diff changeset
35 * been left for reference and not used in build.
a61af66fc99e Initial load
duke
parents:
diff changeset
36 */
a61af66fc99e Initial load
duke
parents:
diff changeset
37
a61af66fc99e Initial load
duke
parents:
diff changeset
38 #include <dlfcn.h>
a61af66fc99e Initial load
duke
parents:
diff changeset
39 #include <gelf.h>
a61af66fc99e Initial load
duke
parents:
diff changeset
40 #include <procfs.h>
a61af66fc99e Initial load
duke
parents:
diff changeset
41 #include <proc_service.h>
a61af66fc99e Initial load
duke
parents:
diff changeset
42 #include <fcntl.h>
a61af66fc99e Initial load
duke
parents:
diff changeset
43 #include <unistd.h>
a61af66fc99e Initial load
duke
parents:
diff changeset
44
a61af66fc99e Initial load
duke
parents:
diff changeset
45 #ifdef __cplusplus
a61af66fc99e Initial load
duke
parents:
diff changeset
46 extern "C" {
a61af66fc99e Initial load
duke
parents:
diff changeset
47 #endif
a61af66fc99e Initial load
duke
parents:
diff changeset
48
a61af66fc99e Initial load
duke
parents:
diff changeset
49 /*
a61af66fc99e Initial load
duke
parents:
diff changeset
50 * 'object_name' is the name of a load object obtained from an
a61af66fc99e Initial load
duke
parents:
diff changeset
51 * iteration over the process's address space mappings (Pmapping_iter),
a61af66fc99e Initial load
duke
parents:
diff changeset
52 * or an iteration over the process's mapped objects (Pobject_iter),
a61af66fc99e Initial load
duke
parents:
diff changeset
53 * or else it is one of the special PR_OBJ_* values above.
a61af66fc99e Initial load
duke
parents:
diff changeset
54 */
a61af66fc99e Initial load
duke
parents:
diff changeset
55
a61af66fc99e Initial load
duke
parents:
diff changeset
56 extern int Plookup_by_addr(struct ps_prochandle *,
a61af66fc99e Initial load
duke
parents:
diff changeset
57 uintptr_t, char *, size_t, GElf_Sym *);
a61af66fc99e Initial load
duke
parents:
diff changeset
58
a61af66fc99e Initial load
duke
parents:
diff changeset
59 typedef int proc_map_f(void *, const prmap_t *, const char *);
a61af66fc99e Initial load
duke
parents:
diff changeset
60 extern int Pobject_iter(struct ps_prochandle *, proc_map_f *, void *);
a61af66fc99e Initial load
duke
parents:
diff changeset
61
a61af66fc99e Initial load
duke
parents:
diff changeset
62 /*
a61af66fc99e Initial load
duke
parents:
diff changeset
63 * Utility functions for processing arguments which should be /proc files,
a61af66fc99e Initial load
duke
parents:
diff changeset
64 * pids, and/or core files. The returned error code can be passed to
a61af66fc99e Initial load
duke
parents:
diff changeset
65 * Pgrab_error() in order to convert it to an error string.
a61af66fc99e Initial load
duke
parents:
diff changeset
66 */
a61af66fc99e Initial load
duke
parents:
diff changeset
67 #define PR_ARG_PIDS 0x1 /* Allow pid and /proc file arguments */
a61af66fc99e Initial load
duke
parents:
diff changeset
68 #define PR_ARG_CORES 0x2 /* Allow core file arguments */
a61af66fc99e Initial load
duke
parents:
diff changeset
69 #define PR_ARG_ANY (PR_ARG_PIDS | PR_ARG_CORES)
a61af66fc99e Initial load
duke
parents:
diff changeset
70
a61af66fc99e Initial load
duke
parents:
diff changeset
71 /* Flags accepted by Pgrab() (partial) */
a61af66fc99e Initial load
duke
parents:
diff changeset
72 #define PGRAB_FORCE 0x02 /* Open the process w/o O_EXCL */
a61af66fc99e Initial load
duke
parents:
diff changeset
73
a61af66fc99e Initial load
duke
parents:
diff changeset
74 /* Error codes from Pgrab(), Pfgrab_core(), and Pgrab_core() */
a61af66fc99e Initial load
duke
parents:
diff changeset
75 #define G_STRANGE -1 /* Unanticipated error, errno is meaningful */
a61af66fc99e Initial load
duke
parents:
diff changeset
76 #define G_NOPROC 1 /* No such process */
a61af66fc99e Initial load
duke
parents:
diff changeset
77 #define G_NOCORE 2 /* No such core file */
a61af66fc99e Initial load
duke
parents:
diff changeset
78 #define G_NOPROCORCORE 3 /* No such proc or core (for proc_arg_grab) */
a61af66fc99e Initial load
duke
parents:
diff changeset
79 #define G_NOEXEC 4 /* Cannot locate executable file */
a61af66fc99e Initial load
duke
parents:
diff changeset
80 #define G_ZOMB 5 /* Zombie process */
a61af66fc99e Initial load
duke
parents:
diff changeset
81 #define G_PERM 6 /* No permission */
a61af66fc99e Initial load
duke
parents:
diff changeset
82 #define G_BUSY 7 /* Another process has control */
a61af66fc99e Initial load
duke
parents:
diff changeset
83 #define G_SYS 8 /* System process */
a61af66fc99e Initial load
duke
parents:
diff changeset
84 #define G_SELF 9 /* Process is self */
a61af66fc99e Initial load
duke
parents:
diff changeset
85 #define G_INTR 10 /* Interrupt received while grabbing */
a61af66fc99e Initial load
duke
parents:
diff changeset
86 #define G_LP64 11 /* Process is _LP64, self is ILP32 */
a61af66fc99e Initial load
duke
parents:
diff changeset
87 #define G_FORMAT 12 /* File is not an ELF format core file */
a61af66fc99e Initial load
duke
parents:
diff changeset
88 #define G_ELF 13 /* Libelf error, elf_errno() is meaningful */
a61af66fc99e Initial load
duke
parents:
diff changeset
89 #define G_NOTE 14 /* Required PT_NOTE Phdr not present in core */
a61af66fc99e Initial load
duke
parents:
diff changeset
90
a61af66fc99e Initial load
duke
parents:
diff changeset
91 extern struct ps_prochandle *proc_arg_grab(const char *, int, int, int *);
a61af66fc99e Initial load
duke
parents:
diff changeset
92 extern const pstatus_t *Pstatus(struct ps_prochandle *);
a61af66fc99e Initial load
duke
parents:
diff changeset
93
a61af66fc99e Initial load
duke
parents:
diff changeset
94 /* Flags accepted by Prelease (partial) */
a61af66fc99e Initial load
duke
parents:
diff changeset
95 #define PRELEASE_CLEAR 0x10 /* Clear all tracing flags */
a61af66fc99e Initial load
duke
parents:
diff changeset
96
a61af66fc99e Initial load
duke
parents:
diff changeset
97 extern void Prelease(struct ps_prochandle *, int);
a61af66fc99e Initial load
duke
parents:
diff changeset
98 extern int Psetrun(struct ps_prochandle *, int, int);
a61af66fc99e Initial load
duke
parents:
diff changeset
99 extern int Pstop(struct ps_prochandle *, uint_t);
a61af66fc99e Initial load
duke
parents:
diff changeset
100
a61af66fc99e Initial load
duke
parents:
diff changeset
101 /*
a61af66fc99e Initial load
duke
parents:
diff changeset
102 * Stack frame iteration interface.
a61af66fc99e Initial load
duke
parents:
diff changeset
103 */
3306
405c634f4aaa 7028172: 3/4 SA needs to adapt to Solaris libproc change made in 6748307
dcubed
parents: 1552
diff changeset
104 #ifdef SOLARIS_11_B159_OR_LATER
405c634f4aaa 7028172: 3/4 SA needs to adapt to Solaris libproc change made in 6748307
dcubed
parents: 1552
diff changeset
105 /* building on Nevada-B159 or later so define the new callback */
405c634f4aaa 7028172: 3/4 SA needs to adapt to Solaris libproc change made in 6748307
dcubed
parents: 1552
diff changeset
106 typedef int proc_stack_f(
405c634f4aaa 7028172: 3/4 SA needs to adapt to Solaris libproc change made in 6748307
dcubed
parents: 1552
diff changeset
107 void *, /* the cookie given to Pstack_iter() */
405c634f4aaa 7028172: 3/4 SA needs to adapt to Solaris libproc change made in 6748307
dcubed
parents: 1552
diff changeset
108 const prgregset_t, /* the frame's registers */
405c634f4aaa 7028172: 3/4 SA needs to adapt to Solaris libproc change made in 6748307
dcubed
parents: 1552
diff changeset
109 uint_t, /* argc for the frame's function */
405c634f4aaa 7028172: 3/4 SA needs to adapt to Solaris libproc change made in 6748307
dcubed
parents: 1552
diff changeset
110 const long *, /* argv for the frame's function */
405c634f4aaa 7028172: 3/4 SA needs to adapt to Solaris libproc change made in 6748307
dcubed
parents: 1552
diff changeset
111 int, /* bitwise flags describing the frame (see below) */
405c634f4aaa 7028172: 3/4 SA needs to adapt to Solaris libproc change made in 6748307
dcubed
parents: 1552
diff changeset
112 int); /* a signal number */
405c634f4aaa 7028172: 3/4 SA needs to adapt to Solaris libproc change made in 6748307
dcubed
parents: 1552
diff changeset
113
405c634f4aaa 7028172: 3/4 SA needs to adapt to Solaris libproc change made in 6748307
dcubed
parents: 1552
diff changeset
114 #define PR_SIGNAL_FRAME 1 /* called by a signal handler */
405c634f4aaa 7028172: 3/4 SA needs to adapt to Solaris libproc change made in 6748307
dcubed
parents: 1552
diff changeset
115 #define PR_FOUND_SIGNAL 2 /* we found the corresponding signal number */
405c634f4aaa 7028172: 3/4 SA needs to adapt to Solaris libproc change made in 6748307
dcubed
parents: 1552
diff changeset
116 #else
405c634f4aaa 7028172: 3/4 SA needs to adapt to Solaris libproc change made in 6748307
dcubed
parents: 1552
diff changeset
117 /* building on Nevada-B158 or earlier so define the old callback */
0
a61af66fc99e Initial load
duke
parents:
diff changeset
118 typedef int proc_stack_f(void *, const prgregset_t, uint_t, const long *);
3306
405c634f4aaa 7028172: 3/4 SA needs to adapt to Solaris libproc change made in 6748307
dcubed
parents: 1552
diff changeset
119 #endif
405c634f4aaa 7028172: 3/4 SA needs to adapt to Solaris libproc change made in 6748307
dcubed
parents: 1552
diff changeset
120
0
a61af66fc99e Initial load
duke
parents:
diff changeset
121 extern int Pstack_iter(struct ps_prochandle *,
a61af66fc99e Initial load
duke
parents:
diff changeset
122 const prgregset_t, proc_stack_f *, void *);
a61af66fc99e Initial load
duke
parents:
diff changeset
123
a61af66fc99e Initial load
duke
parents:
diff changeset
124 #define PR_OBJ_EVERY ((const char *)-1) /* search every load object */
a61af66fc99e Initial load
duke
parents:
diff changeset
125
a61af66fc99e Initial load
duke
parents:
diff changeset
126
a61af66fc99e Initial load
duke
parents:
diff changeset
127 #ifdef __cplusplus
a61af66fc99e Initial load
duke
parents:
diff changeset
128 }
a61af66fc99e Initial load
duke
parents:
diff changeset
129 #endif
a61af66fc99e Initial load
duke
parents:
diff changeset
130
a61af66fc99e Initial load
duke
parents:
diff changeset
131 #endif /* _SALIBPROC_H_ */