1 /* Machine-independent support for Solaris /proc (process file system)
3 Copyright (C) 1999-2024 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. */
32 #include <sys/types.h>
33 #include <sys/procfs.h>
34 #include <sys/syscall.h>
35 #include <sys/fault.h>
37 #include "proc-utils.h"
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
47 int value
; /* The numeric value. */
48 const char *name
; /* The equivalent symbolic value. */
49 const char *desc
; /* Short description of value. */
53 /* Pretty print syscalls. */
55 /* Syscall translation table. */
57 #define MAX_SYSCALLS 262 /* Pretty arbitrary. */
58 static const char *syscall_table
[MAX_SYSCALLS
];
61 init_syscall_table (void)
63 syscall_table
[SYS_accept
] = "accept";
65 syscall_table
[SYS_access
] = "access";
67 syscall_table
[SYS_acct
] = "acct";
68 syscall_table
[SYS_acctctl
] = "acctctl";
69 syscall_table
[SYS_acl
] = "acl";
71 syscall_table
[SYS_adi
] = "adi";
73 syscall_table
[SYS_adjtime
] = "adjtime";
74 syscall_table
[SYS_alarm
] = "alarm";
75 syscall_table
[SYS_auditsys
] = "auditsys";
76 syscall_table
[SYS_autofssys
] = "autofssys";
77 syscall_table
[SYS_bind
] = "bind";
78 syscall_table
[SYS_brand
] = "brand";
79 syscall_table
[SYS_brk
] = "brk";
80 syscall_table
[SYS_chdir
] = "chdir";
82 syscall_table
[SYS_chmod
] = "chmod";
85 syscall_table
[SYS_chown
] = "chown";
87 syscall_table
[SYS_chroot
] = "chroot";
88 syscall_table
[SYS_cladm
] = "cladm";
89 syscall_table
[SYS_clock_getres
] = "clock_getres";
90 syscall_table
[SYS_clock_gettime
] = "clock_gettime";
91 syscall_table
[SYS_clock_settime
] = "clock_settime";
92 syscall_table
[SYS_close
] = "close";
93 syscall_table
[SYS_connect
] = "connect";
94 syscall_table
[SYS_context
] = "context";
95 syscall_table
[SYS_corectl
] = "corectl";
96 syscall_table
[SYS_cpc
] = "cpc";
98 syscall_table
[SYS_creat
] = "creat";
101 syscall_table
[SYS_creat64
] = "creat64";
103 syscall_table
[SYS_door
] = "door";
105 syscall_table
[SYS_dup
] = "dup";
108 syscall_table
[SYS_evsys
] = "evsys";
111 syscall_table
[SYS_evtrapret
] = "evtrapret";
113 syscall_table
[SYS_exacctsys
] = "exacctsys";
115 syscall_table
[SYS_exec
] = "exec";
117 syscall_table
[SYS_execve
] = "execve";
118 syscall_table
[SYS_exit
] = "exit";
120 syscall_table
[SYS_faccessat
] = "faccessat";
122 syscall_table
[SYS_facl
] = "facl";
123 syscall_table
[SYS_fchdir
] = "fchdir";
125 syscall_table
[SYS_fchmod
] = "fchmod";
128 syscall_table
[SYS_fchmodat
] = "fchmodat";
131 syscall_table
[SYS_fchown
] = "fchown";
134 syscall_table
[SYS_fchownat
] = "fchownat";
136 syscall_table
[SYS_fchroot
] = "fchroot";
137 syscall_table
[SYS_fcntl
] = "fcntl";
138 syscall_table
[SYS_fdsync
] = "fdsync";
140 syscall_table
[SYS_fork1
] = "fork1";
143 syscall_table
[SYS_forkall
] = "forkall";
146 syscall_table
[SYS_forksys
] = "forksys";
148 syscall_table
[SYS_fpathconf
] = "fpathconf";
149 #ifdef SYS_frealpathat
150 syscall_table
[SYS_frealpathat
] = "frealpathat";
153 syscall_table
[SYS_fsat
] = "fsat";
156 syscall_table
[SYS_fstat
] = "fstat";
159 syscall_table
[SYS_fstat64
] = "fstat64";
162 syscall_table
[SYS_fstatat
] = "fstatat";
165 syscall_table
[SYS_fstatat64
] = "fstatat64";
167 syscall_table
[SYS_fstatfs
] = "fstatfs";
168 syscall_table
[SYS_fstatvfs
] = "fstatvfs";
169 syscall_table
[SYS_fstatvfs64
] = "fstatvfs64";
171 syscall_table
[SYS_fxstat
] = "fxstat";
173 syscall_table
[SYS_getcwd
] = "getcwd";
174 syscall_table
[SYS_getdents
] = "getdents";
175 syscall_table
[SYS_getdents64
] = "getdents64";
176 syscall_table
[SYS_getgid
] = "getgid";
177 syscall_table
[SYS_getgroups
] = "getgroups";
178 syscall_table
[SYS_getitimer
] = "getitimer";
179 syscall_table
[SYS_getloadavg
] = "getloadavg";
180 syscall_table
[SYS_getmsg
] = "getmsg";
181 syscall_table
[SYS_getpagesizes
] = "getpagesizes";
182 syscall_table
[SYS_getpeername
] = "getpeername";
183 syscall_table
[SYS_getpid
] = "getpid";
184 syscall_table
[SYS_getpmsg
] = "getpmsg";
186 syscall_table
[SYS_getrandom
] = "getrandom";
188 syscall_table
[SYS_getrlimit
] = "getrlimit";
189 syscall_table
[SYS_getrlimit64
] = "getrlimit64";
190 syscall_table
[SYS_getsockname
] = "getsockname";
191 syscall_table
[SYS_getsockopt
] = "getsockopt";
192 syscall_table
[SYS_gettimeofday
] = "gettimeofday";
193 syscall_table
[SYS_getuid
] = "getuid";
194 syscall_table
[SYS_gtty
] = "gtty";
195 syscall_table
[SYS_hrtsys
] = "hrtsys";
196 syscall_table
[SYS_inst_sync
] = "inst_sync";
197 syscall_table
[SYS_install_utrap
] = "install_utrap";
198 syscall_table
[SYS_ioctl
] = "ioctl";
200 syscall_table
[SYS_issetugid
] = "issetugid";
202 syscall_table
[SYS_kaio
] = "kaio";
203 syscall_table
[SYS_kill
] = "kill";
204 syscall_table
[SYS_labelsys
] = "labelsys";
206 syscall_table
[SYS_lchown
] = "lchown";
208 syscall_table
[SYS_lgrpsys
] = "lgrpsys";
210 syscall_table
[SYS_link
] = "link";
213 syscall_table
[SYS_linkat
] = "linkat";
215 syscall_table
[SYS_listen
] = "listen";
216 syscall_table
[SYS_llseek
] = "llseek";
217 syscall_table
[SYS_lseek
] = "lseek";
219 syscall_table
[SYS_lstat
] = "lstat";
222 syscall_table
[SYS_lstat64
] = "lstat64";
224 syscall_table
[SYS_lwp_cond_broadcast
] = "lwp_cond_broadcast";
225 syscall_table
[SYS_lwp_cond_signal
] = "lwp_cond_signal";
226 syscall_table
[SYS_lwp_cond_wait
] = "lwp_cond_wait";
227 syscall_table
[SYS_lwp_continue
] = "lwp_continue";
228 syscall_table
[SYS_lwp_create
] = "lwp_create";
229 syscall_table
[SYS_lwp_detach
] = "lwp_detach";
230 syscall_table
[SYS_lwp_exit
] = "lwp_exit";
231 syscall_table
[SYS_lwp_info
] = "lwp_info";
233 syscall_table
[SYS_lwp_kill
] = "lwp_kill";
235 #ifdef SYS_lwp_mutex_lock
236 syscall_table
[SYS_lwp_mutex_lock
] = "lwp_mutex_lock";
238 syscall_table
[SYS_lwp_mutex_register
] = "lwp_mutex_register";
239 syscall_table
[SYS_lwp_mutex_timedlock
] = "lwp_mutex_timedlock";
240 syscall_table
[SYS_lwp_mutex_trylock
] = "lwp_mutex_trylock";
241 syscall_table
[SYS_lwp_mutex_unlock
] = "lwp_mutex_unlock";
242 syscall_table
[SYS_lwp_mutex_wakeup
] = "lwp_mutex_wakeup";
244 syscall_table
[SYS_lwp_name
] = "lwp_name";
246 syscall_table
[SYS_lwp_park
] = "lwp_park";
247 syscall_table
[SYS_lwp_private
] = "lwp_private";
248 syscall_table
[SYS_lwp_rwlock_sys
] = "lwp_rwlock_sys";
249 syscall_table
[SYS_lwp_self
] = "lwp_self";
250 syscall_table
[SYS_lwp_sema_post
] = "lwp_sema_post";
251 syscall_table
[SYS_lwp_sema_timedwait
] = "lwp_sema_timedwait";
252 syscall_table
[SYS_lwp_sema_trywait
] = "lwp_sema_trywait";
253 #ifdef SYS_lwp_sema_wait
254 syscall_table
[SYS_lwp_sema_wait
] = "lwp_sema_wait";
256 syscall_table
[SYS_lwp_sigmask
] = "lwp_sigmask";
257 #ifdef SYS_lwp_sigqueue
258 syscall_table
[SYS_lwp_sigqueue
] = "lwp_sigqueue";
260 syscall_table
[SYS_lwp_suspend
] = "lwp_suspend";
261 syscall_table
[SYS_lwp_wait
] = "lwp_wait";
263 syscall_table
[SYS_lxstat
] = "lxstat";
265 syscall_table
[SYS_memcntl
] = "memcntl";
267 syscall_table
[SYS_memsys
] = "memsys";
269 syscall_table
[SYS_mincore
] = "mincore";
271 syscall_table
[SYS_mkdir
] = "mkdir";
274 syscall_table
[SYS_mkdirat
] = "mkdirat";
277 syscall_table
[SYS_mknod
] = "mknod";
280 syscall_table
[SYS_mknodat
] = "mknodat";
282 syscall_table
[SYS_mmap
] = "mmap";
283 syscall_table
[SYS_mmap64
] = "mmap64";
285 syscall_table
[SYS_mmapobj
] = "mmapobj";
287 syscall_table
[SYS_modctl
] = "modctl";
288 syscall_table
[SYS_mount
] = "mount";
289 syscall_table
[SYS_mprotect
] = "mprotect";
290 syscall_table
[SYS_msgsys
] = "msgsys";
291 syscall_table
[SYS_munmap
] = "munmap";
292 syscall_table
[SYS_nanosleep
] = "nanosleep";
293 syscall_table
[SYS_nfssys
] = "nfssys";
294 syscall_table
[SYS_nice
] = "nice";
295 syscall_table
[SYS_ntp_adjtime
] = "ntp_adjtime";
296 syscall_table
[SYS_ntp_gettime
] = "ntp_gettime";
298 syscall_table
[SYS_open
] = "open";
301 syscall_table
[SYS_open64
] = "open64";
304 syscall_table
[SYS_openat
] = "openat";
307 syscall_table
[SYS_openat64
] = "openat64";
309 syscall_table
[SYS_p_online
] = "p_online";
310 syscall_table
[SYS_pathconf
] = "pathconf";
311 syscall_table
[SYS_pause
] = "pause";
312 syscall_table
[SYS_pcsample
] = "pcsample";
313 syscall_table
[SYS_pgrpsys
] = "pgrpsys";
314 syscall_table
[SYS_pipe
] = "pipe";
316 syscall_table
[SYS_plock
] = "plock";
319 syscall_table
[SYS_poll
] = "poll";
321 syscall_table
[SYS_pollsys
] = "pollsys";
322 syscall_table
[SYS_port
] = "port";
323 syscall_table
[SYS_pread
] = "pread";
324 syscall_table
[SYS_pread64
] = "pread64";
325 syscall_table
[SYS_priocntlsys
] = "priocntlsys";
326 syscall_table
[SYS_privsys
] = "privsys";
327 #ifdef SYS_processor_bind
328 syscall_table
[SYS_processor_bind
] = "processor_bind";
330 #ifdef SYS_processor_info
331 syscall_table
[SYS_processor_info
] = "processor_info";
333 #ifdef SYS_processor_sys
334 syscall_table
[SYS_processor_sys
] = "processor_sys";
336 syscall_table
[SYS_profil
] = "profil";
337 syscall_table
[SYS_pset
] = "pset";
338 syscall_table
[SYS_putmsg
] = "putmsg";
339 syscall_table
[SYS_putpmsg
] = "putpmsg";
340 syscall_table
[SYS_pwrite
] = "pwrite";
341 syscall_table
[SYS_pwrite64
] = "pwrite64";
342 syscall_table
[SYS_rctlsys
] = "rctlsys";
343 syscall_table
[SYS_read
] = "read";
345 syscall_table
[SYS_readlink
] = "readlink";
347 #ifdef SYS_readlinkat
348 syscall_table
[SYS_readlinkat
] = "readlinkat";
350 syscall_table
[SYS_readv
] = "readv";
351 syscall_table
[SYS_recv
] = "recv";
352 syscall_table
[SYS_recvfrom
] = "recvfrom";
354 syscall_table
[SYS_recvmmsg
] = "recvmmsg";
356 syscall_table
[SYS_recvmsg
] = "recvmsg";
358 syscall_table
[SYS_reflinkat
] = "reflinkat";
361 syscall_table
[SYS_rename
] = "rename";
364 syscall_table
[SYS_renameat
] = "renameat";
366 syscall_table
[SYS_resolvepath
] = "resolvepath";
368 syscall_table
[SYS_rmdir
] = "rmdir";
370 syscall_table
[SYS_rpcsys
] = "rpcsys";
371 syscall_table
[SYS_rusagesys
] = "rusagesys";
372 syscall_table
[SYS_schedctl
] = "schedctl";
374 syscall_table
[SYS_secsys
] = "secsys";
376 syscall_table
[SYS_semsys
] = "semsys";
377 syscall_table
[SYS_send
] = "send";
378 syscall_table
[SYS_sendfilev
] = "sendfilev";
380 syscall_table
[SYS_sendmmsg
] = "sendmmsg";
382 syscall_table
[SYS_sendmsg
] = "sendmsg";
383 syscall_table
[SYS_sendto
] = "sendto";
384 syscall_table
[SYS_setegid
] = "setegid";
385 syscall_table
[SYS_seteuid
] = "seteuid";
386 syscall_table
[SYS_setgid
] = "setgid";
387 syscall_table
[SYS_setgroups
] = "setgroups";
388 syscall_table
[SYS_setitimer
] = "setitimer";
389 syscall_table
[SYS_setregid
] = "setregid";
390 syscall_table
[SYS_setreuid
] = "setreuid";
391 syscall_table
[SYS_setrlimit
] = "setrlimit";
392 syscall_table
[SYS_setrlimit64
] = "setrlimit64";
393 syscall_table
[SYS_setsockopt
] = "setsockopt";
394 syscall_table
[SYS_setuid
] = "setuid";
395 syscall_table
[SYS_sharefs
] = "sharefs";
396 syscall_table
[SYS_shmsys
] = "shmsys";
397 syscall_table
[SYS_shutdown
] = "shutdown";
399 syscall_table
[SYS_sidsys
] = "sidsys";
401 syscall_table
[SYS_sigaction
] = "sigaction";
402 syscall_table
[SYS_sigaltstack
] = "sigaltstack";
404 syscall_table
[SYS_signal
] = "signal";
406 syscall_table
[SYS_signotify
] = "signotify";
407 syscall_table
[SYS_sigpending
] = "sigpending";
408 syscall_table
[SYS_sigprocmask
] = "sigprocmask";
409 syscall_table
[SYS_sigqueue
] = "sigqueue";
411 syscall_table
[SYS_sigresend
] = "sigresend";
413 syscall_table
[SYS_sigsendsys
] = "sigsendsys";
414 syscall_table
[SYS_sigsuspend
] = "sigsuspend";
415 syscall_table
[SYS_sigtimedwait
] = "sigtimedwait";
416 syscall_table
[SYS_so_socket
] = "so_socket";
417 syscall_table
[SYS_so_socketpair
] = "so_socketpair";
418 syscall_table
[SYS_sockconfig
] = "sockconfig";
419 #ifdef SYS_sparc_fixalign
420 syscall_table
[SYS_sparc_fixalign
] = "sparc_fixalign";
422 syscall_table
[SYS_sparc_utrap_install
] = "sparc_utrap_install";
424 syscall_table
[SYS_spawn
] = "spawn";
427 syscall_table
[SYS_stat
] = "stat";
430 syscall_table
[SYS_stat64
] = "stat64";
432 syscall_table
[SYS_statfs
] = "statfs";
433 syscall_table
[SYS_statvfs
] = "statvfs";
434 syscall_table
[SYS_statvfs64
] = "statvfs64";
435 syscall_table
[SYS_stime
] = "stime";
436 syscall_table
[SYS_stty
] = "stty";
438 syscall_table
[SYS_symlink
] = "symlink";
441 syscall_table
[SYS_symlinkat
] = "symlinkat";
443 syscall_table
[SYS_sync
] = "sync";
444 syscall_table
[SYS_syscall
] = "syscall";
445 syscall_table
[SYS_sysconfig
] = "sysconfig";
446 syscall_table
[SYS_sysfs
] = "sysfs";
447 syscall_table
[SYS_sysi86
] = "sysi86";
449 syscall_table
[SYS_syssun
] = "syssun";
451 #ifdef SYS_system_stats
452 syscall_table
[SYS_system_stats
] = "system_stats";
454 syscall_table
[SYS_systeminfo
] = "systeminfo";
455 syscall_table
[SYS_tasksys
] = "tasksys";
456 syscall_table
[SYS_time
] = "time";
457 syscall_table
[SYS_timer_create
] = "timer_create";
458 syscall_table
[SYS_timer_delete
] = "timer_delete";
459 syscall_table
[SYS_timer_getoverrun
] = "timer_getoverrun";
460 syscall_table
[SYS_timer_gettime
] = "timer_gettime";
461 syscall_table
[SYS_timer_settime
] = "timer_settime";
462 syscall_table
[SYS_times
] = "times";
463 syscall_table
[SYS_uadmin
] = "uadmin";
464 syscall_table
[SYS_ucredsys
] = "ucredsys";
465 syscall_table
[SYS_ulimit
] = "ulimit";
466 syscall_table
[SYS_umask
] = "umask";
468 syscall_table
[SYS_umount
] = "umount";
470 syscall_table
[SYS_umount2
] = "umount2";
471 syscall_table
[SYS_uname
] = "uname";
473 syscall_table
[SYS_unlink
] = "unlink";
476 syscall_table
[SYS_unlinkat
] = "unlinkat";
479 syscall_table
[SYS_utime
] = "utime";
482 syscall_table
[SYS_utimensat
] = "utimensat";
485 syscall_table
[SYS_utimes
] = "utimes";
488 syscall_table
[SYS_utimesys
] = "utimesys";
490 syscall_table
[SYS_utssys
] = "utssys";
491 syscall_table
[SYS_uucopy
] = "uucopy";
492 syscall_table
[SYS_uucopystr
] = "uucopystr";
494 syscall_table
[SYS_uuidsys
] = "uuidsys";
497 syscall_table
[SYS_va_mask
] = "va_mask";
499 syscall_table
[SYS_vfork
] = "vfork";
500 syscall_table
[SYS_vhangup
] = "vhangup";
502 syscall_table
[SYS_wait
] = "wait";
505 syscall_table
[SYS_waitid
] = "waitid";
508 syscall_table
[SYS_waitsys
] = "waitsys";
510 syscall_table
[SYS_write
] = "write";
511 syscall_table
[SYS_writev
] = "writev";
513 syscall_table
[SYS_xmknod
] = "xmknod";
516 syscall_table
[SYS_xstat
] = "xstat";
518 syscall_table
[SYS_yield
] = "yield";
519 syscall_table
[SYS_zone
] = "zone";
522 /* Prettyprint syscall NUM. */
525 proc_prettyfprint_syscall (FILE *file
, int num
, int verbose
)
527 if (syscall_table
[num
])
528 fprintf (file
, "SYS_%s ", syscall_table
[num
]);
530 fprintf (file
, "<Unknown syscall %d> ", num
);
534 proc_prettyprint_syscall (int num
, int verbose
)
536 proc_prettyfprint_syscall (stdout
, num
, verbose
);
539 /* Prettyprint all syscalls in SYSSET. */
542 proc_prettyfprint_syscalls (FILE *file
, sysset_t
*sysset
, int verbose
)
546 for (i
= 0; i
< MAX_SYSCALLS
; i
++)
547 if (prismember (sysset
, i
))
549 proc_prettyfprint_syscall (file
, i
, verbose
);
551 fprintf (file
, "\n");
555 proc_prettyprint_syscalls (sysset_t
*sysset
, int verbose
)
557 proc_prettyfprint_syscalls (stdout
, sysset
, verbose
);
560 /* Prettyprint signals. */
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. */
566 static struct trans signal_table
[] =
568 { 0, "<no signal>", "no signal" },
570 /* SIGINT, SIGILL, SIGABRT, SIGFPE, SIGSEGV and SIGTERM
571 are ANSI-standard signals and are always available. */
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" },
580 /* All other signals need preprocessor conditionals. */
582 { SIGHUP
, "SIGHUP", "Hangup" },
583 { SIGQUIT
, "SIGQUIT", "Quit (ASCII FS)" },
584 { SIGTRAP
, "SIGTRAP", "Trace trap" }, /* not reset when caught */
585 { SIGIOT
, "SIGIOT", "IOT instruction" },
586 { SIGEMT
, "SIGEMT", "EMT instruction" },
587 { SIGKILL
, "SIGKILL", "Kill" }, /* Solaris: cannot be caught/ignored */
588 { SIGBUS
, "SIGBUS", "Bus error" },
589 { SIGSYS
, "SIGSYS", "Bad argument to system call" },
590 { SIGPIPE
, "SIGPIPE", "Write to pipe with no one to read it" },
591 { SIGALRM
, "SIGALRM", "Alarm clock" },
592 { SIGUSR1
, "SIGUSR1", "User defined signal 1" },
593 { SIGUSR2
, "SIGUSR2", "User defined signal 2" },
594 { SIGCHLD
, "SIGCHLD", "Child status changed" }, /* Posix version */
595 { SIGCLD
, "SIGCLD", "Child status changed" }, /* Solaris version */
596 { SIGPWR
, "SIGPWR", "Power-fail restart" },
597 { SIGWINCH
, "SIGWINCH", "Window size change" },
598 { SIGURG
, "SIGURG", "Urgent socket condition" },
599 { SIGPOLL
, "SIGPOLL", "Pollable event" },
600 { SIGIO
, "SIGIO", "Socket I/O possible" }, /* alias for SIGPOLL */
601 { SIGSTOP
, "SIGSTOP", "Stop, not from tty" }, /* cannot be caught or
603 { SIGTSTP
, "SIGTSTP", "User stop from tty" },
604 { SIGCONT
, "SIGCONT", "Stopped process has been continued" },
605 { SIGTTIN
, "SIGTTIN", "Background tty read attempted" },
606 { SIGTTOU
, "SIGTTOU", "Background tty write attempted" },
607 { SIGVTALRM
, "SIGVTALRM", "Virtual timer expired" },
608 { SIGPROF
, "SIGPROF", "Profiling timer expired" },
609 { SIGXCPU
, "SIGXCPU", "Exceeded CPU limit" },
610 { SIGXFSZ
, "SIGXFSZ", "Exceeded file size limit" },
611 { SIGWAITING
, "SIGWAITING", "Process's LWPs are blocked" },
612 { SIGLWP
, "SIGLWP", "Used by thread library" },
613 { SIGFREEZE
, "SIGFREEZE", "Used by CPR" },
614 { SIGTHAW
, "SIGTHAW", "Used by CPR" },
615 { SIGCANCEL
, "SIGCANCEL", "Used by libthread" },
616 { SIGLOST
, "SIGLOST", "Resource lost" },
618 /* FIXME: add real-time signals. */
621 /* Prettyprint signal number SIGNO. */
624 proc_prettyfprint_signal (FILE *file
, int signo
, int verbose
)
628 for (i
= 0; i
< sizeof (signal_table
) / sizeof (signal_table
[0]); i
++)
629 if (signo
== signal_table
[i
].value
)
631 fprintf (file
, "%s", signal_table
[i
].name
);
633 fprintf (file
, ": %s\n", signal_table
[i
].desc
);
638 fprintf (file
, "Unknown signal %d%c", signo
, verbose
? '\n' : ' ');
642 proc_prettyprint_signal (int signo
, int verbose
)
644 proc_prettyfprint_signal (stdout
, signo
, verbose
);
647 /* Prettyprint all signals in SIGSET. */
650 proc_prettyfprint_signalset (FILE *file
, sigset_t
*sigset
, int verbose
)
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. */
658 for (i
= 0; i
< NSIG
; i
++)
659 if (prismember (sigset
, i
))
660 proc_prettyfprint_signal (file
, i
, verbose
);
663 fprintf (file
, "\n");
667 proc_prettyprint_signalset (sigset_t
*sigset
, int verbose
)
669 proc_prettyfprint_signalset (stdout
, sigset
, verbose
);
673 /* Prettyprint faults. */
675 /* Fault translation table. */
677 static struct trans fault_table
[] =
679 { FLTILL
, "FLTILL", "Illegal instruction" },
680 { FLTPRIV
, "FLTPRIV", "Privileged instruction" },
681 { FLTBPT
, "FLTBPT", "Breakpoint trap" },
682 { FLTTRACE
, "FLTTRACE", "Trace trap" },
683 { FLTACCESS
, "FLTACCESS", "Memory access fault" },
684 { FLTBOUNDS
, "FLTBOUNDS", "Memory bounds violation" },
685 { FLTIOVF
, "FLTIOVF", "Integer overflow" },
686 { FLTIZDIV
, "FLTIZDIV", "Integer zero divide" },
687 { FLTFPE
, "FLTFPE", "Floating-point exception" },
688 { FLTSTACK
, "FLTSTACK", "Unrecoverable stack fault" },
689 { FLTPAGE
, "FLTPAGE", "Recoverable page fault" },
690 { FLTWATCH
, "FLTWATCH", "User watchpoint" },
693 /* Work horse. Accepts an index into the fault table, prints it
697 prettyfprint_faulttable_entry (FILE *file
, int i
, int verbose
)
699 fprintf (file
, "%s", fault_table
[i
].name
);
701 fprintf (file
, ": %s\n", fault_table
[i
].desc
);
706 /* Prettyprint hardware fault number FAULTNO. */
709 proc_prettyfprint_fault (FILE *file
, int faultno
, int verbose
)
713 for (i
= 0; i
< ARRAY_SIZE (fault_table
); i
++)
714 if (faultno
== fault_table
[i
].value
)
716 prettyfprint_faulttable_entry (file
, i
, verbose
);
720 fprintf (file
, "Unknown hardware fault %d%c",
721 faultno
, verbose
? '\n' : ' ');
725 proc_prettyprint_fault (int faultno
, int verbose
)
727 proc_prettyfprint_fault (stdout
, faultno
, verbose
);
730 /* Prettyprint all faults in FLTSET. */
733 proc_prettyfprint_faultset (FILE *file
, fltset_t
*fltset
, int verbose
)
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. */
741 for (i
= 0; i
< ARRAY_SIZE (fault_table
); i
++)
742 if (prismember (fltset
, fault_table
[i
].value
))
743 prettyfprint_faulttable_entry (file
, i
, verbose
);
746 fprintf (file
, "\n");
750 proc_prettyprint_faultset (fltset_t
*fltset
, int verbose
)
752 proc_prettyfprint_faultset (stdout
, fltset
, verbose
);
755 /* TODO: actions, holds... */
758 proc_prettyprint_actionset (struct sigaction
*actions
, int verbose
)
762 void _initialize_proc_events ();
764 _initialize_proc_events ()
766 init_syscall_table ();