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