Automatic Copyright Year update after running gdb/copyright.py
[deliverable/binutils-gdb.git] / gdb / proc-events.c
CommitLineData
44122162 1/* Machine-independent support for Solaris /proc (process file system)
c18c06be 2
88b9d363 3 Copyright (C) 1999-2022 Free Software Foundation, Inc.
c18c06be 4
0fda6bd2
JM
5 Written by Michael Snyder at Cygnus Solutions.
6 Based on work by Fred Fish, Stu Grossman, Geoff Noer, and others.
7
c18c06be
MK
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
a9762ec7 10 the Free Software Foundation; either version 3 of the License, or
c18c06be
MK
11 (at your option) any later version.
12
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
17
18 You should have received a copy of the GNU General Public License
a9762ec7 19 along with this program. If not, see <http://www.gnu.org/licenses/>. */
c18c06be
MK
20
21/* Pretty-print "events of interest".
22
23 This module includes pretty-print routines for:
24 * faults (hardware exceptions)
25 * signals (software interrupts)
26 * syscalls
27
28 FIXME: At present, the syscall translation table must be
29 initialized, which is not true of the other translation tables. */
0fda6bd2
JM
30
31#include "defs.h"
32
0fda6bd2
JM
33#include <sys/types.h>
34#include <sys/procfs.h>
35#include <sys/syscall.h>
36#include <sys/fault.h>
37
a0911fd0
MR
38#include "proc-utils.h"
39
c18c06be
MK
40/* Much of the information used in the /proc interface, particularly
41 for printing status information, is kept as tables of structures of
42 the following form. These tables can be used to map numeric values
43 to their symbolic names and to a string that describes their
44 specific use. */
0fda6bd2 45
c18c06be
MK
46struct trans
47{
48 int value; /* The numeric value. */
995816ba
PA
49 const char *name; /* The equivalent symbolic value. */
50 const char *desc; /* Short description of value. */
0fda6bd2 51};
c18c06be 52\f
0fda6bd2 53
c18c06be 54/* Pretty print syscalls. */
0fda6bd2 55
c18c06be 56/* Syscall translation table. */
0fda6bd2 57
c18c06be 58#define MAX_SYSCALLS 262 /* Pretty arbitrary. */
995816ba 59static const char *syscall_table[MAX_SYSCALLS];
0fda6bd2 60
a0911fd0 61static void
0fda6bd2
JM
62init_syscall_table (void)
63{
0fda6bd2 64 syscall_table[SYS_accept] = "accept";
c18c06be 65#ifdef SYS_access
0fda6bd2
JM
66 syscall_table[SYS_access] = "access";
67#endif
0fda6bd2 68 syscall_table[SYS_acct] = "acct";
44122162 69 syscall_table[SYS_acctctl] = "acctctl";
0fda6bd2 70 syscall_table[SYS_acl] = "acl";
44122162
RO
71#ifdef SYS_adi
72 syscall_table[SYS_adi] = "adi";
0fda6bd2 73#endif
0fda6bd2 74 syscall_table[SYS_adjtime] = "adjtime";
0fda6bd2 75 syscall_table[SYS_alarm] = "alarm";
0fda6bd2 76 syscall_table[SYS_auditsys] = "auditsys";
44122162 77 syscall_table[SYS_autofssys] = "autofssys";
0fda6bd2 78 syscall_table[SYS_bind] = "bind";
44122162 79 syscall_table[SYS_brand] = "brand";
0fda6bd2 80 syscall_table[SYS_brk] = "brk";
0fda6bd2 81 syscall_table[SYS_chdir] = "chdir";
c18c06be 82#ifdef SYS_chmod
0fda6bd2
JM
83 syscall_table[SYS_chmod] = "chmod";
84#endif
c18c06be 85#ifdef SYS_chown
0fda6bd2
JM
86 syscall_table[SYS_chown] = "chown";
87#endif
0fda6bd2 88 syscall_table[SYS_chroot] = "chroot";
44122162 89 syscall_table[SYS_cladm] = "cladm";
0fda6bd2 90 syscall_table[SYS_clock_getres] = "clock_getres";
0fda6bd2 91 syscall_table[SYS_clock_gettime] = "clock_gettime";
0fda6bd2 92 syscall_table[SYS_clock_settime] = "clock_settime";
0fda6bd2 93 syscall_table[SYS_close] = "close";
0fda6bd2 94 syscall_table[SYS_connect] = "connect";
0fda6bd2 95 syscall_table[SYS_context] = "context";
44122162
RO
96 syscall_table[SYS_corectl] = "corectl";
97 syscall_table[SYS_cpc] = "cpc";
c18c06be 98#ifdef SYS_creat
0fda6bd2
JM
99 syscall_table[SYS_creat] = "creat";
100#endif
c18c06be 101#ifdef SYS_creat64
0fda6bd2
JM
102 syscall_table[SYS_creat64] = "creat64";
103#endif
0fda6bd2 104 syscall_table[SYS_door] = "door";
c18c06be 105#ifdef SYS_dup
0fda6bd2
JM
106 syscall_table[SYS_dup] = "dup";
107#endif
c18c06be 108#ifdef SYS_evsys
0fda6bd2
JM
109 syscall_table[SYS_evsys] = "evsys";
110#endif
c18c06be 111#ifdef SYS_evtrapret
0fda6bd2
JM
112 syscall_table[SYS_evtrapret] = "evtrapret";
113#endif
44122162 114 syscall_table[SYS_exacctsys] = "exacctsys";
c18c06be 115#ifdef SYS_exec
0fda6bd2
JM
116 syscall_table[SYS_exec] = "exec";
117#endif
0fda6bd2 118 syscall_table[SYS_execve] = "execve";
0fda6bd2 119 syscall_table[SYS_exit] = "exit";
44122162
RO
120#ifdef SYS_faccessat
121 syscall_table[SYS_faccessat] = "faccessat";
0fda6bd2 122#endif
0fda6bd2 123 syscall_table[SYS_facl] = "facl";
0fda6bd2 124 syscall_table[SYS_fchdir] = "fchdir";
c18c06be 125#ifdef SYS_fchmod
0fda6bd2
JM
126 syscall_table[SYS_fchmod] = "fchmod";
127#endif
44122162
RO
128#ifdef SYS_fchmodat
129 syscall_table[SYS_fchmodat] = "fchmodat";
130#endif
c18c06be 131#ifdef SYS_fchown
0fda6bd2
JM
132 syscall_table[SYS_fchown] = "fchown";
133#endif
44122162
RO
134#ifdef SYS_fchownat
135 syscall_table[SYS_fchownat] = "fchownat";
0fda6bd2 136#endif
44122162 137 syscall_table[SYS_fchroot] = "fchroot";
0fda6bd2 138 syscall_table[SYS_fcntl] = "fcntl";
0fda6bd2 139 syscall_table[SYS_fdsync] = "fdsync";
c18c06be 140#ifdef SYS_fork1
0fda6bd2
JM
141 syscall_table[SYS_fork1] = "fork1";
142#endif
c18c06be 143#ifdef SYS_forkall
0fda6bd2
JM
144 syscall_table[SYS_forkall] = "forkall";
145#endif
44122162
RO
146#ifdef SYS_forksys
147 syscall_table[SYS_forksys] = "forksys";
148#endif
0fda6bd2 149 syscall_table[SYS_fpathconf] = "fpathconf";
44122162
RO
150#ifdef SYS_frealpathat
151 syscall_table[SYS_frealpathat] = "frealpathat";
152#endif
153#ifdef SYS_fsat
154 syscall_table[SYS_fsat] = "fsat";
0fda6bd2 155#endif
c18c06be 156#ifdef SYS_fstat
0fda6bd2
JM
157 syscall_table[SYS_fstat] = "fstat";
158#endif
c18c06be 159#ifdef SYS_fstat64
0fda6bd2
JM
160 syscall_table[SYS_fstat64] = "fstat64";
161#endif
44122162
RO
162#ifdef SYS_fstatat
163 syscall_table[SYS_fstatat] = "fstatat";
0fda6bd2 164#endif
44122162
RO
165#ifdef SYS_fstatat64
166 syscall_table[SYS_fstatat64] = "fstatat64";
0fda6bd2 167#endif
44122162
RO
168 syscall_table[SYS_fstatfs] = "fstatfs";
169 syscall_table[SYS_fstatvfs] = "fstatvfs";
0fda6bd2 170 syscall_table[SYS_fstatvfs64] = "fstatvfs64";
c18c06be 171#ifdef SYS_fxstat
0fda6bd2
JM
172 syscall_table[SYS_fxstat] = "fxstat";
173#endif
44122162 174 syscall_table[SYS_getcwd] = "getcwd";
0fda6bd2 175 syscall_table[SYS_getdents] = "getdents";
0fda6bd2 176 syscall_table[SYS_getdents64] = "getdents64";
0fda6bd2 177 syscall_table[SYS_getgid] = "getgid";
0fda6bd2 178 syscall_table[SYS_getgroups] = "getgroups";
0fda6bd2 179 syscall_table[SYS_getitimer] = "getitimer";
44122162 180 syscall_table[SYS_getloadavg] = "getloadavg";
0fda6bd2 181 syscall_table[SYS_getmsg] = "getmsg";
44122162 182 syscall_table[SYS_getpagesizes] = "getpagesizes";
0fda6bd2 183 syscall_table[SYS_getpeername] = "getpeername";
0fda6bd2 184 syscall_table[SYS_getpid] = "getpid";
0fda6bd2 185 syscall_table[SYS_getpmsg] = "getpmsg";
44122162
RO
186#ifdef SYS_getrandom
187 syscall_table[SYS_getrandom] = "getrandom";
0fda6bd2 188#endif
0fda6bd2 189 syscall_table[SYS_getrlimit] = "getrlimit";
0fda6bd2 190 syscall_table[SYS_getrlimit64] = "getrlimit64";
0fda6bd2 191 syscall_table[SYS_getsockname] = "getsockname";
0fda6bd2 192 syscall_table[SYS_getsockopt] = "getsockopt";
0fda6bd2 193 syscall_table[SYS_gettimeofday] = "gettimeofday";
0fda6bd2 194 syscall_table[SYS_getuid] = "getuid";
0fda6bd2 195 syscall_table[SYS_gtty] = "gtty";
0fda6bd2 196 syscall_table[SYS_hrtsys] = "hrtsys";
0fda6bd2 197 syscall_table[SYS_inst_sync] = "inst_sync";
0fda6bd2 198 syscall_table[SYS_install_utrap] = "install_utrap";
0fda6bd2 199 syscall_table[SYS_ioctl] = "ioctl";
44122162
RO
200#ifdef SYS_issetugid
201 syscall_table[SYS_issetugid] = "issetugid";
0fda6bd2 202#endif
0fda6bd2 203 syscall_table[SYS_kaio] = "kaio";
0fda6bd2 204 syscall_table[SYS_kill] = "kill";
44122162 205 syscall_table[SYS_labelsys] = "labelsys";
c18c06be 206#ifdef SYS_lchown
0fda6bd2
JM
207 syscall_table[SYS_lchown] = "lchown";
208#endif
44122162 209 syscall_table[SYS_lgrpsys] = "lgrpsys";
c18c06be 210#ifdef SYS_link
0fda6bd2
JM
211 syscall_table[SYS_link] = "link";
212#endif
44122162
RO
213#ifdef SYS_linkat
214 syscall_table[SYS_linkat] = "linkat";
0fda6bd2 215#endif
44122162 216 syscall_table[SYS_listen] = "listen";
0fda6bd2 217 syscall_table[SYS_llseek] = "llseek";
0fda6bd2 218 syscall_table[SYS_lseek] = "lseek";
c18c06be 219#ifdef SYS_lstat
0fda6bd2
JM
220 syscall_table[SYS_lstat] = "lstat";
221#endif
c18c06be 222#ifdef SYS_lstat64
0fda6bd2
JM
223 syscall_table[SYS_lstat64] = "lstat64";
224#endif
0fda6bd2 225 syscall_table[SYS_lwp_cond_broadcast] = "lwp_cond_broadcast";
0fda6bd2 226 syscall_table[SYS_lwp_cond_signal] = "lwp_cond_signal";
0fda6bd2 227 syscall_table[SYS_lwp_cond_wait] = "lwp_cond_wait";
0fda6bd2 228 syscall_table[SYS_lwp_continue] = "lwp_continue";
0fda6bd2 229 syscall_table[SYS_lwp_create] = "lwp_create";
44122162 230 syscall_table[SYS_lwp_detach] = "lwp_detach";
0fda6bd2 231 syscall_table[SYS_lwp_exit] = "lwp_exit";
0fda6bd2 232 syscall_table[SYS_lwp_info] = "lwp_info";
c18c06be 233#ifdef SYS_lwp_kill
0fda6bd2
JM
234 syscall_table[SYS_lwp_kill] = "lwp_kill";
235#endif
c18c06be 236#ifdef SYS_lwp_mutex_lock
0fda6bd2
JM
237 syscall_table[SYS_lwp_mutex_lock] = "lwp_mutex_lock";
238#endif
44122162
RO
239 syscall_table[SYS_lwp_mutex_register] = "lwp_mutex_register";
240 syscall_table[SYS_lwp_mutex_timedlock] = "lwp_mutex_timedlock";
0fda6bd2 241 syscall_table[SYS_lwp_mutex_trylock] = "lwp_mutex_trylock";
0fda6bd2 242 syscall_table[SYS_lwp_mutex_unlock] = "lwp_mutex_unlock";
44122162
RO
243 syscall_table[SYS_lwp_mutex_wakeup] = "lwp_mutex_wakeup";
244#ifdef SYS_lwp_name
245 syscall_table[SYS_lwp_name] = "lwp_name";
0fda6bd2 246#endif
44122162 247 syscall_table[SYS_lwp_park] = "lwp_park";
0fda6bd2 248 syscall_table[SYS_lwp_private] = "lwp_private";
44122162 249 syscall_table[SYS_lwp_rwlock_sys] = "lwp_rwlock_sys";
0fda6bd2 250 syscall_table[SYS_lwp_self] = "lwp_self";
0fda6bd2 251 syscall_table[SYS_lwp_sema_post] = "lwp_sema_post";
44122162 252 syscall_table[SYS_lwp_sema_timedwait] = "lwp_sema_timedwait";
0fda6bd2 253 syscall_table[SYS_lwp_sema_trywait] = "lwp_sema_trywait";
c18c06be 254#ifdef SYS_lwp_sema_wait
0fda6bd2
JM
255 syscall_table[SYS_lwp_sema_wait] = "lwp_sema_wait";
256#endif
44122162
RO
257 syscall_table[SYS_lwp_sigmask] = "lwp_sigmask";
258#ifdef SYS_lwp_sigqueue
259 syscall_table[SYS_lwp_sigqueue] = "lwp_sigqueue";
0fda6bd2 260#endif
0fda6bd2 261 syscall_table[SYS_lwp_suspend] = "lwp_suspend";
0fda6bd2 262 syscall_table[SYS_lwp_wait] = "lwp_wait";
c18c06be 263#ifdef SYS_lxstat
0fda6bd2
JM
264 syscall_table[SYS_lxstat] = "lxstat";
265#endif
0fda6bd2 266 syscall_table[SYS_memcntl] = "memcntl";
44122162
RO
267#ifdef SYS_memsys
268 syscall_table[SYS_memsys] = "memsys";
0fda6bd2 269#endif
0fda6bd2 270 syscall_table[SYS_mincore] = "mincore";
c18c06be 271#ifdef SYS_mkdir
0fda6bd2
JM
272 syscall_table[SYS_mkdir] = "mkdir";
273#endif
44122162
RO
274#ifdef SYS_mkdirat
275 syscall_table[SYS_mkdirat] = "mkdirat";
0fda6bd2 276#endif
c18c06be 277#ifdef SYS_mknod
0fda6bd2
JM
278 syscall_table[SYS_mknod] = "mknod";
279#endif
44122162
RO
280#ifdef SYS_mknodat
281 syscall_table[SYS_mknodat] = "mknodat";
0fda6bd2 282#endif
0fda6bd2 283 syscall_table[SYS_mmap] = "mmap";
0fda6bd2 284 syscall_table[SYS_mmap64] = "mmap64";
44122162
RO
285#ifdef SYS_mmapobj
286 syscall_table[SYS_mmapobj] = "mmapobj";
0fda6bd2 287#endif
0fda6bd2 288 syscall_table[SYS_modctl] = "modctl";
0fda6bd2 289 syscall_table[SYS_mount] = "mount";
0fda6bd2 290 syscall_table[SYS_mprotect] = "mprotect";
0fda6bd2 291 syscall_table[SYS_msgsys] = "msgsys";
0fda6bd2 292 syscall_table[SYS_munmap] = "munmap";
0fda6bd2 293 syscall_table[SYS_nanosleep] = "nanosleep";
0fda6bd2 294 syscall_table[SYS_nfssys] = "nfssys";
0fda6bd2 295 syscall_table[SYS_nice] = "nice";
0fda6bd2 296 syscall_table[SYS_ntp_adjtime] = "ntp_adjtime";
0fda6bd2 297 syscall_table[SYS_ntp_gettime] = "ntp_gettime";
c18c06be 298#ifdef SYS_open
0fda6bd2
JM
299 syscall_table[SYS_open] = "open";
300#endif
c18c06be 301#ifdef SYS_open64
0fda6bd2
JM
302 syscall_table[SYS_open64] = "open64";
303#endif
44122162
RO
304#ifdef SYS_openat
305 syscall_table[SYS_openat] = "openat";
0fda6bd2 306#endif
44122162
RO
307#ifdef SYS_openat64
308 syscall_table[SYS_openat64] = "openat64";
0fda6bd2 309#endif
44122162 310 syscall_table[SYS_p_online] = "p_online";
0fda6bd2 311 syscall_table[SYS_pathconf] = "pathconf";
0fda6bd2 312 syscall_table[SYS_pause] = "pause";
44122162 313 syscall_table[SYS_pcsample] = "pcsample";
0fda6bd2 314 syscall_table[SYS_pgrpsys] = "pgrpsys";
0fda6bd2 315 syscall_table[SYS_pipe] = "pipe";
c18c06be 316#ifdef SYS_plock
0fda6bd2
JM
317 syscall_table[SYS_plock] = "plock";
318#endif
c18c06be 319#ifdef SYS_poll
0fda6bd2
JM
320 syscall_table[SYS_poll] = "poll";
321#endif
44122162
RO
322 syscall_table[SYS_pollsys] = "pollsys";
323 syscall_table[SYS_port] = "port";
0fda6bd2 324 syscall_table[SYS_pread] = "pread";
0fda6bd2 325 syscall_table[SYS_pread64] = "pread64";
0fda6bd2 326 syscall_table[SYS_priocntlsys] = "priocntlsys";
44122162 327 syscall_table[SYS_privsys] = "privsys";
c18c06be 328#ifdef SYS_processor_bind
0fda6bd2
JM
329 syscall_table[SYS_processor_bind] = "processor_bind";
330#endif
c18c06be 331#ifdef SYS_processor_info
0fda6bd2
JM
332 syscall_table[SYS_processor_info] = "processor_info";
333#endif
44122162
RO
334#ifdef SYS_processor_sys
335 syscall_table[SYS_processor_sys] = "processor_sys";
0fda6bd2 336#endif
0fda6bd2 337 syscall_table[SYS_profil] = "profil";
0fda6bd2 338 syscall_table[SYS_pset] = "pset";
0fda6bd2 339 syscall_table[SYS_putmsg] = "putmsg";
0fda6bd2 340 syscall_table[SYS_putpmsg] = "putpmsg";
0fda6bd2 341 syscall_table[SYS_pwrite] = "pwrite";
0fda6bd2 342 syscall_table[SYS_pwrite64] = "pwrite64";
44122162 343 syscall_table[SYS_rctlsys] = "rctlsys";
0fda6bd2 344 syscall_table[SYS_read] = "read";
c18c06be 345#ifdef SYS_readlink
0fda6bd2
JM
346 syscall_table[SYS_readlink] = "readlink";
347#endif
44122162
RO
348#ifdef SYS_readlinkat
349 syscall_table[SYS_readlinkat] = "readlinkat";
0fda6bd2 350#endif
44122162 351 syscall_table[SYS_readv] = "readv";
0fda6bd2 352 syscall_table[SYS_recv] = "recv";
0fda6bd2 353 syscall_table[SYS_recvfrom] = "recvfrom";
44122162
RO
354#ifdef SYS_recvmmsg
355 syscall_table[SYS_recvmmsg] = "recvmmsg";
0fda6bd2 356#endif
0fda6bd2 357 syscall_table[SYS_recvmsg] = "recvmsg";
44122162
RO
358#ifdef SYS_reflinkat
359 syscall_table[SYS_reflinkat] = "reflinkat";
0fda6bd2 360#endif
c18c06be 361#ifdef SYS_rename
0fda6bd2
JM
362 syscall_table[SYS_rename] = "rename";
363#endif
44122162
RO
364#ifdef SYS_renameat
365 syscall_table[SYS_renameat] = "renameat";
0fda6bd2 366#endif
44122162 367 syscall_table[SYS_resolvepath] = "resolvepath";
c18c06be 368#ifdef SYS_rmdir
0fda6bd2
JM
369 syscall_table[SYS_rmdir] = "rmdir";
370#endif
0fda6bd2 371 syscall_table[SYS_rpcsys] = "rpcsys";
44122162 372 syscall_table[SYS_rusagesys] = "rusagesys";
0fda6bd2 373 syscall_table[SYS_schedctl] = "schedctl";
c18c06be 374#ifdef SYS_secsys
0fda6bd2
JM
375 syscall_table[SYS_secsys] = "secsys";
376#endif
0fda6bd2 377 syscall_table[SYS_semsys] = "semsys";
0fda6bd2 378 syscall_table[SYS_send] = "send";
44122162
RO
379 syscall_table[SYS_sendfilev] = "sendfilev";
380#ifdef SYS_sendmmsg
381 syscall_table[SYS_sendmmsg] = "sendmmsg";
0fda6bd2 382#endif
0fda6bd2 383 syscall_table[SYS_sendmsg] = "sendmsg";
0fda6bd2 384 syscall_table[SYS_sendto] = "sendto";
0fda6bd2 385 syscall_table[SYS_setegid] = "setegid";
0fda6bd2 386 syscall_table[SYS_seteuid] = "seteuid";
0fda6bd2 387 syscall_table[SYS_setgid] = "setgid";
0fda6bd2 388 syscall_table[SYS_setgroups] = "setgroups";
0fda6bd2 389 syscall_table[SYS_setitimer] = "setitimer";
0fda6bd2 390 syscall_table[SYS_setregid] = "setregid";
0fda6bd2 391 syscall_table[SYS_setreuid] = "setreuid";
0fda6bd2 392 syscall_table[SYS_setrlimit] = "setrlimit";
0fda6bd2 393 syscall_table[SYS_setrlimit64] = "setrlimit64";
0fda6bd2 394 syscall_table[SYS_setsockopt] = "setsockopt";
0fda6bd2 395 syscall_table[SYS_setuid] = "setuid";
44122162 396 syscall_table[SYS_sharefs] = "sharefs";
0fda6bd2 397 syscall_table[SYS_shmsys] = "shmsys";
0fda6bd2 398 syscall_table[SYS_shutdown] = "shutdown";
44122162
RO
399#ifdef SYS_sidsys
400 syscall_table[SYS_sidsys] = "sidsys";
0fda6bd2 401#endif
0fda6bd2 402 syscall_table[SYS_sigaction] = "sigaction";
0fda6bd2 403 syscall_table[SYS_sigaltstack] = "sigaltstack";
c18c06be 404#ifdef SYS_signal
0fda6bd2
JM
405 syscall_table[SYS_signal] = "signal";
406#endif
0fda6bd2 407 syscall_table[SYS_signotify] = "signotify";
0fda6bd2 408 syscall_table[SYS_sigpending] = "sigpending";
0fda6bd2 409 syscall_table[SYS_sigprocmask] = "sigprocmask";
0fda6bd2 410 syscall_table[SYS_sigqueue] = "sigqueue";
44122162
RO
411#ifdef SYS_sigresend
412 syscall_table[SYS_sigresend] = "sigresend";
0fda6bd2 413#endif
0fda6bd2 414 syscall_table[SYS_sigsendsys] = "sigsendsys";
0fda6bd2 415 syscall_table[SYS_sigsuspend] = "sigsuspend";
44122162 416 syscall_table[SYS_sigtimedwait] = "sigtimedwait";
0fda6bd2 417 syscall_table[SYS_so_socket] = "so_socket";
0fda6bd2 418 syscall_table[SYS_so_socketpair] = "so_socketpair";
0fda6bd2 419 syscall_table[SYS_sockconfig] = "sockconfig";
44122162
RO
420#ifdef SYS_sparc_fixalign
421 syscall_table[SYS_sparc_fixalign] = "sparc_fixalign";
0fda6bd2 422#endif
44122162
RO
423 syscall_table[SYS_sparc_utrap_install] = "sparc_utrap_install";
424#ifdef SYS_spawn
425 syscall_table[SYS_spawn] = "spawn";
0fda6bd2 426#endif
c18c06be 427#ifdef SYS_stat
0fda6bd2
JM
428 syscall_table[SYS_stat] = "stat";
429#endif
c18c06be 430#ifdef SYS_stat64
0fda6bd2
JM
431 syscall_table[SYS_stat64] = "stat64";
432#endif
0fda6bd2 433 syscall_table[SYS_statfs] = "statfs";
0fda6bd2 434 syscall_table[SYS_statvfs] = "statvfs";
0fda6bd2 435 syscall_table[SYS_statvfs64] = "statvfs64";
0fda6bd2 436 syscall_table[SYS_stime] = "stime";
0fda6bd2 437 syscall_table[SYS_stty] = "stty";
c18c06be 438#ifdef SYS_symlink
0fda6bd2
JM
439 syscall_table[SYS_symlink] = "symlink";
440#endif
44122162
RO
441#ifdef SYS_symlinkat
442 syscall_table[SYS_symlinkat] = "symlinkat";
0fda6bd2 443#endif
44122162 444 syscall_table[SYS_sync] = "sync";
0fda6bd2 445 syscall_table[SYS_syscall] = "syscall";
0fda6bd2 446 syscall_table[SYS_sysconfig] = "sysconfig";
0fda6bd2 447 syscall_table[SYS_sysfs] = "sysfs";
0fda6bd2 448 syscall_table[SYS_sysi86] = "sysi86";
c18c06be 449#ifdef SYS_syssun
0fda6bd2
JM
450 syscall_table[SYS_syssun] = "syssun";
451#endif
44122162
RO
452#ifdef SYS_system_stats
453 syscall_table[SYS_system_stats] = "system_stats";
0fda6bd2 454#endif
44122162
RO
455 syscall_table[SYS_systeminfo] = "systeminfo";
456 syscall_table[SYS_tasksys] = "tasksys";
0fda6bd2 457 syscall_table[SYS_time] = "time";
0fda6bd2 458 syscall_table[SYS_timer_create] = "timer_create";
0fda6bd2 459 syscall_table[SYS_timer_delete] = "timer_delete";
0fda6bd2 460 syscall_table[SYS_timer_getoverrun] = "timer_getoverrun";
0fda6bd2 461 syscall_table[SYS_timer_gettime] = "timer_gettime";
0fda6bd2 462 syscall_table[SYS_timer_settime] = "timer_settime";
0fda6bd2 463 syscall_table[SYS_times] = "times";
0fda6bd2 464 syscall_table[SYS_uadmin] = "uadmin";
44122162 465 syscall_table[SYS_ucredsys] = "ucredsys";
0fda6bd2 466 syscall_table[SYS_ulimit] = "ulimit";
0fda6bd2 467 syscall_table[SYS_umask] = "umask";
c18c06be 468#ifdef SYS_umount
0fda6bd2
JM
469 syscall_table[SYS_umount] = "umount";
470#endif
44122162 471 syscall_table[SYS_umount2] = "umount2";
0fda6bd2 472 syscall_table[SYS_uname] = "uname";
c18c06be 473#ifdef SYS_unlink
0fda6bd2
JM
474 syscall_table[SYS_unlink] = "unlink";
475#endif
44122162
RO
476#ifdef SYS_unlinkat
477 syscall_table[SYS_unlinkat] = "unlinkat";
0fda6bd2 478#endif
c18c06be 479#ifdef SYS_utime
0fda6bd2
JM
480 syscall_table[SYS_utime] = "utime";
481#endif
44122162
RO
482#ifdef SYS_utimensat
483 syscall_table[SYS_utimensat] = "utimensat";
484#endif
c18c06be 485#ifdef SYS_utimes
0fda6bd2
JM
486 syscall_table[SYS_utimes] = "utimes";
487#endif
44122162
RO
488#ifdef SYS_utimesys
489 syscall_table[SYS_utimesys] = "utimesys";
490#endif
0fda6bd2 491 syscall_table[SYS_utssys] = "utssys";
44122162
RO
492 syscall_table[SYS_uucopy] = "uucopy";
493 syscall_table[SYS_uucopystr] = "uucopystr";
e28b63a9 494#ifdef SYS_uuidsys
44122162 495 syscall_table[SYS_uuidsys] = "uuidsys";
e28b63a9 496#endif
44122162
RO
497#ifdef SYS_va_mask
498 syscall_table[SYS_va_mask] = "va_mask";
0fda6bd2 499#endif
0fda6bd2 500 syscall_table[SYS_vfork] = "vfork";
0fda6bd2 501 syscall_table[SYS_vhangup] = "vhangup";
c18c06be 502#ifdef SYS_wait
0fda6bd2
JM
503 syscall_table[SYS_wait] = "wait";
504#endif
c18c06be 505#ifdef SYS_waitid
0fda6bd2
JM
506 syscall_table[SYS_waitid] = "waitid";
507#endif
c18c06be 508#ifdef SYS_waitsys
0fda6bd2
JM
509 syscall_table[SYS_waitsys] = "waitsys";
510#endif
0fda6bd2 511 syscall_table[SYS_write] = "write";
0fda6bd2 512 syscall_table[SYS_writev] = "writev";
c18c06be 513#ifdef SYS_xmknod
0fda6bd2
JM
514 syscall_table[SYS_xmknod] = "xmknod";
515#endif
c18c06be 516#ifdef SYS_xstat
0fda6bd2
JM
517 syscall_table[SYS_xstat] = "xstat";
518#endif
0fda6bd2 519 syscall_table[SYS_yield] = "yield";
44122162 520 syscall_table[SYS_zone] = "zone";
5bfb05ca 521}
0fda6bd2 522
c18c06be 523/* Prettyprint syscall NUM. */
0fda6bd2
JM
524
525void
fba45db2 526proc_prettyfprint_syscall (FILE *file, int num, int verbose)
0fda6bd2
JM
527{
528 if (syscall_table[num])
529 fprintf (file, "SYS_%s ", syscall_table[num]);
530 else
531 fprintf (file, "<Unknown syscall %d> ", num);
532}
533
534void
fba45db2 535proc_prettyprint_syscall (int num, int verbose)
0fda6bd2
JM
536{
537 proc_prettyfprint_syscall (stdout, num, verbose);
538}
539
c18c06be 540/* Prettyprint all syscalls in SYSSET. */
0fda6bd2
JM
541
542void
fba45db2 543proc_prettyfprint_syscalls (FILE *file, sysset_t *sysset, int verbose)
0fda6bd2
JM
544{
545 int i;
546
547 for (i = 0; i < MAX_SYSCALLS; i++)
548 if (prismember (sysset, i))
549 {
550 proc_prettyfprint_syscall (file, i, verbose);
551 }
552 fprintf (file, "\n");
553}
554
555void
fba45db2 556proc_prettyprint_syscalls (sysset_t *sysset, int verbose)
0fda6bd2
JM
557{
558 proc_prettyfprint_syscalls (stdout, sysset, verbose);
559}
c18c06be
MK
560\f
561/* Prettyprint signals. */
0fda6bd2 562
3657956b
GB
563/* Signal translation table, ordered ANSI-standard signals first,
564 other signals second, with signals in each block ordered by their
565 numerical values on a typical POSIX platform. */
0fda6bd2
JM
566
567static struct trans signal_table[] =
568{
569 { 0, "<no signal>", "no signal" },
3657956b
GB
570
571 /* SIGINT, SIGILL, SIGABRT, SIGFPE, SIGSEGV and SIGTERM
572 are ANSI-standard signals and are always available. */
573
574 { SIGINT, "SIGINT", "Interrupt (rubout)" },
575 { SIGILL, "SIGILL", "Illegal instruction" }, /* not reset when caught */
576 { SIGABRT, "SIGABRT", "used by abort()" }, /* replaces SIGIOT */
577 { SIGFPE, "SIGFPE", "Floating point exception" },
578 { SIGSEGV, "SIGSEGV", "Segmentation violation" },
579 { SIGTERM, "SIGTERM", "Software termination signal from kill" },
580
581 /* All other signals need preprocessor conditionals. */
582
0fda6bd2 583 { SIGHUP, "SIGHUP", "Hangup" },
0fda6bd2 584 { SIGQUIT, "SIGQUIT", "Quit (ASCII FS)" },
0fda6bd2 585 { SIGTRAP, "SIGTRAP", "Trace trap" }, /* not reset when caught */
0fda6bd2 586 { SIGIOT, "SIGIOT", "IOT instruction" },
0fda6bd2 587 { SIGEMT, "SIGEMT", "EMT instruction" },
0fda6bd2 588 { SIGKILL, "SIGKILL", "Kill" }, /* Solaris: cannot be caught/ignored */
0fda6bd2 589 { SIGBUS, "SIGBUS", "Bus error" },
0fda6bd2 590 { SIGSYS, "SIGSYS", "Bad argument to system call" },
0fda6bd2 591 { SIGPIPE, "SIGPIPE", "Write to pipe with no one to read it" },
0fda6bd2 592 { SIGALRM, "SIGALRM", "Alarm clock" },
0fda6bd2 593 { SIGUSR1, "SIGUSR1", "User defined signal 1" },
0fda6bd2 594 { SIGUSR2, "SIGUSR2", "User defined signal 2" },
0fda6bd2 595 { SIGCHLD, "SIGCHLD", "Child status changed" }, /* Posix version */
0fda6bd2 596 { SIGCLD, "SIGCLD", "Child status changed" }, /* Solaris version */
0fda6bd2 597 { SIGPWR, "SIGPWR", "Power-fail restart" },
0fda6bd2 598 { SIGWINCH, "SIGWINCH", "Window size change" },
0fda6bd2 599 { SIGURG, "SIGURG", "Urgent socket condition" },
0fda6bd2 600 { SIGPOLL, "SIGPOLL", "Pollable event" },
0fda6bd2 601 { SIGIO, "SIGIO", "Socket I/O possible" }, /* alias for SIGPOLL */
3e43a32a
MS
602 { SIGSTOP, "SIGSTOP", "Stop, not from tty" }, /* cannot be caught or
603 ignored */
0fda6bd2 604 { SIGTSTP, "SIGTSTP", "User stop from tty" },
0fda6bd2 605 { SIGCONT, "SIGCONT", "Stopped process has been continued" },
0fda6bd2 606 { SIGTTIN, "SIGTTIN", "Background tty read attempted" },
0fda6bd2 607 { SIGTTOU, "SIGTTOU", "Background tty write attempted" },
0fda6bd2 608 { SIGVTALRM, "SIGVTALRM", "Virtual timer expired" },
0fda6bd2 609 { SIGPROF, "SIGPROF", "Profiling timer expired" },
0fda6bd2 610 { SIGXCPU, "SIGXCPU", "Exceeded CPU limit" },
0fda6bd2 611 { SIGXFSZ, "SIGXFSZ", "Exceeded file size limit" },
0fda6bd2 612 { SIGWAITING, "SIGWAITING", "Process's LWPs are blocked" },
0fda6bd2 613 { SIGLWP, "SIGLWP", "Used by thread library" },
0fda6bd2 614 { SIGFREEZE, "SIGFREEZE", "Used by CPR" },
0fda6bd2 615 { SIGTHAW, "SIGTHAW", "Used by CPR" },
0fda6bd2 616 { SIGCANCEL, "SIGCANCEL", "Used by libthread" },
0fda6bd2 617 { SIGLOST, "SIGLOST", "Resource lost" },
c18c06be
MK
618
619 /* FIXME: add real-time signals. */
0fda6bd2
JM
620};
621
c18c06be 622/* Prettyprint signal number SIGNO. */
0fda6bd2
JM
623
624void
fba45db2 625proc_prettyfprint_signal (FILE *file, int signo, int verbose)
0fda6bd2
JM
626{
627 int i;
628
629 for (i = 0; i < sizeof (signal_table) / sizeof (signal_table[0]); i++)
630 if (signo == signal_table[i].value)
631 {
632 fprintf (file, "%s", signal_table[i].name);
633 if (verbose)
634 fprintf (file, ": %s\n", signal_table[i].desc);
635 else
636 fprintf (file, " ");
637 return;
638 }
639 fprintf (file, "Unknown signal %d%c", signo, verbose ? '\n' : ' ');
640}
641
642void
fba45db2 643proc_prettyprint_signal (int signo, int verbose)
0fda6bd2
JM
644{
645 proc_prettyfprint_signal (stdout, signo, verbose);
646}
647
c18c06be 648/* Prettyprint all signals in SIGSET. */
0fda6bd2
JM
649
650void
fba45db2 651proc_prettyfprint_signalset (FILE *file, sigset_t *sigset, int verbose)
0fda6bd2
JM
652{
653 int i;
654
c18c06be
MK
655 /* Loop over all signal numbers from 0 to NSIG, using them as the
656 index to prismember. The signal table had better not contain
657 aliases, for if it does they will both be printed. */
658
0fda6bd2
JM
659 for (i = 0; i < NSIG; i++)
660 if (prismember (sigset, i))
661 proc_prettyfprint_signal (file, i, verbose);
662
663 if (!verbose)
664 fprintf (file, "\n");
665}
666
667void
fba45db2 668proc_prettyprint_signalset (sigset_t *sigset, int verbose)
0fda6bd2
JM
669{
670 proc_prettyfprint_signalset (stdout, sigset, verbose);
671}
c18c06be 672\f
0fda6bd2 673
c18c06be
MK
674/* Prettyprint faults. */
675
676/* Fault translation table. */
0fda6bd2
JM
677
678static struct trans fault_table[] =
679{
0fda6bd2 680 { FLTILL, "FLTILL", "Illegal instruction" },
0fda6bd2 681 { FLTPRIV, "FLTPRIV", "Privileged instruction" },
0fda6bd2 682 { FLTBPT, "FLTBPT", "Breakpoint trap" },
0fda6bd2 683 { FLTTRACE, "FLTTRACE", "Trace trap" },
0fda6bd2 684 { FLTACCESS, "FLTACCESS", "Memory access fault" },
0fda6bd2 685 { FLTBOUNDS, "FLTBOUNDS", "Memory bounds violation" },
0fda6bd2 686 { FLTIOVF, "FLTIOVF", "Integer overflow" },
0fda6bd2 687 { FLTIZDIV, "FLTIZDIV", "Integer zero divide" },
0fda6bd2 688 { FLTFPE, "FLTFPE", "Floating-point exception" },
0fda6bd2 689 { FLTSTACK, "FLTSTACK", "Unrecoverable stack fault" },
0fda6bd2 690 { FLTPAGE, "FLTPAGE", "Recoverable page fault" },
0fda6bd2 691 { FLTWATCH, "FLTWATCH", "User watchpoint" },
0fda6bd2
JM
692};
693
c18c06be
MK
694/* Work horse. Accepts an index into the fault table, prints it
695 pretty. */
0fda6bd2
JM
696
697static void
fba45db2 698prettyfprint_faulttable_entry (FILE *file, int i, int verbose)
0fda6bd2
JM
699{
700 fprintf (file, "%s", fault_table[i].name);
701 if (verbose)
702 fprintf (file, ": %s\n", fault_table[i].desc);
703 else
704 fprintf (file, " ");
705}
706
c18c06be 707/* Prettyprint hardware fault number FAULTNO. */
0fda6bd2
JM
708
709void
fba45db2 710proc_prettyfprint_fault (FILE *file, int faultno, int verbose)
0fda6bd2
JM
711{
712 int i;
713
c18c06be 714 for (i = 0; i < ARRAY_SIZE (fault_table); i++)
0fda6bd2
JM
715 if (faultno == fault_table[i].value)
716 {
717 prettyfprint_faulttable_entry (file, i, verbose);
718 return;
719 }
720
721 fprintf (file, "Unknown hardware fault %d%c",
722 faultno, verbose ? '\n' : ' ');
723}
724
725void
fba45db2 726proc_prettyprint_fault (int faultno, int verbose)
0fda6bd2
JM
727{
728 proc_prettyfprint_fault (stdout, faultno, verbose);
729}
730
c18c06be 731/* Prettyprint all faults in FLTSET. */
0fda6bd2
JM
732
733void
fba45db2 734proc_prettyfprint_faultset (FILE *file, fltset_t *fltset, int verbose)
0fda6bd2
JM
735{
736 int i;
737
c18c06be
MK
738 /* Loop through the fault table, using the value field as the index
739 to prismember. The fault table had better not contain aliases,
740 for if it does they will both be printed. */
741
742 for (i = 0; i < ARRAY_SIZE (fault_table); i++)
0fda6bd2
JM
743 if (prismember (fltset, fault_table[i].value))
744 prettyfprint_faulttable_entry (file, i, verbose);
745
746 if (!verbose)
747 fprintf (file, "\n");
748}
749
750void
fba45db2 751proc_prettyprint_faultset (fltset_t *fltset, int verbose)
0fda6bd2
JM
752{
753 proc_prettyfprint_faultset (stdout, fltset, verbose);
754}
755
c18c06be 756/* TODO: actions, holds... */
0fda6bd2
JM
757
758void
759proc_prettyprint_actionset (struct sigaction *actions, int verbose)
760{
761}
762
6c265988 763void _initialize_proc_events ();
0fda6bd2 764void
6c265988 765_initialize_proc_events ()
0fda6bd2
JM
766{
767 init_syscall_table ();
768}
This page took 2.179709 seconds and 4 git commands to generate.