annotate agent/src/os/solaris/proc/libproc.h @ 3011:f00918f35c7f

inlining and runtime interface related changes: added codeSize() and compilerStorage() to RiMethod HotSpotMethodResolved uses reflective methods instead of vmIds and survives compilations HotSpotResolvedType.isInitialized not represented as field (can change) inlining stores graphs into method objects and reuses them
author Lukas Stadler <lukas.stadler@jku.at>
date Thu, 16 Jun 2011 20:36:17 +0200
parents c18cbe5936b8
children 405c634f4aaa
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1 /*
1552
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 0
diff changeset
2 * Copyright (c) 2002, 2003, 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
a61af66fc99e Initial load
duke
parents:
diff changeset
25 /*
a61af66fc99e Initial load
duke
parents:
diff changeset
26 * Interfaces available from the process control library, libproc.
a61af66fc99e Initial load
duke
parents:
diff changeset
27 *
a61af66fc99e Initial load
duke
parents:
diff changeset
28 * libproc provides process control functions for the /proc tools
a61af66fc99e Initial load
duke
parents:
diff changeset
29 * (commands in /usr/proc/bin), /usr/bin/truss, and /usr/bin/gcore.
a61af66fc99e Initial load
duke
parents:
diff changeset
30 * libproc is a private support library for these commands only.
a61af66fc99e Initial load
duke
parents:
diff changeset
31 * It is _not_ a public interface, although it might become one
a61af66fc99e Initial load
duke
parents:
diff changeset
32 * in the fullness of time, when the interfaces settle down.
a61af66fc99e Initial load
duke
parents:
diff changeset
33 *
a61af66fc99e Initial load
duke
parents:
diff changeset
34 * In the meantime, be aware that any program linked with libproc in this
a61af66fc99e Initial load
duke
parents:
diff changeset
35 * release of Solaris is almost guaranteed to break in the next release.
a61af66fc99e Initial load
duke
parents:
diff changeset
36 *
a61af66fc99e Initial load
duke
parents:
diff changeset
37 * In short, do not use this header file or libproc for any purpose.
a61af66fc99e Initial load
duke
parents:
diff changeset
38 */
a61af66fc99e Initial load
duke
parents:
diff changeset
39
a61af66fc99e Initial load
duke
parents:
diff changeset
40 #ifndef _LIBPROC_H
a61af66fc99e Initial load
duke
parents:
diff changeset
41 #define _LIBPROC_H
a61af66fc99e Initial load
duke
parents:
diff changeset
42
a61af66fc99e Initial load
duke
parents:
diff changeset
43 #include <stdlib.h>
a61af66fc99e Initial load
duke
parents:
diff changeset
44 #include <unistd.h>
a61af66fc99e Initial load
duke
parents:
diff changeset
45 #include <fcntl.h>
a61af66fc99e Initial load
duke
parents:
diff changeset
46 #include <nlist.h>
a61af66fc99e Initial load
duke
parents:
diff changeset
47 #include <door.h>
a61af66fc99e Initial load
duke
parents:
diff changeset
48 #include <gelf.h>
a61af66fc99e Initial load
duke
parents:
diff changeset
49 #include <proc_service.h>
a61af66fc99e Initial load
duke
parents:
diff changeset
50 #include <rtld_db.h>
a61af66fc99e Initial load
duke
parents:
diff changeset
51 #include <procfs.h>
a61af66fc99e Initial load
duke
parents:
diff changeset
52 #include <sys/stat.h>
a61af66fc99e Initial load
duke
parents:
diff changeset
53 #include <sys/statvfs.h>
a61af66fc99e Initial load
duke
parents:
diff changeset
54 #include <sys/auxv.h>
a61af66fc99e Initial load
duke
parents:
diff changeset
55 #include <sys/resource.h>
a61af66fc99e Initial load
duke
parents:
diff changeset
56 #include <sys/socket.h>
a61af66fc99e Initial load
duke
parents:
diff changeset
57 #include <sys/utsname.h>
a61af66fc99e Initial load
duke
parents:
diff changeset
58
a61af66fc99e Initial load
duke
parents:
diff changeset
59 #ifdef __cplusplus
a61af66fc99e Initial load
duke
parents:
diff changeset
60 extern "C" {
a61af66fc99e Initial load
duke
parents:
diff changeset
61 #endif
a61af66fc99e Initial load
duke
parents:
diff changeset
62
a61af66fc99e Initial load
duke
parents:
diff changeset
63 /*
a61af66fc99e Initial load
duke
parents:
diff changeset
64 * Opaque structure tag reference to a process control structure.
a61af66fc99e Initial load
duke
parents:
diff changeset
65 * Clients of libproc cannot look inside the process control structure.
a61af66fc99e Initial load
duke
parents:
diff changeset
66 * The implementation of struct ps_prochandle can change w/o affecting clients.
a61af66fc99e Initial load
duke
parents:
diff changeset
67 */
a61af66fc99e Initial load
duke
parents:
diff changeset
68 struct ps_prochandle;
a61af66fc99e Initial load
duke
parents:
diff changeset
69
a61af66fc99e Initial load
duke
parents:
diff changeset
70 extern int _libproc_debug; /* set non-zero to enable debugging fprintfs */
a61af66fc99e Initial load
duke
parents:
diff changeset
71
a61af66fc99e Initial load
duke
parents:
diff changeset
72 #if defined(sparc) || defined(__sparc)
a61af66fc99e Initial load
duke
parents:
diff changeset
73 #define R_RVAL1 R_O0 /* register holding a function return value */
a61af66fc99e Initial load
duke
parents:
diff changeset
74 #define R_RVAL2 R_O1 /* 32 more bits for a 64-bit return value */
a61af66fc99e Initial load
duke
parents:
diff changeset
75 #define SYSCALL32 0x91d02008 /* 32-bit syscall (ta 8) instruction */
a61af66fc99e Initial load
duke
parents:
diff changeset
76 #define SYSCALL64 0x91d02040 /* 64-bit syscall (ta 64) instruction */
a61af66fc99e Initial load
duke
parents:
diff changeset
77 typedef uint32_t syscall_t; /* holds a syscall instruction */
a61af66fc99e Initial load
duke
parents:
diff changeset
78 #endif /* sparc */
a61af66fc99e Initial load
duke
parents:
diff changeset
79
a61af66fc99e Initial load
duke
parents:
diff changeset
80 #if defined(__i386) || defined(__ia64)
a61af66fc99e Initial load
duke
parents:
diff changeset
81 #define R_PC EIP
a61af66fc99e Initial load
duke
parents:
diff changeset
82 #define R_SP UESP
a61af66fc99e Initial load
duke
parents:
diff changeset
83 #define R_RVAL1 EAX /* register holding a function return value */
a61af66fc99e Initial load
duke
parents:
diff changeset
84 #define R_RVAL2 EDX /* 32 more bits for a 64-bit return value */
a61af66fc99e Initial load
duke
parents:
diff changeset
85 #define SYSCALL 0x9a /* syscall (lcall) instruction opcode */
a61af66fc99e Initial load
duke
parents:
diff changeset
86 typedef uchar_t syscall_t[7]; /* holds a syscall instruction */
a61af66fc99e Initial load
duke
parents:
diff changeset
87 #endif /* __i386 || __ia64 */
a61af66fc99e Initial load
duke
parents:
diff changeset
88
a61af66fc99e Initial load
duke
parents:
diff changeset
89 #define R_RVAL R_RVAL1 /* simple function return value register */
a61af66fc99e Initial load
duke
parents:
diff changeset
90
a61af66fc99e Initial load
duke
parents:
diff changeset
91 /* maximum sizes of things */
a61af66fc99e Initial load
duke
parents:
diff changeset
92 #define PRMAXSIG (32 * sizeof (sigset_t) / sizeof (uint32_t))
a61af66fc99e Initial load
duke
parents:
diff changeset
93 #define PRMAXFAULT (32 * sizeof (fltset_t) / sizeof (uint32_t))
a61af66fc99e Initial load
duke
parents:
diff changeset
94 #define PRMAXSYS (32 * sizeof (sysset_t) / sizeof (uint32_t))
a61af66fc99e Initial load
duke
parents:
diff changeset
95
a61af66fc99e Initial load
duke
parents:
diff changeset
96 /* State values returned by Pstate() */
a61af66fc99e Initial load
duke
parents:
diff changeset
97 #define PS_RUN 1 /* process is running */
a61af66fc99e Initial load
duke
parents:
diff changeset
98 #define PS_STOP 2 /* process is stopped */
a61af66fc99e Initial load
duke
parents:
diff changeset
99 #define PS_LOST 3 /* process is lost to control (EAGAIN) */
a61af66fc99e Initial load
duke
parents:
diff changeset
100 #define PS_UNDEAD 4 /* process is terminated (zombie) */
a61af66fc99e Initial load
duke
parents:
diff changeset
101 #define PS_DEAD 5 /* process is terminated (core file) */
a61af66fc99e Initial load
duke
parents:
diff changeset
102
a61af66fc99e Initial load
duke
parents:
diff changeset
103 /* Flags accepted by Pgrab() */
a61af66fc99e Initial load
duke
parents:
diff changeset
104 #define PGRAB_RETAIN 0x01 /* Retain tracing flags, else clear flags */
a61af66fc99e Initial load
duke
parents:
diff changeset
105 #define PGRAB_FORCE 0x02 /* Open the process w/o O_EXCL */
a61af66fc99e Initial load
duke
parents:
diff changeset
106 #define PGRAB_RDONLY 0x04 /* Open the process or core w/ O_RDONLY */
a61af66fc99e Initial load
duke
parents:
diff changeset
107 #define PGRAB_NOSTOP 0x08 /* Open the process but do not stop it */
a61af66fc99e Initial load
duke
parents:
diff changeset
108
a61af66fc99e Initial load
duke
parents:
diff changeset
109 /* Error codes from Pcreate() */
a61af66fc99e Initial load
duke
parents:
diff changeset
110 #define C_STRANGE -1 /* Unanticipated error, errno is meaningful */
a61af66fc99e Initial load
duke
parents:
diff changeset
111 #define C_FORK 1 /* Unable to fork */
a61af66fc99e Initial load
duke
parents:
diff changeset
112 #define C_PERM 2 /* No permission (file set-id or unreadable) */
a61af66fc99e Initial load
duke
parents:
diff changeset
113 #define C_NOEXEC 3 /* Cannot find executable file */
a61af66fc99e Initial load
duke
parents:
diff changeset
114 #define C_INTR 4 /* Interrupt received while creating */
a61af66fc99e Initial load
duke
parents:
diff changeset
115 #define C_LP64 5 /* Program is _LP64, self is _ILP32 */
a61af66fc99e Initial load
duke
parents:
diff changeset
116
a61af66fc99e Initial load
duke
parents:
diff changeset
117 /* Error codes from Pgrab(), Pfgrab_core(), and Pgrab_core() */
a61af66fc99e Initial load
duke
parents:
diff changeset
118 #define G_STRANGE -1 /* Unanticipated error, errno is meaningful */
a61af66fc99e Initial load
duke
parents:
diff changeset
119 #define G_NOPROC 1 /* No such process */
a61af66fc99e Initial load
duke
parents:
diff changeset
120 #define G_NOCORE 2 /* No such core file */
a61af66fc99e Initial load
duke
parents:
diff changeset
121 #define G_NOPROCORCORE 3 /* No such proc or core (for proc_arg_grab) */
a61af66fc99e Initial load
duke
parents:
diff changeset
122 #define G_NOEXEC 4 /* Cannot locate executable file */
a61af66fc99e Initial load
duke
parents:
diff changeset
123 #define G_ZOMB 5 /* Zombie process */
a61af66fc99e Initial load
duke
parents:
diff changeset
124 #define G_PERM 6 /* No permission */
a61af66fc99e Initial load
duke
parents:
diff changeset
125 #define G_BUSY 7 /* Another process has control */
a61af66fc99e Initial load
duke
parents:
diff changeset
126 #define G_SYS 8 /* System process */
a61af66fc99e Initial load
duke
parents:
diff changeset
127 #define G_SELF 9 /* Process is self */
a61af66fc99e Initial load
duke
parents:
diff changeset
128 #define G_INTR 10 /* Interrupt received while grabbing */
a61af66fc99e Initial load
duke
parents:
diff changeset
129 #define G_LP64 11 /* Process is _LP64, self is ILP32 */
a61af66fc99e Initial load
duke
parents:
diff changeset
130 #define G_FORMAT 12 /* File is not an ELF format core file */
a61af66fc99e Initial load
duke
parents:
diff changeset
131 #define G_ELF 13 /* Libelf error, elf_errno() is meaningful */
a61af66fc99e Initial load
duke
parents:
diff changeset
132 #define G_NOTE 14 /* Required PT_NOTE Phdr not present in core */
a61af66fc99e Initial load
duke
parents:
diff changeset
133
a61af66fc99e Initial load
duke
parents:
diff changeset
134 /* Flags accepted by Prelease */
a61af66fc99e Initial load
duke
parents:
diff changeset
135 #define PRELEASE_CLEAR 0x10 /* Clear all tracing flags */
a61af66fc99e Initial load
duke
parents:
diff changeset
136 #define PRELEASE_RETAIN 0x20 /* Retain final tracing flags */
a61af66fc99e Initial load
duke
parents:
diff changeset
137 #define PRELEASE_HANG 0x40 /* Leave the process stopped */
a61af66fc99e Initial load
duke
parents:
diff changeset
138 #define PRELEASE_KILL 0x80 /* Terminate the process */
a61af66fc99e Initial load
duke
parents:
diff changeset
139
a61af66fc99e Initial load
duke
parents:
diff changeset
140 typedef struct { /* argument descriptor for system call (Psyscall) */
a61af66fc99e Initial load
duke
parents:
diff changeset
141 long arg_value; /* value of argument given to system call */
a61af66fc99e Initial load
duke
parents:
diff changeset
142 void *arg_object; /* pointer to object in controlling process */
a61af66fc99e Initial load
duke
parents:
diff changeset
143 char arg_type; /* AT_BYVAL, AT_BYREF */
a61af66fc99e Initial load
duke
parents:
diff changeset
144 char arg_inout; /* AI_INPUT, AI_OUTPUT, AI_INOUT */
a61af66fc99e Initial load
duke
parents:
diff changeset
145 ushort_t arg_size; /* if AT_BYREF, size of object in bytes */
a61af66fc99e Initial load
duke
parents:
diff changeset
146 } argdes_t;
a61af66fc99e Initial load
duke
parents:
diff changeset
147
a61af66fc99e Initial load
duke
parents:
diff changeset
148 typedef struct { /* return values from system call (Psyscall) */
a61af66fc99e Initial load
duke
parents:
diff changeset
149 int sys_errno; /* syscall error number */
a61af66fc99e Initial load
duke
parents:
diff changeset
150 long sys_rval1; /* primary return value from system call */
a61af66fc99e Initial load
duke
parents:
diff changeset
151 long sys_rval2; /* second return value from system call */
a61af66fc99e Initial load
duke
parents:
diff changeset
152 } sysret_t;
a61af66fc99e Initial load
duke
parents:
diff changeset
153
a61af66fc99e Initial load
duke
parents:
diff changeset
154 /* values for type */
a61af66fc99e Initial load
duke
parents:
diff changeset
155 #define AT_BYVAL 1
a61af66fc99e Initial load
duke
parents:
diff changeset
156 #define AT_BYREF 2
a61af66fc99e Initial load
duke
parents:
diff changeset
157
a61af66fc99e Initial load
duke
parents:
diff changeset
158 /* values for inout */
a61af66fc99e Initial load
duke
parents:
diff changeset
159 #define AI_INPUT 1
a61af66fc99e Initial load
duke
parents:
diff changeset
160 #define AI_OUTPUT 2
a61af66fc99e Initial load
duke
parents:
diff changeset
161 #define AI_INOUT 3
a61af66fc99e Initial load
duke
parents:
diff changeset
162
a61af66fc99e Initial load
duke
parents:
diff changeset
163 /* maximum number of syscall arguments */
a61af66fc99e Initial load
duke
parents:
diff changeset
164 #define MAXARGS 8
a61af66fc99e Initial load
duke
parents:
diff changeset
165
a61af66fc99e Initial load
duke
parents:
diff changeset
166 /* maximum size in bytes of a BYREF argument */
a61af66fc99e Initial load
duke
parents:
diff changeset
167 #define MAXARGL (4*1024)
a61af66fc99e Initial load
duke
parents:
diff changeset
168
a61af66fc99e Initial load
duke
parents:
diff changeset
169 /* Kludges to make things work on Solaris 2.6 */
a61af66fc99e Initial load
duke
parents:
diff changeset
170 #if !defined(_LP64) && !defined(PR_MODEL_UNKNOWN)
a61af66fc99e Initial load
duke
parents:
diff changeset
171 #define PR_MODEL_UNKNOWN 0
a61af66fc99e Initial load
duke
parents:
diff changeset
172 #define PR_MODEL_ILP32 0 /* process data model is ILP32 */
a61af66fc99e Initial load
duke
parents:
diff changeset
173 #define PR_MODEL_LP64 2 /* process data model is LP64 */
a61af66fc99e Initial load
duke
parents:
diff changeset
174 #define PR_MODEL_NATIVE PR_MODEL_ILP32
a61af66fc99e Initial load
duke
parents:
diff changeset
175 #define pr_dmodel pr_filler[0]
a61af66fc99e Initial load
duke
parents:
diff changeset
176 #define STACK_BIAS 0
a61af66fc99e Initial load
duke
parents:
diff changeset
177 #endif
a61af66fc99e Initial load
duke
parents:
diff changeset
178
a61af66fc99e Initial load
duke
parents:
diff changeset
179 /*
a61af66fc99e Initial load
duke
parents:
diff changeset
180 * Function prototypes for routines in the process control package.
a61af66fc99e Initial load
duke
parents:
diff changeset
181 */
a61af66fc99e Initial load
duke
parents:
diff changeset
182 extern struct ps_prochandle *Pcreate(const char *, char *const *,
a61af66fc99e Initial load
duke
parents:
diff changeset
183 int *, char *, size_t);
a61af66fc99e Initial load
duke
parents:
diff changeset
184
a61af66fc99e Initial load
duke
parents:
diff changeset
185 extern const char *Pcreate_error(int);
a61af66fc99e Initial load
duke
parents:
diff changeset
186
a61af66fc99e Initial load
duke
parents:
diff changeset
187 extern struct ps_prochandle *Pgrab(pid_t, int, int *);
a61af66fc99e Initial load
duke
parents:
diff changeset
188 extern struct ps_prochandle *Pgrab_core(const char *, const char *, int, int *);
a61af66fc99e Initial load
duke
parents:
diff changeset
189 extern struct ps_prochandle *Pfgrab_core(int, const char *, int *);
a61af66fc99e Initial load
duke
parents:
diff changeset
190
a61af66fc99e Initial load
duke
parents:
diff changeset
191 extern const char *Pgrab_error(int);
a61af66fc99e Initial load
duke
parents:
diff changeset
192
a61af66fc99e Initial load
duke
parents:
diff changeset
193 extern int Preopen(struct ps_prochandle *);
a61af66fc99e Initial load
duke
parents:
diff changeset
194 extern void Prelease(struct ps_prochandle *, int);
a61af66fc99e Initial load
duke
parents:
diff changeset
195 extern void Pfree(struct ps_prochandle *);
a61af66fc99e Initial load
duke
parents:
diff changeset
196
a61af66fc99e Initial load
duke
parents:
diff changeset
197 extern int Pasfd(struct ps_prochandle *);
a61af66fc99e Initial load
duke
parents:
diff changeset
198 extern int Pctlfd(struct ps_prochandle *);
a61af66fc99e Initial load
duke
parents:
diff changeset
199 extern int Pcreate_agent(struct ps_prochandle *);
a61af66fc99e Initial load
duke
parents:
diff changeset
200 extern void Pdestroy_agent(struct ps_prochandle *);
a61af66fc99e Initial load
duke
parents:
diff changeset
201 extern int Pwait(struct ps_prochandle *, uint_t);
a61af66fc99e Initial load
duke
parents:
diff changeset
202 extern int Pstop(struct ps_prochandle *, uint_t);
a61af66fc99e Initial load
duke
parents:
diff changeset
203 extern int Pstate(struct ps_prochandle *);
a61af66fc99e Initial load
duke
parents:
diff changeset
204 extern const psinfo_t *Ppsinfo(struct ps_prochandle *);
a61af66fc99e Initial load
duke
parents:
diff changeset
205 extern const pstatus_t *Pstatus(struct ps_prochandle *);
a61af66fc99e Initial load
duke
parents:
diff changeset
206 extern int Pcred(struct ps_prochandle *, prcred_t *, int);
a61af66fc99e Initial load
duke
parents:
diff changeset
207 extern int Pgetareg(struct ps_prochandle *, int, prgreg_t *);
a61af66fc99e Initial load
duke
parents:
diff changeset
208 extern int Pputareg(struct ps_prochandle *, int, prgreg_t);
a61af66fc99e Initial load
duke
parents:
diff changeset
209 extern int Psetrun(struct ps_prochandle *, int, int);
a61af66fc99e Initial load
duke
parents:
diff changeset
210 extern ssize_t Pread(struct ps_prochandle *, void *, size_t, uintptr_t);
a61af66fc99e Initial load
duke
parents:
diff changeset
211 extern ssize_t Pread_string(struct ps_prochandle *, char *, size_t, uintptr_t);
a61af66fc99e Initial load
duke
parents:
diff changeset
212 extern ssize_t Pwrite(struct ps_prochandle *, const void *, size_t, uintptr_t);
a61af66fc99e Initial load
duke
parents:
diff changeset
213 extern int Pclearsig(struct ps_prochandle *);
a61af66fc99e Initial load
duke
parents:
diff changeset
214 extern int Pclearfault(struct ps_prochandle *);
a61af66fc99e Initial load
duke
parents:
diff changeset
215 extern int Psetbkpt(struct ps_prochandle *, uintptr_t, ulong_t *);
a61af66fc99e Initial load
duke
parents:
diff changeset
216 extern int Pdelbkpt(struct ps_prochandle *, uintptr_t, ulong_t);
a61af66fc99e Initial load
duke
parents:
diff changeset
217 extern int Pxecbkpt(struct ps_prochandle *, ulong_t);
a61af66fc99e Initial load
duke
parents:
diff changeset
218 extern int Psetflags(struct ps_prochandle *, long);
a61af66fc99e Initial load
duke
parents:
diff changeset
219 extern int Punsetflags(struct ps_prochandle *, long);
a61af66fc99e Initial load
duke
parents:
diff changeset
220 extern int Psignal(struct ps_prochandle *, int, int);
a61af66fc99e Initial load
duke
parents:
diff changeset
221 extern int Pfault(struct ps_prochandle *, int, int);
a61af66fc99e Initial load
duke
parents:
diff changeset
222 extern int Psysentry(struct ps_prochandle *, int, int);
a61af66fc99e Initial load
duke
parents:
diff changeset
223 extern int Psysexit(struct ps_prochandle *, int, int);
a61af66fc99e Initial load
duke
parents:
diff changeset
224 extern void Psetsignal(struct ps_prochandle *, const sigset_t *);
a61af66fc99e Initial load
duke
parents:
diff changeset
225 extern void Psetfault(struct ps_prochandle *, const fltset_t *);
a61af66fc99e Initial load
duke
parents:
diff changeset
226 extern void Psetsysentry(struct ps_prochandle *, const sysset_t *);
a61af66fc99e Initial load
duke
parents:
diff changeset
227 extern void Psetsysexit(struct ps_prochandle *, const sysset_t *);
a61af66fc99e Initial load
duke
parents:
diff changeset
228 extern void Psync(struct ps_prochandle *);
a61af66fc99e Initial load
duke
parents:
diff changeset
229 extern sysret_t Psyscall(struct ps_prochandle *, int, uint_t, argdes_t *);
a61af66fc99e Initial load
duke
parents:
diff changeset
230 extern int Pisprocdir(struct ps_prochandle *, const char *);
a61af66fc99e Initial load
duke
parents:
diff changeset
231
a61af66fc99e Initial load
duke
parents:
diff changeset
232 /*
a61af66fc99e Initial load
duke
parents:
diff changeset
233 * Function prototypes for system calls forced on the victim process.
a61af66fc99e Initial load
duke
parents:
diff changeset
234 */
a61af66fc99e Initial load
duke
parents:
diff changeset
235 extern int pr_open(struct ps_prochandle *, const char *, int, mode_t);
a61af66fc99e Initial load
duke
parents:
diff changeset
236 extern int pr_creat(struct ps_prochandle *, const char *, mode_t);
a61af66fc99e Initial load
duke
parents:
diff changeset
237 extern int pr_close(struct ps_prochandle *, int);
a61af66fc99e Initial load
duke
parents:
diff changeset
238 extern int pr_door_info(struct ps_prochandle *, int, struct door_info *);
a61af66fc99e Initial load
duke
parents:
diff changeset
239 extern void *pr_mmap(struct ps_prochandle *,
a61af66fc99e Initial load
duke
parents:
diff changeset
240 void *, size_t, int, int, int, off_t);
a61af66fc99e Initial load
duke
parents:
diff changeset
241 extern void *pr_zmap(struct ps_prochandle *,
a61af66fc99e Initial load
duke
parents:
diff changeset
242 void *, size_t, int, int);
a61af66fc99e Initial load
duke
parents:
diff changeset
243 extern int pr_munmap(struct ps_prochandle *, void *, size_t);
a61af66fc99e Initial load
duke
parents:
diff changeset
244 extern int pr_memcntl(struct ps_prochandle *,
a61af66fc99e Initial load
duke
parents:
diff changeset
245 caddr_t, size_t, int, caddr_t, int, int);
a61af66fc99e Initial load
duke
parents:
diff changeset
246 extern int pr_sigaction(struct ps_prochandle *,
a61af66fc99e Initial load
duke
parents:
diff changeset
247 int, const struct sigaction *, struct sigaction *);
a61af66fc99e Initial load
duke
parents:
diff changeset
248 extern int pr_getitimer(struct ps_prochandle *,
a61af66fc99e Initial load
duke
parents:
diff changeset
249 int, struct itimerval *);
a61af66fc99e Initial load
duke
parents:
diff changeset
250 extern int pr_setitimer(struct ps_prochandle *,
a61af66fc99e Initial load
duke
parents:
diff changeset
251 int, const struct itimerval *, struct itimerval *);
a61af66fc99e Initial load
duke
parents:
diff changeset
252 extern int pr_ioctl(struct ps_prochandle *, int, int, void *, size_t);
a61af66fc99e Initial load
duke
parents:
diff changeset
253 extern int pr_fcntl(struct ps_prochandle *, int, int, void *);
a61af66fc99e Initial load
duke
parents:
diff changeset
254 extern int pr_stat(struct ps_prochandle *, const char *, struct stat *);
a61af66fc99e Initial load
duke
parents:
diff changeset
255 extern int pr_lstat(struct ps_prochandle *, const char *, struct stat *);
a61af66fc99e Initial load
duke
parents:
diff changeset
256 extern int pr_fstat(struct ps_prochandle *, int, struct stat *);
a61af66fc99e Initial load
duke
parents:
diff changeset
257 extern int pr_statvfs(struct ps_prochandle *, const char *, statvfs_t *);
a61af66fc99e Initial load
duke
parents:
diff changeset
258 extern int pr_fstatvfs(struct ps_prochandle *, int, statvfs_t *);
a61af66fc99e Initial load
duke
parents:
diff changeset
259 extern int pr_getrlimit(struct ps_prochandle *,
a61af66fc99e Initial load
duke
parents:
diff changeset
260 int, struct rlimit *);
a61af66fc99e Initial load
duke
parents:
diff changeset
261 extern int pr_setrlimit(struct ps_prochandle *,
a61af66fc99e Initial load
duke
parents:
diff changeset
262 int, const struct rlimit *);
a61af66fc99e Initial load
duke
parents:
diff changeset
263 #if defined(_LARGEFILE64_SOURCE)
a61af66fc99e Initial load
duke
parents:
diff changeset
264 extern int pr_getrlimit64(struct ps_prochandle *,
a61af66fc99e Initial load
duke
parents:
diff changeset
265 int, struct rlimit64 *);
a61af66fc99e Initial load
duke
parents:
diff changeset
266 extern int pr_setrlimit64(struct ps_prochandle *,
a61af66fc99e Initial load
duke
parents:
diff changeset
267 int, const struct rlimit64 *);
a61af66fc99e Initial load
duke
parents:
diff changeset
268 #endif /* _LARGEFILE64_SOURCE */
a61af66fc99e Initial load
duke
parents:
diff changeset
269 extern int pr_lwp_exit(struct ps_prochandle *);
a61af66fc99e Initial load
duke
parents:
diff changeset
270 extern int pr_exit(struct ps_prochandle *, int);
a61af66fc99e Initial load
duke
parents:
diff changeset
271 extern int pr_waitid(struct ps_prochandle *,
a61af66fc99e Initial load
duke
parents:
diff changeset
272 idtype_t, id_t, siginfo_t *, int);
a61af66fc99e Initial load
duke
parents:
diff changeset
273 extern off_t pr_lseek(struct ps_prochandle *, int, off_t, int);
a61af66fc99e Initial load
duke
parents:
diff changeset
274 extern offset_t pr_llseek(struct ps_prochandle *, int, offset_t, int);
a61af66fc99e Initial load
duke
parents:
diff changeset
275 extern int pr_rename(struct ps_prochandle *, const char *, const char *);
a61af66fc99e Initial load
duke
parents:
diff changeset
276 extern int pr_link(struct ps_prochandle *, const char *, const char *);
a61af66fc99e Initial load
duke
parents:
diff changeset
277 extern int pr_unlink(struct ps_prochandle *, const char *);
a61af66fc99e Initial load
duke
parents:
diff changeset
278 extern int pr_getpeername(struct ps_prochandle *,
a61af66fc99e Initial load
duke
parents:
diff changeset
279 int, struct sockaddr *, socklen_t *);
a61af66fc99e Initial load
duke
parents:
diff changeset
280 extern int pr_getsockname(struct ps_prochandle *,
a61af66fc99e Initial load
duke
parents:
diff changeset
281 int, struct sockaddr *, socklen_t *);
a61af66fc99e Initial load
duke
parents:
diff changeset
282
a61af66fc99e Initial load
duke
parents:
diff changeset
283 /*
a61af66fc99e Initial load
duke
parents:
diff changeset
284 * Function prototypes for accessing per-LWP register information.
a61af66fc99e Initial load
duke
parents:
diff changeset
285 */
a61af66fc99e Initial load
duke
parents:
diff changeset
286 extern int Plwp_getregs(struct ps_prochandle *, lwpid_t, prgregset_t);
a61af66fc99e Initial load
duke
parents:
diff changeset
287 extern int Plwp_setregs(struct ps_prochandle *, lwpid_t, const prgregset_t);
a61af66fc99e Initial load
duke
parents:
diff changeset
288
a61af66fc99e Initial load
duke
parents:
diff changeset
289 extern int Plwp_getfpregs(struct ps_prochandle *, lwpid_t, prfpregset_t *);
a61af66fc99e Initial load
duke
parents:
diff changeset
290 extern int Plwp_setfpregs(struct ps_prochandle *, lwpid_t,
a61af66fc99e Initial load
duke
parents:
diff changeset
291 const prfpregset_t *);
a61af66fc99e Initial load
duke
parents:
diff changeset
292
a61af66fc99e Initial load
duke
parents:
diff changeset
293 #if defined(sparc) || defined(__sparc)
a61af66fc99e Initial load
duke
parents:
diff changeset
294
a61af66fc99e Initial load
duke
parents:
diff changeset
295 extern int Plwp_getxregs(struct ps_prochandle *, lwpid_t, prxregset_t *);
a61af66fc99e Initial load
duke
parents:
diff changeset
296 extern int Plwp_setxregs(struct ps_prochandle *, lwpid_t, const prxregset_t *);
a61af66fc99e Initial load
duke
parents:
diff changeset
297
a61af66fc99e Initial load
duke
parents:
diff changeset
298 #if defined(__sparcv9)
a61af66fc99e Initial load
duke
parents:
diff changeset
299 extern int Plwp_getasrs(struct ps_prochandle *, lwpid_t, asrset_t);
a61af66fc99e Initial load
duke
parents:
diff changeset
300 extern int Plwp_setasrs(struct ps_prochandle *, lwpid_t, const asrset_t);
a61af66fc99e Initial load
duke
parents:
diff changeset
301 #endif /* __sparcv9 */
a61af66fc99e Initial load
duke
parents:
diff changeset
302
a61af66fc99e Initial load
duke
parents:
diff changeset
303 #endif /* __sparc */
a61af66fc99e Initial load
duke
parents:
diff changeset
304
a61af66fc99e Initial load
duke
parents:
diff changeset
305 extern int Plwp_getpsinfo(struct ps_prochandle *, lwpid_t, lwpsinfo_t *);
a61af66fc99e Initial load
duke
parents:
diff changeset
306
a61af66fc99e Initial load
duke
parents:
diff changeset
307 /*
a61af66fc99e Initial load
duke
parents:
diff changeset
308 * LWP iteration interface.
a61af66fc99e Initial load
duke
parents:
diff changeset
309 */
a61af66fc99e Initial load
duke
parents:
diff changeset
310 typedef int proc_lwp_f(void *, const lwpstatus_t *);
a61af66fc99e Initial load
duke
parents:
diff changeset
311 extern int Plwp_iter(struct ps_prochandle *, proc_lwp_f *, void *);
a61af66fc99e Initial load
duke
parents:
diff changeset
312
a61af66fc99e Initial load
duke
parents:
diff changeset
313 /*
a61af66fc99e Initial load
duke
parents:
diff changeset
314 * Symbol table interfaces.
a61af66fc99e Initial load
duke
parents:
diff changeset
315 */
a61af66fc99e Initial load
duke
parents:
diff changeset
316
a61af66fc99e Initial load
duke
parents:
diff changeset
317 /*
a61af66fc99e Initial load
duke
parents:
diff changeset
318 * Pseudo-names passed to Plookup_by_name() for well-known load objects.
a61af66fc99e Initial load
duke
parents:
diff changeset
319 * NOTE: It is required that PR_OBJ_EXEC and PR_OBJ_LDSO exactly match
a61af66fc99e Initial load
duke
parents:
diff changeset
320 * the definitions of PS_OBJ_EXEC and PS_OBJ_LDSO from <proc_service.h>.
a61af66fc99e Initial load
duke
parents:
diff changeset
321 */
a61af66fc99e Initial load
duke
parents:
diff changeset
322 #define PR_OBJ_EXEC ((const char *)0) /* search the executable file */
a61af66fc99e Initial load
duke
parents:
diff changeset
323 #define PR_OBJ_LDSO ((const char *)1) /* search ld.so.1 */
a61af66fc99e Initial load
duke
parents:
diff changeset
324 #define PR_OBJ_EVERY ((const char *)-1) /* search every load object */
a61af66fc99e Initial load
duke
parents:
diff changeset
325
a61af66fc99e Initial load
duke
parents:
diff changeset
326 /*
a61af66fc99e Initial load
duke
parents:
diff changeset
327 * 'object_name' is the name of a load object obtained from an
a61af66fc99e Initial load
duke
parents:
diff changeset
328 * iteration over the process's address space mappings (Pmapping_iter),
a61af66fc99e Initial load
duke
parents:
diff changeset
329 * or an iteration over the process's mapped objects (Pobject_iter),
a61af66fc99e Initial load
duke
parents:
diff changeset
330 * or else it is one of the special PR_OBJ_* values above.
a61af66fc99e Initial load
duke
parents:
diff changeset
331 */
a61af66fc99e Initial load
duke
parents:
diff changeset
332 extern int Plookup_by_name(struct ps_prochandle *,
a61af66fc99e Initial load
duke
parents:
diff changeset
333 const char *, const char *, GElf_Sym *);
a61af66fc99e Initial load
duke
parents:
diff changeset
334
a61af66fc99e Initial load
duke
parents:
diff changeset
335 extern int Plookup_by_addr(struct ps_prochandle *,
a61af66fc99e Initial load
duke
parents:
diff changeset
336 uintptr_t, char *, size_t, GElf_Sym *);
a61af66fc99e Initial load
duke
parents:
diff changeset
337
a61af66fc99e Initial load
duke
parents:
diff changeset
338 typedef int proc_map_f(void *, const prmap_t *, const char *);
a61af66fc99e Initial load
duke
parents:
diff changeset
339
a61af66fc99e Initial load
duke
parents:
diff changeset
340 extern int Pmapping_iter(struct ps_prochandle *, proc_map_f *, void *);
a61af66fc99e Initial load
duke
parents:
diff changeset
341 extern int Pobject_iter(struct ps_prochandle *, proc_map_f *, void *);
a61af66fc99e Initial load
duke
parents:
diff changeset
342
a61af66fc99e Initial load
duke
parents:
diff changeset
343 extern const prmap_t *Paddr_to_map(struct ps_prochandle *, uintptr_t);
a61af66fc99e Initial load
duke
parents:
diff changeset
344 extern const prmap_t *Paddr_to_text_map(struct ps_prochandle *, uintptr_t);
a61af66fc99e Initial load
duke
parents:
diff changeset
345 extern const prmap_t *Pname_to_map(struct ps_prochandle *, const char *);
a61af66fc99e Initial load
duke
parents:
diff changeset
346
a61af66fc99e Initial load
duke
parents:
diff changeset
347 extern char *Pplatform(struct ps_prochandle *, char *, size_t);
a61af66fc99e Initial load
duke
parents:
diff changeset
348 extern int Puname(struct ps_prochandle *, struct utsname *);
a61af66fc99e Initial load
duke
parents:
diff changeset
349
a61af66fc99e Initial load
duke
parents:
diff changeset
350 extern char *Pexecname(struct ps_prochandle *, char *, size_t);
a61af66fc99e Initial load
duke
parents:
diff changeset
351 extern char *Pobjname(struct ps_prochandle *, uintptr_t, char *, size_t);
a61af66fc99e Initial load
duke
parents:
diff changeset
352
a61af66fc99e Initial load
duke
parents:
diff changeset
353 extern char *Pgetenv(struct ps_prochandle *, const char *, char *, size_t);
a61af66fc99e Initial load
duke
parents:
diff changeset
354 extern long Pgetauxval(struct ps_prochandle *, int);
a61af66fc99e Initial load
duke
parents:
diff changeset
355
a61af66fc99e Initial load
duke
parents:
diff changeset
356 /*
a61af66fc99e Initial load
duke
parents:
diff changeset
357 * Symbol table iteration interface.
a61af66fc99e Initial load
duke
parents:
diff changeset
358 */
a61af66fc99e Initial load
duke
parents:
diff changeset
359 typedef int proc_sym_f(void *, const GElf_Sym *, const char *);
a61af66fc99e Initial load
duke
parents:
diff changeset
360
a61af66fc99e Initial load
duke
parents:
diff changeset
361 extern int Psymbol_iter(struct ps_prochandle *,
a61af66fc99e Initial load
duke
parents:
diff changeset
362 const char *, int, int, proc_sym_f *, void *);
a61af66fc99e Initial load
duke
parents:
diff changeset
363
a61af66fc99e Initial load
duke
parents:
diff changeset
364 /*
a61af66fc99e Initial load
duke
parents:
diff changeset
365 * 'which' selects which symbol table and can be one of the following.
a61af66fc99e Initial load
duke
parents:
diff changeset
366 */
a61af66fc99e Initial load
duke
parents:
diff changeset
367 #define PR_SYMTAB 1
a61af66fc99e Initial load
duke
parents:
diff changeset
368 #define PR_DYNSYM 2
a61af66fc99e Initial load
duke
parents:
diff changeset
369 /*
a61af66fc99e Initial load
duke
parents:
diff changeset
370 * 'type' selects the symbols of interest by binding and type. It is a bit-
a61af66fc99e Initial load
duke
parents:
diff changeset
371 * mask of one or more of the following flags, whose order MUST match the
a61af66fc99e Initial load
duke
parents:
diff changeset
372 * order of STB and STT constants in <sys/elf.h>.
a61af66fc99e Initial load
duke
parents:
diff changeset
373 */
a61af66fc99e Initial load
duke
parents:
diff changeset
374 #define BIND_LOCAL 0x0001
a61af66fc99e Initial load
duke
parents:
diff changeset
375 #define BIND_GLOBAL 0x0002
a61af66fc99e Initial load
duke
parents:
diff changeset
376 #define BIND_WEAK 0x0004
a61af66fc99e Initial load
duke
parents:
diff changeset
377 #define BIND_ANY (BIND_LOCAL|BIND_GLOBAL|BIND_WEAK)
a61af66fc99e Initial load
duke
parents:
diff changeset
378 #define TYPE_NOTYPE 0x0100
a61af66fc99e Initial load
duke
parents:
diff changeset
379 #define TYPE_OBJECT 0x0200
a61af66fc99e Initial load
duke
parents:
diff changeset
380 #define TYPE_FUNC 0x0400
a61af66fc99e Initial load
duke
parents:
diff changeset
381 #define TYPE_SECTION 0x0800
a61af66fc99e Initial load
duke
parents:
diff changeset
382 #define TYPE_FILE 0x1000
a61af66fc99e Initial load
duke
parents:
diff changeset
383 #define TYPE_ANY (TYPE_NOTYPE|TYPE_OBJECT|TYPE_FUNC|TYPE_SECTION|TYPE_FILE)
a61af66fc99e Initial load
duke
parents:
diff changeset
384
a61af66fc99e Initial load
duke
parents:
diff changeset
385 /*
a61af66fc99e Initial load
duke
parents:
diff changeset
386 * This returns the rtld_db agent handle for the process.
a61af66fc99e Initial load
duke
parents:
diff changeset
387 * The handle will become invalid at the next successful exec() and
a61af66fc99e Initial load
duke
parents:
diff changeset
388 * must not be used beyond that point (see Preset_maps(), below).
a61af66fc99e Initial load
duke
parents:
diff changeset
389 */
a61af66fc99e Initial load
duke
parents:
diff changeset
390 extern rd_agent_t *Prd_agent(struct ps_prochandle *);
a61af66fc99e Initial load
duke
parents:
diff changeset
391
a61af66fc99e Initial load
duke
parents:
diff changeset
392 /*
a61af66fc99e Initial load
duke
parents:
diff changeset
393 * This should be called when an RD_DLACTIVITY event with the
a61af66fc99e Initial load
duke
parents:
diff changeset
394 * RD_CONSISTENT state occurs via librtld_db's event mechanism.
a61af66fc99e Initial load
duke
parents:
diff changeset
395 * This makes libproc's address space mappings and symbol tables current.
a61af66fc99e Initial load
duke
parents:
diff changeset
396 */
a61af66fc99e Initial load
duke
parents:
diff changeset
397 extern void Pupdate_maps(struct ps_prochandle *);
a61af66fc99e Initial load
duke
parents:
diff changeset
398
a61af66fc99e Initial load
duke
parents:
diff changeset
399 /*
a61af66fc99e Initial load
duke
parents:
diff changeset
400 * This must be called after the victim process performs a successful
a61af66fc99e Initial load
duke
parents:
diff changeset
401 * exec() if any of the symbol table interface functions have been called
a61af66fc99e Initial load
duke
parents:
diff changeset
402 * prior to that point. This is essential because an exec() invalidates
a61af66fc99e Initial load
duke
parents:
diff changeset
403 * all previous symbol table and address space mapping information.
a61af66fc99e Initial load
duke
parents:
diff changeset
404 * It is always safe to call, but if it is called other than after an
a61af66fc99e Initial load
duke
parents:
diff changeset
405 * exec() by the victim process it just causes unnecessary overhead.
a61af66fc99e Initial load
duke
parents:
diff changeset
406 *
a61af66fc99e Initial load
duke
parents:
diff changeset
407 * The rtld_db agent handle obtained from a previous call to Prd_agent() is
a61af66fc99e Initial load
duke
parents:
diff changeset
408 * made invalid by Preset_maps() and Prd_agent() must be called again to get
a61af66fc99e Initial load
duke
parents:
diff changeset
409 * the new handle.
a61af66fc99e Initial load
duke
parents:
diff changeset
410 */
a61af66fc99e Initial load
duke
parents:
diff changeset
411 extern void Preset_maps(struct ps_prochandle *);
a61af66fc99e Initial load
duke
parents:
diff changeset
412
a61af66fc99e Initial load
duke
parents:
diff changeset
413 /*
a61af66fc99e Initial load
duke
parents:
diff changeset
414 * Given an address, Ppltdest() determines if this is part of a PLT, and if
a61af66fc99e Initial load
duke
parents:
diff changeset
415 * so returns the target address of this PLT entry and a flag indicating
a61af66fc99e Initial load
duke
parents:
diff changeset
416 * whether or not this PLT entry has been bound by the run-time linker.
a61af66fc99e Initial load
duke
parents:
diff changeset
417 */
a61af66fc99e Initial load
duke
parents:
diff changeset
418 extern uintptr_t Ppltdest(struct ps_prochandle *, uintptr_t, int *);
a61af66fc99e Initial load
duke
parents:
diff changeset
419
a61af66fc99e Initial load
duke
parents:
diff changeset
420 /*
a61af66fc99e Initial load
duke
parents:
diff changeset
421 * Stack frame iteration interface.
a61af66fc99e Initial load
duke
parents:
diff changeset
422 */
a61af66fc99e Initial load
duke
parents:
diff changeset
423 typedef int proc_stack_f(void *, const prgregset_t, uint_t, const long *);
a61af66fc99e Initial load
duke
parents:
diff changeset
424
a61af66fc99e Initial load
duke
parents:
diff changeset
425 extern int Pstack_iter(struct ps_prochandle *,
a61af66fc99e Initial load
duke
parents:
diff changeset
426 const prgregset_t, proc_stack_f *, void *);
a61af66fc99e Initial load
duke
parents:
diff changeset
427
a61af66fc99e Initial load
duke
parents:
diff changeset
428 /*
a61af66fc99e Initial load
duke
parents:
diff changeset
429 * Compute the full pathname of a named directory without using chdir().
a61af66fc99e Initial load
duke
parents:
diff changeset
430 * This is useful for dealing with /proc/<pid>/cwd.
a61af66fc99e Initial load
duke
parents:
diff changeset
431 */
a61af66fc99e Initial load
duke
parents:
diff changeset
432 extern char *proc_dirname(const char *, char *, size_t);
a61af66fc99e Initial load
duke
parents:
diff changeset
433
a61af66fc99e Initial load
duke
parents:
diff changeset
434 /*
a61af66fc99e Initial load
duke
parents:
diff changeset
435 * Remove unprintable characters from psinfo.pr_psargs and replace with
a61af66fc99e Initial load
duke
parents:
diff changeset
436 * whitespace characters so it is safe for printing.
a61af66fc99e Initial load
duke
parents:
diff changeset
437 */
a61af66fc99e Initial load
duke
parents:
diff changeset
438 extern void proc_unctrl_psinfo(psinfo_t *);
a61af66fc99e Initial load
duke
parents:
diff changeset
439
a61af66fc99e Initial load
duke
parents:
diff changeset
440 /*
a61af66fc99e Initial load
duke
parents:
diff changeset
441 * Utility functions for processing arguments which should be /proc files,
a61af66fc99e Initial load
duke
parents:
diff changeset
442 * pids, and/or core files. The returned error code can be passed to
a61af66fc99e Initial load
duke
parents:
diff changeset
443 * Pgrab_error() in order to convert it to an error string.
a61af66fc99e Initial load
duke
parents:
diff changeset
444 */
a61af66fc99e Initial load
duke
parents:
diff changeset
445 #define PR_ARG_PIDS 0x1 /* Allow pid and /proc file arguments */
a61af66fc99e Initial load
duke
parents:
diff changeset
446 #define PR_ARG_CORES 0x2 /* Allow core file arguments */
a61af66fc99e Initial load
duke
parents:
diff changeset
447
a61af66fc99e Initial load
duke
parents:
diff changeset
448 #define PR_ARG_ANY (PR_ARG_PIDS | PR_ARG_CORES)
a61af66fc99e Initial load
duke
parents:
diff changeset
449
a61af66fc99e Initial load
duke
parents:
diff changeset
450 extern struct ps_prochandle *proc_arg_grab(const char *, int, int, int *);
a61af66fc99e Initial load
duke
parents:
diff changeset
451 extern pid_t proc_arg_psinfo(const char *, int, psinfo_t *, int *);
a61af66fc99e Initial load
duke
parents:
diff changeset
452
a61af66fc99e Initial load
duke
parents:
diff changeset
453 /*
a61af66fc99e Initial load
duke
parents:
diff changeset
454 * Utility functions for obtaining information via /proc without actually
a61af66fc99e Initial load
duke
parents:
diff changeset
455 * performing a Pcreate() or Pgrab():
a61af66fc99e Initial load
duke
parents:
diff changeset
456 */
a61af66fc99e Initial load
duke
parents:
diff changeset
457 extern int proc_get_auxv(pid_t, auxv_t *, int);
a61af66fc99e Initial load
duke
parents:
diff changeset
458 extern int proc_get_cred(pid_t, prcred_t *, int);
a61af66fc99e Initial load
duke
parents:
diff changeset
459 extern int proc_get_psinfo(pid_t, psinfo_t *);
a61af66fc99e Initial load
duke
parents:
diff changeset
460 extern int proc_get_status(pid_t, pstatus_t *);
a61af66fc99e Initial load
duke
parents:
diff changeset
461
a61af66fc99e Initial load
duke
parents:
diff changeset
462 /*
a61af66fc99e Initial load
duke
parents:
diff changeset
463 * Utility functions for debugging tools to convert numeric fault,
a61af66fc99e Initial load
duke
parents:
diff changeset
464 * signal, and system call numbers to symbolic names:
a61af66fc99e Initial load
duke
parents:
diff changeset
465 */
a61af66fc99e Initial load
duke
parents:
diff changeset
466 extern char *proc_fltname(int, char *, size_t);
a61af66fc99e Initial load
duke
parents:
diff changeset
467 extern char *proc_signame(int, char *, size_t);
a61af66fc99e Initial load
duke
parents:
diff changeset
468 extern char *proc_sysname(int, char *, size_t);
a61af66fc99e Initial load
duke
parents:
diff changeset
469
a61af66fc99e Initial load
duke
parents:
diff changeset
470 #ifdef __cplusplus
a61af66fc99e Initial load
duke
parents:
diff changeset
471 }
a61af66fc99e Initial load
duke
parents:
diff changeset
472 #endif
a61af66fc99e Initial load
duke
parents:
diff changeset
473
a61af66fc99e Initial load
duke
parents:
diff changeset
474 #endif /* _LIBPROC_H */