1 /* Machine-independent support for Solaris /proc (process file system)
3 Copyright (C) 1999-2022 Free Software Foundation, Inc.
5 Written by Michael Snyder at Cygnus Solutions.
6 Based on work by Fred Fish, Stu Grossman, Geoff Noer, and others.
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
10 the Free Software Foundation; either version 3 of the License, or
11 (at your option) any later version.
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.
18 You should have received a copy of the GNU General Public License
19 along with this program. If not, see <http://www.gnu.org/licenses/>. */
21 /* Pretty-print "events of interest".
23 This module includes pretty-print routines for:
24 * faults (hardware exceptions)
25 * signals (software interrupts)
28 FIXME: At present, the syscall translation table must be
29 initialized, which is not true of the other translation tables. */
33 #include <sys/types.h>
34 #include <sys/procfs.h>
35 #include <sys/syscall.h>
36 #include <sys/fault.h>
38 #include "proc-utils.h"
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
48 int value
; /* The numeric value. */
49 const char *name
; /* The equivalent symbolic value. */
50 const char *desc
; /* Short description of value. */
54 /* Pretty print syscalls. */
56 /* Syscall translation table. */
58 #define MAX_SYSCALLS 262 /* Pretty arbitrary. */
59 static const char *syscall_table
[MAX_SYSCALLS
];
62 init_syscall_table (void)
64 syscall_table
[SYS_accept
] = "accept";
66 syscall_table
[SYS_access
] = "access";
68 syscall_table
[SYS_acct
] = "acct";
69 syscall_table
[SYS_acctctl
] = "acctctl";
70 syscall_table
[SYS_acl
] = "acl";
72 syscall_table
[SYS_adi
] = "adi";
74 syscall_table
[SYS_adjtime
] = "adjtime";
75 syscall_table
[SYS_alarm
] = "alarm";
76 syscall_table
[SYS_auditsys
] = "auditsys";
77 syscall_table
[SYS_autofssys
] = "autofssys";
78 syscall_table
[SYS_bind
] = "bind";
79 syscall_table
[SYS_brand
] = "brand";
80 syscall_table
[SYS_brk
] = "brk";
81 syscall_table
[SYS_chdir
] = "chdir";
83 syscall_table
[SYS_chmod
] = "chmod";
86 syscall_table
[SYS_chown
] = "chown";
88 syscall_table
[SYS_chroot
] = "chroot";
89 syscall_table
[SYS_cladm
] = "cladm";
90 syscall_table
[SYS_clock_getres
] = "clock_getres";
91 syscall_table
[SYS_clock_gettime
] = "clock_gettime";
92 syscall_table
[SYS_clock_settime
] = "clock_settime";
93 syscall_table
[SYS_close
] = "close";
94 syscall_table
[SYS_connect
] = "connect";
95 syscall_table
[SYS_context
] = "context";
96 syscall_table
[SYS_corectl
] = "corectl";
97 syscall_table
[SYS_cpc
] = "cpc";
99 syscall_table
[SYS_creat
] = "creat";
102 syscall_table
[SYS_creat64
] = "creat64";
104 syscall_table
[SYS_door
] = "door";
106 syscall_table
[SYS_dup
] = "dup";
109 syscall_table
[SYS_evsys
] = "evsys";
112 syscall_table
[SYS_evtrapret
] = "evtrapret";
114 syscall_table
[SYS_exacctsys
] = "exacctsys";
116 syscall_table
[SYS_exec
] = "exec";
118 syscall_table
[SYS_execve
] = "execve";
119 syscall_table
[SYS_exit
] = "exit";
121 syscall_table
[SYS_faccessat
] = "faccessat";
123 syscall_table
[SYS_facl
] = "facl";
124 syscall_table
[SYS_fchdir
] = "fchdir";
126 syscall_table
[SYS_fchmod
] = "fchmod";
129 syscall_table
[SYS_fchmodat
] = "fchmodat";
132 syscall_table
[SYS_fchown
] = "fchown";
135 syscall_table
[SYS_fchownat
] = "fchownat";
137 syscall_table
[SYS_fchroot
] = "fchroot";
138 syscall_table
[SYS_fcntl
] = "fcntl";
139 syscall_table
[SYS_fdsync
] = "fdsync";
141 syscall_table
[SYS_fork1
] = "fork1";
144 syscall_table
[SYS_forkall
] = "forkall";
147 syscall_table
[SYS_forksys
] = "forksys";
149 syscall_table
[SYS_fpathconf
] = "fpathconf";
150 #ifdef SYS_frealpathat
151 syscall_table
[SYS_frealpathat
] = "frealpathat";
154 syscall_table
[SYS_fsat
] = "fsat";
157 syscall_table
[SYS_fstat
] = "fstat";
160 syscall_table
[SYS_fstat64
] = "fstat64";
163 syscall_table
[SYS_fstatat
] = "fstatat";
166 syscall_table
[SYS_fstatat64
] = "fstatat64";
168 syscall_table
[SYS_fstatfs
] = "fstatfs";
169 syscall_table
[SYS_fstatvfs
] = "fstatvfs";
170 syscall_table
[SYS_fstatvfs64
] = "fstatvfs64";
172 syscall_table
[SYS_fxstat
] = "fxstat";
174 syscall_table
[SYS_getcwd
] = "getcwd";
175 syscall_table
[SYS_getdents
] = "getdents";
176 syscall_table
[SYS_getdents64
] = "getdents64";
177 syscall_table
[SYS_getgid
] = "getgid";
178 syscall_table
[SYS_getgroups
] = "getgroups";
179 syscall_table
[SYS_getitimer
] = "getitimer";
180 syscall_table
[SYS_getloadavg
] = "getloadavg";
181 syscall_table
[SYS_getmsg
] = "getmsg";
182 syscall_table
[SYS_getpagesizes
] = "getpagesizes";
183 syscall_table
[SYS_getpeername
] = "getpeername";
184 syscall_table
[SYS_getpid
] = "getpid";
185 syscall_table
[SYS_getpmsg
] = "getpmsg";
187 syscall_table
[SYS_getrandom
] = "getrandom";
189 syscall_table
[SYS_getrlimit
] = "getrlimit";
190 syscall_table
[SYS_getrlimit64
] = "getrlimit64";
191 syscall_table
[SYS_getsockname
] = "getsockname";
192 syscall_table
[SYS_getsockopt
] = "getsockopt";
193 syscall_table
[SYS_gettimeofday
] = "gettimeofday";
194 syscall_table
[SYS_getuid
] = "getuid";
195 syscall_table
[SYS_gtty
] = "gtty";
196 syscall_table
[SYS_hrtsys
] = "hrtsys";
197 syscall_table
[SYS_inst_sync
] = "inst_sync";
198 syscall_table
[SYS_install_utrap
] = "install_utrap";
199 syscall_table
[SYS_ioctl
] = "ioctl";
201 syscall_table
[SYS_issetugid
] = "issetugid";
203 syscall_table
[SYS_kaio
] = "kaio";
204 syscall_table
[SYS_kill
] = "kill";
205 syscall_table
[SYS_labelsys
] = "labelsys";
207 syscall_table
[SYS_lchown
] = "lchown";
209 syscall_table
[SYS_lgrpsys
] = "lgrpsys";
211 syscall_table
[SYS_link
] = "link";
214 syscall_table
[SYS_linkat
] = "linkat";
216 syscall_table
[SYS_listen
] = "listen";
217 syscall_table
[SYS_llseek
] = "llseek";
218 syscall_table
[SYS_lseek
] = "lseek";
220 syscall_table
[SYS_lstat
] = "lstat";
223 syscall_table
[SYS_lstat64
] = "lstat64";
225 syscall_table
[SYS_lwp_cond_broadcast
] = "lwp_cond_broadcast";
226 syscall_table
[SYS_lwp_cond_signal
] = "lwp_cond_signal";
227 syscall_table
[SYS_lwp_cond_wait
] = "lwp_cond_wait";
228 syscall_table
[SYS_lwp_continue
] = "lwp_continue";
229 syscall_table
[SYS_lwp_create
] = "lwp_create";
230 syscall_table
[SYS_lwp_detach
] = "lwp_detach";
231 syscall_table
[SYS_lwp_exit
] = "lwp_exit";
232 syscall_table
[SYS_lwp_info
] = "lwp_info";
234 syscall_table
[SYS_lwp_kill
] = "lwp_kill";
236 #ifdef SYS_lwp_mutex_lock
237 syscall_table
[SYS_lwp_mutex_lock
] = "lwp_mutex_lock";
239 syscall_table
[SYS_lwp_mutex_register
] = "lwp_mutex_register";
240 syscall_table
[SYS_lwp_mutex_timedlock
] = "lwp_mutex_timedlock";
241 syscall_table
[SYS_lwp_mutex_trylock
] = "lwp_mutex_trylock";
242 syscall_table
[SYS_lwp_mutex_unlock
] = "lwp_mutex_unlock";
243 syscall_table
[SYS_lwp_mutex_wakeup
] = "lwp_mutex_wakeup";
245 syscall_table
[SYS_lwp_name
] = "lwp_name";
247 syscall_table
[SYS_lwp_park
] = "lwp_park";
248 syscall_table
[SYS_lwp_private
] = "lwp_private";
249 syscall_table
[SYS_lwp_rwlock_sys
] = "lwp_rwlock_sys";
250 syscall_table
[SYS_lwp_self
] = "lwp_self";
251 syscall_table
[SYS_lwp_sema_post
] = "lwp_sema_post";
252 syscall_table
[SYS_lwp_sema_timedwait
] = "lwp_sema_timedwait";
253 syscall_table
[SYS_lwp_sema_trywait
] = "lwp_sema_trywait";
254 #ifdef SYS_lwp_sema_wait
255 syscall_table
[SYS_lwp_sema_wait
] = "lwp_sema_wait";
257 syscall_table
[SYS_lwp_sigmask
] = "lwp_sigmask";
258 #ifdef SYS_lwp_sigqueue
259 syscall_table
[SYS_lwp_sigqueue
] = "lwp_sigqueue";
261 syscall_table
[SYS_lwp_suspend
] = "lwp_suspend";
262 syscall_table
[SYS_lwp_wait
] = "lwp_wait";
264 syscall_table
[SYS_lxstat
] = "lxstat";
266 syscall_table
[SYS_memcntl
] = "memcntl";
268 syscall_table
[SYS_memsys
] = "memsys";
270 syscall_table
[SYS_mincore
] = "mincore";
272 syscall_table
[SYS_mkdir
] = "mkdir";
275 syscall_table
[SYS_mkdirat
] = "mkdirat";
278 syscall_table
[SYS_mknod
] = "mknod";
281 syscall_table
[SYS_mknodat
] = "mknodat";
283 syscall_table
[SYS_mmap
] = "mmap";
284 syscall_table
[SYS_mmap64
] = "mmap64";
286 syscall_table
[SYS_mmapobj
] = "mmapobj";
288 syscall_table
[SYS_modctl
] = "modctl";
289 syscall_table
[SYS_mount
] = "mount";
290 syscall_table
[SYS_mprotect
] = "mprotect";
291 syscall_table
[SYS_msgsys
] = "msgsys";
292 syscall_table
[SYS_munmap
] = "munmap";
293 syscall_table
[SYS_nanosleep
] = "nanosleep";
294 syscall_table
[SYS_nfssys
] = "nfssys";
295 syscall_table
[SYS_nice
] = "nice";
296 syscall_table
[SYS_ntp_adjtime
] = "ntp_adjtime";
297 syscall_table
[SYS_ntp_gettime
] = "ntp_gettime";
299 syscall_table
[SYS_open
] = "open";
302 syscall_table
[SYS_open64
] = "open64";
305 syscall_table
[SYS_openat
] = "openat";
308 syscall_table
[SYS_openat64
] = "openat64";
310 syscall_table
[SYS_p_online
] = "p_online";
311 syscall_table
[SYS_pathconf
] = "pathconf";
312 syscall_table
[SYS_pause
] = "pause";
313 syscall_table
[SYS_pcsample
] = "pcsample";
314 syscall_table
[SYS_pgrpsys
] = "pgrpsys";
315 syscall_table
[SYS_pipe
] = "pipe";
317 syscall_table
[SYS_plock
] = "plock";
320 syscall_table
[SYS_poll
] = "poll";
322 syscall_table
[SYS_pollsys
] = "pollsys";
323 syscall_table
[SYS_port
] = "port";
324 syscall_table
[SYS_pread
] = "pread";
325 syscall_table
[SYS_pread64
] = "pread64";
326 syscall_table
[SYS_priocntlsys
] = "priocntlsys";
327 syscall_table
[SYS_privsys
] = "privsys";
328 #ifdef SYS_processor_bind
329 syscall_table
[SYS_processor_bind
] = "processor_bind";
331 #ifdef SYS_processor_info
332 syscall_table
[SYS_processor_info
] = "processor_info";
334 #ifdef SYS_processor_sys
335 syscall_table
[SYS_processor_sys
] = "processor_sys";
337 syscall_table
[SYS_profil
] = "profil";
338 syscall_table
[SYS_pset
] = "pset";
339 syscall_table
[SYS_putmsg
] = "putmsg";
340 syscall_table
[SYS_putpmsg
] = "putpmsg";
341 syscall_table
[SYS_pwrite
] = "pwrite";
342 syscall_table
[SYS_pwrite64
] = "pwrite64";
343 syscall_table
[SYS_rctlsys
] = "rctlsys";
344 syscall_table
[SYS_read
] = "read";
346 syscall_table
[SYS_readlink
] = "readlink";
348 #ifdef SYS_readlinkat
349 syscall_table
[SYS_readlinkat
] = "readlinkat";
351 syscall_table
[SYS_readv
] = "readv";
352 syscall_table
[SYS_recv
] = "recv";
353 syscall_table
[SYS_recvfrom
] = "recvfrom";
355 syscall_table
[SYS_recvmmsg
] = "recvmmsg";
357 syscall_table
[SYS_recvmsg
] = "recvmsg";
359 syscall_table
[SYS_reflinkat
] = "reflinkat";
362 syscall_table
[SYS_rename
] = "rename";
365 syscall_table
[SYS_renameat
] = "renameat";
367 syscall_table
[SYS_resolvepath
] = "resolvepath";
369 syscall_table
[SYS_rmdir
] = "rmdir";
371 syscall_table
[SYS_rpcsys
] = "rpcsys";
372 syscall_table
[SYS_rusagesys
] = "rusagesys";
373 syscall_table
[SYS_schedctl
] = "schedctl";
375 syscall_table
[SYS_secsys
] = "secsys";
377 syscall_table
[SYS_semsys
] = "semsys";
378 syscall_table
[SYS_send
] = "send";
379 syscall_table
[SYS_sendfilev
] = "sendfilev";
381 syscall_table
[SYS_sendmmsg
] = "sendmmsg";
383 syscall_table
[SYS_sendmsg
] = "sendmsg";
384 syscall_table
[SYS_sendto
] = "sendto";
385 syscall_table
[SYS_setegid
] = "setegid";
386 syscall_table
[SYS_seteuid
] = "seteuid";
387 syscall_table
[SYS_setgid
] = "setgid";
388 syscall_table
[SYS_setgroups
] = "setgroups";
389 syscall_table
[SYS_setitimer
] = "setitimer";
390 syscall_table
[SYS_setregid
] = "setregid";
391 syscall_table
[SYS_setreuid
] = "setreuid";
392 syscall_table
[SYS_setrlimit
] = "setrlimit";
393 syscall_table
[SYS_setrlimit64
] = "setrlimit64";
394 syscall_table
[SYS_setsockopt
] = "setsockopt";
395 syscall_table
[SYS_setuid
] = "setuid";
396 syscall_table
[SYS_sharefs
] = "sharefs";
397 syscall_table
[SYS_shmsys
] = "shmsys";
398 syscall_table
[SYS_shutdown
] = "shutdown";
400 syscall_table
[SYS_sidsys
] = "sidsys";
402 syscall_table
[SYS_sigaction
] = "sigaction";
403 syscall_table
[SYS_sigaltstack
] = "sigaltstack";
405 syscall_table
[SYS_signal
] = "signal";
407 syscall_table
[SYS_signotify
] = "signotify";
408 syscall_table
[SYS_sigpending
] = "sigpending";
409 syscall_table
[SYS_sigprocmask
] = "sigprocmask";
410 syscall_table
[SYS_sigqueue
] = "sigqueue";
412 syscall_table
[SYS_sigresend
] = "sigresend";
414 syscall_table
[SYS_sigsendsys
] = "sigsendsys";
415 syscall_table
[SYS_sigsuspend
] = "sigsuspend";
416 syscall_table
[SYS_sigtimedwait
] = "sigtimedwait";
417 syscall_table
[SYS_so_socket
] = "so_socket";
418 syscall_table
[SYS_so_socketpair
] = "so_socketpair";
419 syscall_table
[SYS_sockconfig
] = "sockconfig";
420 #ifdef SYS_sparc_fixalign
421 syscall_table
[SYS_sparc_fixalign
] = "sparc_fixalign";
423 syscall_table
[SYS_sparc_utrap_install
] = "sparc_utrap_install";
425 syscall_table
[SYS_spawn
] = "spawn";
428 syscall_table
[SYS_stat
] = "stat";
431 syscall_table
[SYS_stat64
] = "stat64";
433 syscall_table
[SYS_statfs
] = "statfs";
434 syscall_table
[SYS_statvfs
] = "statvfs";
435 syscall_table
[SYS_statvfs64
] = "statvfs64";
436 syscall_table
[SYS_stime
] = "stime";
437 syscall_table
[SYS_stty
] = "stty";
439 syscall_table
[SYS_symlink
] = "symlink";
442 syscall_table
[SYS_symlinkat
] = "symlinkat";
444 syscall_table
[SYS_sync
] = "sync";
445 syscall_table
[SYS_syscall
] = "syscall";
446 syscall_table
[SYS_sysconfig
] = "sysconfig";
447 syscall_table
[SYS_sysfs
] = "sysfs";
448 syscall_table
[SYS_sysi86
] = "sysi86";
450 syscall_table
[SYS_syssun
] = "syssun";
452 #ifdef SYS_system_stats
453 syscall_table
[SYS_system_stats
] = "system_stats";
455 syscall_table
[SYS_systeminfo
] = "systeminfo";
456 syscall_table
[SYS_tasksys
] = "tasksys";
457 syscall_table
[SYS_time
] = "time";
458 syscall_table
[SYS_timer_create
] = "timer_create";
459 syscall_table
[SYS_timer_delete
] = "timer_delete";
460 syscall_table
[SYS_timer_getoverrun
] = "timer_getoverrun";
461 syscall_table
[SYS_timer_gettime
] = "timer_gettime";
462 syscall_table
[SYS_timer_settime
] = "timer_settime";
463 syscall_table
[SYS_times
] = "times";
464 syscall_table
[SYS_uadmin
] = "uadmin";
465 syscall_table
[SYS_ucredsys
] = "ucredsys";
466 syscall_table
[SYS_ulimit
] = "ulimit";
467 syscall_table
[SYS_umask
] = "umask";
469 syscall_table
[SYS_umount
] = "umount";
471 syscall_table
[SYS_umount2
] = "umount2";
472 syscall_table
[SYS_uname
] = "uname";
474 syscall_table
[SYS_unlink
] = "unlink";
477 syscall_table
[SYS_unlinkat
] = "unlinkat";
480 syscall_table
[SYS_utime
] = "utime";
483 syscall_table
[SYS_utimensat
] = "utimensat";
486 syscall_table
[SYS_utimes
] = "utimes";
489 syscall_table
[SYS_utimesys
] = "utimesys";
491 syscall_table
[SYS_utssys
] = "utssys";
492 syscall_table
[SYS_uucopy
] = "uucopy";
493 syscall_table
[SYS_uucopystr
] = "uucopystr";
495 syscall_table
[SYS_uuidsys
] = "uuidsys";
498 syscall_table
[SYS_va_mask
] = "va_mask";
500 syscall_table
[SYS_vfork
] = "vfork";
501 syscall_table
[SYS_vhangup
] = "vhangup";
503 syscall_table
[SYS_wait
] = "wait";
506 syscall_table
[SYS_waitid
] = "waitid";
509 syscall_table
[SYS_waitsys
] = "waitsys";
511 syscall_table
[SYS_write
] = "write";
512 syscall_table
[SYS_writev
] = "writev";
514 syscall_table
[SYS_xmknod
] = "xmknod";
517 syscall_table
[SYS_xstat
] = "xstat";
519 syscall_table
[SYS_yield
] = "yield";
520 syscall_table
[SYS_zone
] = "zone";
523 /* Prettyprint syscall NUM. */
526 proc_prettyfprint_syscall (FILE *file
, int num
, int verbose
)
528 if (syscall_table
[num
])
529 fprintf (file
, "SYS_%s ", syscall_table
[num
]);
531 fprintf (file
, "<Unknown syscall %d> ", num
);
535 proc_prettyprint_syscall (int num
, int verbose
)
537 proc_prettyfprint_syscall (stdout
, num
, verbose
);
540 /* Prettyprint all syscalls in SYSSET. */
543 proc_prettyfprint_syscalls (FILE *file
, sysset_t
*sysset
, int verbose
)
547 for (i
= 0; i
< MAX_SYSCALLS
; i
++)
548 if (prismember (sysset
, i
))
550 proc_prettyfprint_syscall (file
, i
, verbose
);
552 fprintf (file
, "\n");
556 proc_prettyprint_syscalls (sysset_t
*sysset
, int verbose
)
558 proc_prettyfprint_syscalls (stdout
, sysset
, verbose
);
561 /* Prettyprint signals. */
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. */
567 static struct trans signal_table
[] =
569 { 0, "<no signal>", "no signal" },
571 /* SIGINT, SIGILL, SIGABRT, SIGFPE, SIGSEGV and SIGTERM
572 are ANSI-standard signals and are always available. */
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" },
581 /* All other signals need preprocessor conditionals. */
583 { SIGHUP
, "SIGHUP", "Hangup" },
584 { SIGQUIT
, "SIGQUIT", "Quit (ASCII FS)" },
585 { SIGTRAP
, "SIGTRAP", "Trace trap" }, /* not reset when caught */
586 { SIGIOT
, "SIGIOT", "IOT instruction" },
587 { SIGEMT
, "SIGEMT", "EMT instruction" },
588 { SIGKILL
, "SIGKILL", "Kill" }, /* Solaris: cannot be caught/ignored */
589 { SIGBUS
, "SIGBUS", "Bus error" },
590 { SIGSYS
, "SIGSYS", "Bad argument to system call" },
591 { SIGPIPE
, "SIGPIPE", "Write to pipe with no one to read it" },
592 { SIGALRM
, "SIGALRM", "Alarm clock" },
593 { SIGUSR1
, "SIGUSR1", "User defined signal 1" },
594 { SIGUSR2
, "SIGUSR2", "User defined signal 2" },
595 { SIGCHLD
, "SIGCHLD", "Child status changed" }, /* Posix version */
596 { SIGCLD
, "SIGCLD", "Child status changed" }, /* Solaris version */
597 { SIGPWR
, "SIGPWR", "Power-fail restart" },
598 { SIGWINCH
, "SIGWINCH", "Window size change" },
599 { SIGURG
, "SIGURG", "Urgent socket condition" },
600 { SIGPOLL
, "SIGPOLL", "Pollable event" },
601 { SIGIO
, "SIGIO", "Socket I/O possible" }, /* alias for SIGPOLL */
602 { SIGSTOP
, "SIGSTOP", "Stop, not from tty" }, /* cannot be caught or
604 { SIGTSTP
, "SIGTSTP", "User stop from tty" },
605 { SIGCONT
, "SIGCONT", "Stopped process has been continued" },
606 { SIGTTIN
, "SIGTTIN", "Background tty read attempted" },
607 { SIGTTOU
, "SIGTTOU", "Background tty write attempted" },
608 { SIGVTALRM
, "SIGVTALRM", "Virtual timer expired" },
609 { SIGPROF
, "SIGPROF", "Profiling timer expired" },
610 { SIGXCPU
, "SIGXCPU", "Exceeded CPU limit" },
611 { SIGXFSZ
, "SIGXFSZ", "Exceeded file size limit" },
612 { SIGWAITING
, "SIGWAITING", "Process's LWPs are blocked" },
613 { SIGLWP
, "SIGLWP", "Used by thread library" },
614 { SIGFREEZE
, "SIGFREEZE", "Used by CPR" },
615 { SIGTHAW
, "SIGTHAW", "Used by CPR" },
616 { SIGCANCEL
, "SIGCANCEL", "Used by libthread" },
617 { SIGLOST
, "SIGLOST", "Resource lost" },
619 /* FIXME: add real-time signals. */
622 /* Prettyprint signal number SIGNO. */
625 proc_prettyfprint_signal (FILE *file
, int signo
, int verbose
)
629 for (i
= 0; i
< sizeof (signal_table
) / sizeof (signal_table
[0]); i
++)
630 if (signo
== signal_table
[i
].value
)
632 fprintf (file
, "%s", signal_table
[i
].name
);
634 fprintf (file
, ": %s\n", signal_table
[i
].desc
);
639 fprintf (file
, "Unknown signal %d%c", signo
, verbose
? '\n' : ' ');
643 proc_prettyprint_signal (int signo
, int verbose
)
645 proc_prettyfprint_signal (stdout
, signo
, verbose
);
648 /* Prettyprint all signals in SIGSET. */
651 proc_prettyfprint_signalset (FILE *file
, sigset_t
*sigset
, int verbose
)
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. */
659 for (i
= 0; i
< NSIG
; i
++)
660 if (prismember (sigset
, i
))
661 proc_prettyfprint_signal (file
, i
, verbose
);
664 fprintf (file
, "\n");
668 proc_prettyprint_signalset (sigset_t
*sigset
, int verbose
)
670 proc_prettyfprint_signalset (stdout
, sigset
, verbose
);
674 /* Prettyprint faults. */
676 /* Fault translation table. */
678 static struct trans fault_table
[] =
680 { FLTILL
, "FLTILL", "Illegal instruction" },
681 { FLTPRIV
, "FLTPRIV", "Privileged instruction" },
682 { FLTBPT
, "FLTBPT", "Breakpoint trap" },
683 { FLTTRACE
, "FLTTRACE", "Trace trap" },
684 { FLTACCESS
, "FLTACCESS", "Memory access fault" },
685 { FLTBOUNDS
, "FLTBOUNDS", "Memory bounds violation" },
686 { FLTIOVF
, "FLTIOVF", "Integer overflow" },
687 { FLTIZDIV
, "FLTIZDIV", "Integer zero divide" },
688 { FLTFPE
, "FLTFPE", "Floating-point exception" },
689 { FLTSTACK
, "FLTSTACK", "Unrecoverable stack fault" },
690 { FLTPAGE
, "FLTPAGE", "Recoverable page fault" },
691 { FLTWATCH
, "FLTWATCH", "User watchpoint" },
694 /* Work horse. Accepts an index into the fault table, prints it
698 prettyfprint_faulttable_entry (FILE *file
, int i
, int verbose
)
700 fprintf (file
, "%s", fault_table
[i
].name
);
702 fprintf (file
, ": %s\n", fault_table
[i
].desc
);
707 /* Prettyprint hardware fault number FAULTNO. */
710 proc_prettyfprint_fault (FILE *file
, int faultno
, int verbose
)
714 for (i
= 0; i
< ARRAY_SIZE (fault_table
); i
++)
715 if (faultno
== fault_table
[i
].value
)
717 prettyfprint_faulttable_entry (file
, i
, verbose
);
721 fprintf (file
, "Unknown hardware fault %d%c",
722 faultno
, verbose
? '\n' : ' ');
726 proc_prettyprint_fault (int faultno
, int verbose
)
728 proc_prettyfprint_fault (stdout
, faultno
, verbose
);
731 /* Prettyprint all faults in FLTSET. */
734 proc_prettyfprint_faultset (FILE *file
, fltset_t
*fltset
, int verbose
)
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. */
742 for (i
= 0; i
< ARRAY_SIZE (fault_table
); i
++)
743 if (prismember (fltset
, fault_table
[i
].value
))
744 prettyfprint_faulttable_entry (file
, i
, verbose
);
747 fprintf (file
, "\n");
751 proc_prettyprint_faultset (fltset_t
*fltset
, int verbose
)
753 proc_prettyfprint_faultset (stdout
, fltset
, verbose
);
756 /* TODO: actions, holds... */
759 proc_prettyprint_actionset (struct sigaction
*actions
, int verbose
)
763 void _initialize_proc_events ();
765 _initialize_proc_events ()
767 init_syscall_table ();