1 /* Machine-independent support for SVR4 /proc (process file system)
3 Copyright (C) 1999-2014 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. */
34 #define _STRUCTURED_PROC 1
38 #include <sys/types.h>
39 #include <sys/procfs.h>
40 #ifdef HAVE_SYS_SYSCALL_H
41 #include <sys/syscall.h>
43 #ifdef HAVE_SYS_FAULT_H
44 #include <sys/fault.h>
47 #include "proc-utils.h"
49 /* Much of the information used in the /proc interface, particularly
50 for printing status information, is kept as tables of structures of
51 the following form. These tables can be used to map numeric values
52 to their symbolic names and to a string that describes their
57 int value; /* The numeric value. */
58 char *name; /* The equivalent symbolic value. */
59 char *desc; /* Short description of value. */
63 /* Pretty print syscalls. */
65 /* Syscall translation table. */
67 #define MAX_SYSCALLS 262 /* Pretty arbitrary. */
68 static char *syscall_table[MAX_SYSCALLS];
71 init_syscall_table (void)
74 syscall_table[SYS_BSD_getime] = "BSD_getime";
77 syscall_table[SYS_BSDgetpgrp] = "BSDgetpgrp";
80 syscall_table[SYS_BSDsetpgrp] = "BSDsetpgrp";
83 syscall_table[SYS_acancel] = "acancel";
86 syscall_table[SYS_accept] = "accept";
89 syscall_table[SYS_access] = "access";
92 syscall_table[SYS_acct] = "acct";
95 syscall_table[SYS_acl] = "acl";
98 syscall_table[SYS_aclipc] = "aclipc";
101 syscall_table[SYS_adjtime] = "adjtime";
103 #ifdef SYS_afs_syscall
104 syscall_table[SYS_afs_syscall] = "afs_syscall";
107 syscall_table[SYS_alarm] = "alarm";
110 syscall_table[SYS_alt_plock] = "alt_plock";
112 #ifdef SYS_alt_sigpending
113 syscall_table[SYS_alt_sigpending] = "alt_sigpending";
116 syscall_table[SYS_async] = "async";
118 #ifdef SYS_async_daemon
119 syscall_table[SYS_async_daemon] = "async_daemon";
122 syscall_table[SYS_audcntl] = "audcntl";
125 syscall_table[SYS_audgen] = "audgen";
128 syscall_table[SYS_auditbuf] = "auditbuf";
131 syscall_table[SYS_auditctl] = "auditctl";
134 syscall_table[SYS_auditdmp] = "auditdmp";
137 syscall_table[SYS_auditevt] = "auditevt";
140 syscall_table[SYS_auditlog] = "auditlog";
143 syscall_table[SYS_auditsys] = "auditsys";
146 syscall_table[SYS_bind] = "bind";
149 syscall_table[SYS_block] = "block";
152 syscall_table[SYS_brk] = "brk";
155 syscall_table[SYS_cachectl] = "cachectl";
157 #ifdef SYS_cacheflush
158 syscall_table[SYS_cacheflush] = "cacheflush";
160 #ifdef SYS_cancelblock
161 syscall_table[SYS_cancelblock] = "cancelblock";
164 syscall_table[SYS_cg_bind] = "cg_bind";
166 #ifdef SYS_cg_current
167 syscall_table[SYS_cg_current] = "cg_current";
170 syscall_table[SYS_cg_ids] = "cg_ids";
173 syscall_table[SYS_cg_info] = "cg_info";
176 syscall_table[SYS_cg_memloc] = "cg_memloc";
178 #ifdef SYS_cg_processors
179 syscall_table[SYS_cg_processors] = "cg_processors";
182 syscall_table[SYS_chdir] = "chdir";
185 syscall_table[SYS_chflags] = "chflags";
188 syscall_table[SYS_chmod] = "chmod";
191 syscall_table[SYS_chown] = "chown";
194 syscall_table[SYS_chroot] = "chroot";
197 syscall_table[SYS_clocal] = "clocal";
199 #ifdef SYS_clock_getres
200 syscall_table[SYS_clock_getres] = "clock_getres";
202 #ifdef SYS_clock_gettime
203 syscall_table[SYS_clock_gettime] = "clock_gettime";
205 #ifdef SYS_clock_settime
206 syscall_table[SYS_clock_settime] = "clock_settime";
209 syscall_table[SYS_close] = "close";
212 syscall_table[SYS_connect] = "connect";
215 syscall_table[SYS_context] = "context";
218 syscall_table[SYS_creat] = "creat";
221 syscall_table[SYS_creat64] = "creat64";
224 syscall_table[SYS_devstat] = "devstat";
227 syscall_table[SYS_dmi] = "dmi";
230 syscall_table[SYS_door] = "door";
233 syscall_table[SYS_dshmsys] = "dshmsys";
236 syscall_table[SYS_dup] = "dup";
239 syscall_table[SYS_dup2] = "dup2";
242 syscall_table[SYS_evsys] = "evsys";
245 syscall_table[SYS_evtrapret] = "evtrapret";
248 syscall_table[SYS_exec] = "exec";
250 #ifdef SYS_exec_with_loader
251 syscall_table[SYS_exec_with_loader] = "exec_with_loader";
254 syscall_table[SYS_execv] = "execv";
257 syscall_table[SYS_execve] = "execve";
260 syscall_table[SYS_exit] = "exit";
263 syscall_table[SYS_exportfs] = "exportfs";
266 syscall_table[SYS_facl] = "facl";
269 syscall_table[SYS_fchdir] = "fchdir";
272 syscall_table[SYS_fchflags] = "fchflags";
275 syscall_table[SYS_fchmod] = "fchmod";
278 syscall_table[SYS_fchown] = "fchown";
281 syscall_table[SYS_fchroot] = "fchroot";
284 syscall_table[SYS_fcntl] = "fcntl";
287 syscall_table[SYS_fdatasync] = "fdatasync";
290 syscall_table[SYS_fdevstat] = "fdevstat";
293 syscall_table[SYS_fdsync] = "fdsync";
296 syscall_table[SYS_filepriv] = "filepriv";
299 syscall_table[SYS_flock] = "flock";
302 syscall_table[SYS_flvlfile] = "flvlfile";
305 syscall_table[SYS_fork] = "fork";
308 syscall_table[SYS_fork1] = "fork1";
311 syscall_table[SYS_forkall] = "forkall";
314 syscall_table[SYS_fpathconf] = "fpathconf";
317 syscall_table[SYS_fstat] = "fstat";
320 syscall_table[SYS_fstat64] = "fstat64";
323 syscall_table[SYS_fstatfs] = "fstatfs";
326 syscall_table[SYS_fstatvfs] = "fstatvfs";
328 #ifdef SYS_fstatvfs64
329 syscall_table[SYS_fstatvfs64] = "fstatvfs64";
332 syscall_table[SYS_fsync] = "fsync";
335 syscall_table[SYS_ftruncate] = "ftruncate";
337 #ifdef SYS_ftruncate64
338 syscall_table[SYS_ftruncate64] = "ftruncate64";
341 syscall_table[SYS_fuser] = "fuser";
344 syscall_table[SYS_fxstat] = "fxstat";
346 #ifdef SYS_get_sysinfo
347 syscall_table[SYS_get_sysinfo] = "get_sysinfo";
349 #ifdef SYS_getaddressconf
350 syscall_table[SYS_getaddressconf] = "getaddressconf";
352 #ifdef SYS_getcontext
353 syscall_table[SYS_getcontext] = "getcontext";
356 syscall_table[SYS_getdents] = "getdents";
358 #ifdef SYS_getdents64
359 syscall_table[SYS_getdents64] = "getdents64";
361 #ifdef SYS_getdirentries
362 syscall_table[SYS_getdirentries] = "getdirentries";
364 #ifdef SYS_getdomainname
365 syscall_table[SYS_getdomainname] = "getdomainname";
367 #ifdef SYS_getdtablesize
368 syscall_table[SYS_getdtablesize] = "getdtablesize";
371 syscall_table[SYS_getfh] = "getfh";
374 syscall_table[SYS_getfsstat] = "getfsstat";
377 syscall_table[SYS_getgid] = "getgid";
380 syscall_table[SYS_getgroups] = "getgroups";
383 syscall_table[SYS_gethostid] = "gethostid";
385 #ifdef SYS_gethostname
386 syscall_table[SYS_gethostname] = "gethostname";
389 syscall_table[SYS_getitimer] = "getitimer";
392 syscall_table[SYS_getksym] = "getksym";
395 syscall_table[SYS_getlogin] = "getlogin";
398 syscall_table[SYS_getmnt] = "getmnt";
401 syscall_table[SYS_getmsg] = "getmsg";
403 #ifdef SYS_getpagesize
404 syscall_table[SYS_getpagesize] = "getpagesize";
406 #ifdef SYS_getpeername
407 syscall_table[SYS_getpeername] = "getpeername";
410 syscall_table[SYS_getpgid] = "getpgid";
413 syscall_table[SYS_getpgrp] = "getpgrp";
416 syscall_table[SYS_getpid] = "getpid";
419 syscall_table[SYS_getpmsg] = "getpmsg";
421 #ifdef SYS_getpriority
422 syscall_table[SYS_getpriority] = "getpriority";
425 syscall_table[SYS_getrlimit] = "getrlimit";
427 #ifdef SYS_getrlimit64
428 syscall_table[SYS_getrlimit64] = "getrlimit64";
431 syscall_table[SYS_getrusage] = "getrusage";
434 syscall_table[SYS_getsid] = "getsid";
436 #ifdef SYS_getsockname
437 syscall_table[SYS_getsockname] = "getsockname";
439 #ifdef SYS_getsockopt
440 syscall_table[SYS_getsockopt] = "getsockopt";
442 #ifdef SYS_gettimeofday
443 syscall_table[SYS_gettimeofday] = "gettimeofday";
446 syscall_table[SYS_getuid] = "getuid";
449 syscall_table[SYS_gtty] = "gtty";
452 syscall_table[SYS_hrtsys] = "hrtsys";
455 syscall_table[SYS_inst_sync] = "inst_sync";
457 #ifdef SYS_install_utrap
458 syscall_table[SYS_install_utrap] = "install_utrap";
461 syscall_table[SYS_invlpg] = "invlpg";
464 syscall_table[SYS_ioctl] = "ioctl";
467 syscall_table[SYS_kaio] = "kaio";
470 syscall_table[SYS_keyctl] = "keyctl";
473 syscall_table[SYS_kill] = "kill";
476 syscall_table[SYS_killpg] = "killpg";
479 syscall_table[SYS_kloadcall] = "kloadcall";
482 syscall_table[SYS_kmodcall] = "kmodcall";
484 #ifdef SYS_ksigaction
485 syscall_table[SYS_ksigaction] = "ksigaction";
487 #ifdef SYS_ksigprocmask
488 syscall_table[SYS_ksigprocmask] = "ksigprocmask";
491 syscall_table[SYS_ksigqueue] = "ksigqueue";
494 syscall_table[SYS_lchown] = "lchown";
497 syscall_table[SYS_link] = "link";
500 syscall_table[SYS_listen] = "listen";
503 syscall_table[SYS_llseek] = "llseek";
506 syscall_table[SYS_lseek] = "lseek";
509 syscall_table[SYS_lseek64] = "lseek64";
512 syscall_table[SYS_lstat] = "lstat";
515 syscall_table[SYS_lstat64] = "lstat64";
518 syscall_table[SYS_lvldom] = "lvldom";
521 syscall_table[SYS_lvlequal] = "lvlequal";
524 syscall_table[SYS_lvlfile] = "lvlfile";
527 syscall_table[SYS_lvlipc] = "lvlipc";
530 syscall_table[SYS_lvlproc] = "lvlproc";
533 syscall_table[SYS_lvlvfs] = "lvlvfs";
536 syscall_table[SYS_lwp_alarm] = "lwp_alarm";
538 #ifdef SYS_lwp_cond_broadcast
539 syscall_table[SYS_lwp_cond_broadcast] = "lwp_cond_broadcast";
541 #ifdef SYS_lwp_cond_signal
542 syscall_table[SYS_lwp_cond_signal] = "lwp_cond_signal";
544 #ifdef SYS_lwp_cond_wait
545 syscall_table[SYS_lwp_cond_wait] = "lwp_cond_wait";
547 #ifdef SYS_lwp_continue
548 syscall_table[SYS_lwp_continue] = "lwp_continue";
550 #ifdef SYS_lwp_create
551 syscall_table[SYS_lwp_create] = "lwp_create";
554 syscall_table[SYS_lwp_exit] = "lwp_exit";
556 #ifdef SYS_lwp_getprivate
557 syscall_table[SYS_lwp_getprivate] = "lwp_getprivate";
560 syscall_table[SYS_lwp_info] = "lwp_info";
563 syscall_table[SYS_lwp_kill] = "lwp_kill";
565 #ifdef SYS_lwp_mutex_init
566 syscall_table[SYS_lwp_mutex_init] = "lwp_mutex_init";
568 #ifdef SYS_lwp_mutex_lock
569 syscall_table[SYS_lwp_mutex_lock] = "lwp_mutex_lock";
571 #ifdef SYS_lwp_mutex_trylock
572 syscall_table[SYS_lwp_mutex_trylock] = "lwp_mutex_trylock";
574 #ifdef SYS_lwp_mutex_unlock
575 syscall_table[SYS_lwp_mutex_unlock] = "lwp_mutex_unlock";
577 #ifdef SYS_lwp_private
578 syscall_table[SYS_lwp_private] = "lwp_private";
581 syscall_table[SYS_lwp_self] = "lwp_self";
583 #ifdef SYS_lwp_sema_post
584 syscall_table[SYS_lwp_sema_post] = "lwp_sema_post";
586 #ifdef SYS_lwp_sema_trywait
587 syscall_table[SYS_lwp_sema_trywait] = "lwp_sema_trywait";
589 #ifdef SYS_lwp_sema_wait
590 syscall_table[SYS_lwp_sema_wait] = "lwp_sema_wait";
592 #ifdef SYS_lwp_setprivate
593 syscall_table[SYS_lwp_setprivate] = "lwp_setprivate";
595 #ifdef SYS_lwp_sigredirect
596 syscall_table[SYS_lwp_sigredirect] = "lwp_sigredirect";
598 #ifdef SYS_lwp_suspend
599 syscall_table[SYS_lwp_suspend] = "lwp_suspend";
602 syscall_table[SYS_lwp_wait] = "lwp_wait";
605 syscall_table[SYS_lxstat] = "lxstat";
608 syscall_table[SYS_madvise] = "madvise";
611 syscall_table[SYS_memcntl] = "memcntl";
614 syscall_table[SYS_mincore] = "mincore";
617 syscall_table[SYS_mincore] = "mincore";
620 syscall_table[SYS_mkdir] = "mkdir";
623 syscall_table[SYS_mkmld] = "mkmld";
626 syscall_table[SYS_mknod] = "mknod";
629 syscall_table[SYS_mldmode] = "mldmode";
632 syscall_table[SYS_mmap] = "mmap";
635 syscall_table[SYS_mmap64] = "mmap64";
638 syscall_table[SYS_modadm] = "modadm";
641 syscall_table[SYS_modctl] = "modctl";
644 syscall_table[SYS_modload] = "modload";
647 syscall_table[SYS_modpath] = "modpath";
650 syscall_table[SYS_modstat] = "modstat";
653 syscall_table[SYS_moduload] = "moduload";
656 syscall_table[SYS_mount] = "mount";
659 syscall_table[SYS_mprotect] = "mprotect";
662 syscall_table[SYS_mremap] = "mremap";
664 #ifdef SYS_msfs_syscall
665 syscall_table[SYS_msfs_syscall] = "msfs_syscall";
668 syscall_table[SYS_msgctl] = "msgctl";
671 syscall_table[SYS_msgget] = "msgget";
674 syscall_table[SYS_msgrcv] = "msgrcv";
677 syscall_table[SYS_msgsnd] = "msgsnd";
680 syscall_table[SYS_msgsys] = "msgsys";
683 syscall_table[SYS_msleep] = "msleep";
686 syscall_table[SYS_msync] = "msync";
689 syscall_table[SYS_munmap] = "munmap";
692 syscall_table[SYS_mvalid] = "mvalid";
695 syscall_table[SYS_mwakeup] = "mwakeup";
698 syscall_table[SYS_naccept] = "naccept";
701 syscall_table[SYS_nanosleep] = "nanosleep";
704 syscall_table[SYS_nfssvc] = "nfssvc";
707 syscall_table[SYS_nfssys] = "nfssys";
709 #ifdef SYS_ngetpeername
710 syscall_table[SYS_ngetpeername] = "ngetpeername";
712 #ifdef SYS_ngetsockname
713 syscall_table[SYS_ngetsockname] = "ngetsockname";
716 syscall_table[SYS_nice] = "nice";
719 syscall_table[SYS_nrecvfrom] = "nrecvfrom";
722 syscall_table[SYS_nrecvmsg] = "nrecvmsg";
725 syscall_table[SYS_nsendmsg] = "nsendmsg";
727 #ifdef SYS_ntp_adjtime
728 syscall_table[SYS_ntp_adjtime] = "ntp_adjtime";
730 #ifdef SYS_ntp_gettime
731 syscall_table[SYS_ntp_gettime] = "ntp_gettime";
734 syscall_table[SYS_nuname] = "nuname";
737 syscall_table[SYS_obreak] = "obreak";
739 #ifdef SYS_old_accept
740 syscall_table[SYS_old_accept] = "old_accept";
743 syscall_table[SYS_old_fstat] = "old_fstat";
745 #ifdef SYS_old_getpeername
746 syscall_table[SYS_old_getpeername] = "old_getpeername";
748 #ifdef SYS_old_getpgrp
749 syscall_table[SYS_old_getpgrp] = "old_getpgrp";
751 #ifdef SYS_old_getsockname
752 syscall_table[SYS_old_getsockname] = "old_getsockname";
754 #ifdef SYS_old_killpg
755 syscall_table[SYS_old_killpg] = "old_killpg";
758 syscall_table[SYS_old_lstat] = "old_lstat";
761 syscall_table[SYS_old_recv] = "old_recv";
763 #ifdef SYS_old_recvfrom
764 syscall_table[SYS_old_recvfrom] = "old_recvfrom";
766 #ifdef SYS_old_recvmsg
767 syscall_table[SYS_old_recvmsg] = "old_recvmsg";
770 syscall_table[SYS_old_send] = "old_send";
772 #ifdef SYS_old_sendmsg
773 syscall_table[SYS_old_sendmsg] = "old_sendmsg";
775 #ifdef SYS_old_sigblock
776 syscall_table[SYS_old_sigblock] = "old_sigblock";
778 #ifdef SYS_old_sigsetmask
779 syscall_table[SYS_old_sigsetmask] = "old_sigsetmask";
781 #ifdef SYS_old_sigvec
782 syscall_table[SYS_old_sigvec] = "old_sigvec";
785 syscall_table[SYS_old_stat] = "old_stat";
787 #ifdef SYS_old_vhangup
788 syscall_table[SYS_old_vhangup] = "old_vhangup";
791 syscall_table[SYS_old_wait] = "old_wait";
794 syscall_table[SYS_oldquota] = "oldquota";
797 syscall_table[SYS_online] = "online";
800 syscall_table[SYS_open] = "open";
803 syscall_table[SYS_open64] = "open64";
806 syscall_table[SYS_ovadvise] = "ovadvise";
809 syscall_table[SYS_p_online] = "p_online";
812 syscall_table[SYS_pagelock] = "pagelock";
815 syscall_table[SYS_pathconf] = "pathconf";
818 syscall_table[SYS_pause] = "pause";
821 syscall_table[SYS_pgrpsys] = "pgrpsys";
824 syscall_table[SYS_pid_block] = "pid_block";
826 #ifdef SYS_pid_unblock
827 syscall_table[SYS_pid_unblock] = "pid_unblock";
830 syscall_table[SYS_pipe] = "pipe";
833 syscall_table[SYS_plock] = "plock";
836 syscall_table[SYS_poll] = "poll";
839 syscall_table[SYS_prctl] = "prctl";
842 syscall_table[SYS_pread] = "pread";
845 syscall_table[SYS_pread64] = "pread64";
848 syscall_table[SYS_pread64] = "pread64";
851 syscall_table[SYS_prepblock] = "prepblock";
854 syscall_table[SYS_priocntl] = "priocntl";
856 #ifdef SYS_priocntllst
857 syscall_table[SYS_priocntllst] = "priocntllst";
859 #ifdef SYS_priocntlset
860 syscall_table[SYS_priocntlset] = "priocntlset";
862 #ifdef SYS_priocntlsys
863 syscall_table[SYS_priocntlsys] = "priocntlsys";
866 syscall_table[SYS_procblk] = "procblk";
868 #ifdef SYS_processor_bind
869 syscall_table[SYS_processor_bind] = "processor_bind";
871 #ifdef SYS_processor_exbind
872 syscall_table[SYS_processor_exbind] = "processor_exbind";
874 #ifdef SYS_processor_info
875 syscall_table[SYS_processor_info] = "processor_info";
878 syscall_table[SYS_procpriv] = "procpriv";
881 syscall_table[SYS_profil] = "profil";
883 #ifdef SYS_proplist_syscall
884 syscall_table[SYS_proplist_syscall] = "proplist_syscall";
887 syscall_table[SYS_pset] = "pset";
890 syscall_table[SYS_ptrace] = "ptrace";
893 syscall_table[SYS_putmsg] = "putmsg";
896 syscall_table[SYS_putpmsg] = "putpmsg";
899 syscall_table[SYS_pwrite] = "pwrite";
902 syscall_table[SYS_pwrite64] = "pwrite64";
905 syscall_table[SYS_quotactl] = "quotactl";
908 syscall_table[SYS_rdblock] = "rdblock";
911 syscall_table[SYS_read] = "read";
914 syscall_table[SYS_readlink] = "readlink";
917 syscall_table[SYS_readv] = "readv";
920 syscall_table[SYS_reboot] = "reboot";
923 syscall_table[SYS_recv] = "recv";
926 syscall_table[SYS_recvfrom] = "recvfrom";
929 syscall_table[SYS_recvmsg] = "recvmsg";
932 syscall_table[SYS_rename] = "rename";
934 #ifdef SYS_resolvepath
935 syscall_table[SYS_resolvepath] = "resolvepath";
938 syscall_table[SYS_revoke] = "revoke";
941 syscall_table[SYS_rfsys] = "rfsys";
944 syscall_table[SYS_rmdir] = "rmdir";
947 syscall_table[SYS_rpcsys] = "rpcsys";
950 syscall_table[SYS_sbrk] = "sbrk";
953 syscall_table[SYS_schedctl] = "schedctl";
956 syscall_table[SYS_secadvise] = "secadvise";
959 syscall_table[SYS_secsys] = "secsys";
962 syscall_table[SYS_security] = "security";
965 syscall_table[SYS_select] = "select";
968 syscall_table[SYS_semctl] = "semctl";
971 syscall_table[SYS_semget] = "semget";
974 syscall_table[SYS_semop] = "semop";
977 syscall_table[SYS_semsys] = "semsys";
980 syscall_table[SYS_send] = "send";
983 syscall_table[SYS_sendmsg] = "sendmsg";
986 syscall_table[SYS_sendto] = "sendto";
988 #ifdef SYS_set_program_attributes
989 syscall_table[SYS_set_program_attributes] = "set_program_attributes";
991 #ifdef SYS_set_speculative
992 syscall_table[SYS_set_speculative] = "set_speculative";
994 #ifdef SYS_set_sysinfo
995 syscall_table[SYS_set_sysinfo] = "set_sysinfo";
997 #ifdef SYS_setcontext
998 syscall_table[SYS_setcontext] = "setcontext";
1000 #ifdef SYS_setdomainname
1001 syscall_table[SYS_setdomainname] = "setdomainname";
1004 syscall_table[SYS_setegid] = "setegid";
1007 syscall_table[SYS_seteuid] = "seteuid";
1010 syscall_table[SYS_setgid] = "setgid";
1012 #ifdef SYS_setgroups
1013 syscall_table[SYS_setgroups] = "setgroups";
1015 #ifdef SYS_sethostid
1016 syscall_table[SYS_sethostid] = "sethostid";
1018 #ifdef SYS_sethostname
1019 syscall_table[SYS_sethostname] = "sethostname";
1021 #ifdef SYS_setitimer
1022 syscall_table[SYS_setitimer] = "setitimer";
1025 syscall_table[SYS_setlogin] = "setlogin";
1028 syscall_table[SYS_setpgid] = "setpgid";
1031 syscall_table[SYS_setpgrp] = "setpgrp";
1033 #ifdef SYS_setpriority
1034 syscall_table[SYS_setpriority] = "setpriority";
1037 syscall_table[SYS_setregid] = "setregid";
1040 syscall_table[SYS_setreuid] = "setreuid";
1042 #ifdef SYS_setrlimit
1043 syscall_table[SYS_setrlimit] = "setrlimit";
1045 #ifdef SYS_setrlimit64
1046 syscall_table[SYS_setrlimit64] = "setrlimit64";
1049 syscall_table[SYS_setsid] = "setsid";
1051 #ifdef SYS_setsockopt
1052 syscall_table[SYS_setsockopt] = "setsockopt";
1054 #ifdef SYS_settimeofday
1055 syscall_table[SYS_settimeofday] = "settimeofday";
1058 syscall_table[SYS_setuid] = "setuid";
1061 syscall_table[SYS_sgi] = "sgi";
1063 #ifdef SYS_sgifastpath
1064 syscall_table[SYS_sgifastpath] = "sgifastpath";
1067 syscall_table[SYS_sgikopt] = "sgikopt";
1070 syscall_table[SYS_sginap] = "sginap";
1073 syscall_table[SYS_shmat] = "shmat";
1076 syscall_table[SYS_shmctl] = "shmctl";
1079 syscall_table[SYS_shmdt] = "shmdt";
1082 syscall_table[SYS_shmget] = "shmget";
1085 syscall_table[SYS_shmsys] = "shmsys";
1088 syscall_table[SYS_shutdown] = "shutdown";
1090 #ifdef SYS_sigaction
1091 syscall_table[SYS_sigaction] = "sigaction";
1093 #ifdef SYS_sigaltstack
1094 syscall_table[SYS_sigaltstack] = "sigaltstack";
1096 #ifdef SYS_sigaltstack
1097 syscall_table[SYS_sigaltstack] = "sigaltstack";
1100 syscall_table[SYS_sigblock] = "sigblock";
1103 syscall_table[SYS_signal] = "signal";
1105 #ifdef SYS_signotify
1106 syscall_table[SYS_signotify] = "signotify";
1108 #ifdef SYS_signotifywait
1109 syscall_table[SYS_signotifywait] = "signotifywait";
1111 #ifdef SYS_sigpending
1112 syscall_table[SYS_sigpending] = "sigpending";
1115 syscall_table[SYS_sigpoll] = "sigpoll";
1117 #ifdef SYS_sigprocmask
1118 syscall_table[SYS_sigprocmask] = "sigprocmask";
1121 syscall_table[SYS_sigqueue] = "sigqueue";
1123 #ifdef SYS_sigreturn
1124 syscall_table[SYS_sigreturn] = "sigreturn";
1126 #ifdef SYS_sigsendset
1127 syscall_table[SYS_sigsendset] = "sigsendset";
1129 #ifdef SYS_sigsendsys
1130 syscall_table[SYS_sigsendsys] = "sigsendsys";
1132 #ifdef SYS_sigsetmask
1133 syscall_table[SYS_sigsetmask] = "sigsetmask";
1136 syscall_table[SYS_sigstack] = "sigstack";
1138 #ifdef SYS_sigsuspend
1139 syscall_table[SYS_sigsuspend] = "sigsuspend";
1142 syscall_table[SYS_sigvec] = "sigvec";
1145 syscall_table[SYS_sigwait] = "sigwait";
1147 #ifdef SYS_sigwaitprim
1148 syscall_table[SYS_sigwaitprim] = "sigwaitprim";
1151 syscall_table[SYS_sleep] = "sleep";
1153 #ifdef SYS_so_socket
1154 syscall_table[SYS_so_socket] = "so_socket";
1156 #ifdef SYS_so_socketpair
1157 syscall_table[SYS_so_socketpair] = "so_socketpair";
1159 #ifdef SYS_sockconfig
1160 syscall_table[SYS_sockconfig] = "sockconfig";
1163 syscall_table[SYS_socket] = "socket";
1165 #ifdef SYS_socketpair
1166 syscall_table[SYS_socketpair] = "socketpair";
1169 syscall_table[SYS_sproc] = "sproc";
1172 syscall_table[SYS_sprocsp] = "sprocsp";
1175 syscall_table[SYS_sstk] = "sstk";
1178 syscall_table[SYS_stat] = "stat";
1181 syscall_table[SYS_stat64] = "stat64";
1184 syscall_table[SYS_statfs] = "statfs";
1187 syscall_table[SYS_statvfs] = "statvfs";
1189 #ifdef SYS_statvfs64
1190 syscall_table[SYS_statvfs64] = "statvfs64";
1193 syscall_table[SYS_stime] = "stime";
1196 syscall_table[SYS_stty] = "stty";
1198 #ifdef SYS_subsys_info
1199 syscall_table[SYS_subsys_info] = "subsys_info";
1202 syscall_table[SYS_swapctl] = "swapctl";
1205 syscall_table[SYS_swapon] = "swapon";
1208 syscall_table[SYS_symlink] = "symlink";
1211 syscall_table[SYS_sync] = "sync";
1214 syscall_table[SYS_sys3b] = "sys3b";
1217 syscall_table[SYS_syscall] = "syscall";
1219 #ifdef SYS_sysconfig
1220 syscall_table[SYS_sysconfig] = "sysconfig";
1223 syscall_table[SYS_sysfs] = "sysfs";
1226 syscall_table[SYS_sysi86] = "sysi86";
1229 syscall_table[SYS_sysinfo] = "sysinfo";
1232 syscall_table[SYS_sysmips] = "sysmips";
1235 syscall_table[SYS_syssun] = "syssun";
1237 #ifdef SYS_systeminfo
1238 syscall_table[SYS_systeminfo] = "systeminfo";
1241 syscall_table[SYS_table] = "table";
1244 syscall_table[SYS_time] = "time";
1246 #ifdef SYS_timedwait
1247 syscall_table[SYS_timedwait] = "timedwait";
1249 #ifdef SYS_timer_create
1250 syscall_table[SYS_timer_create] = "timer_create";
1252 #ifdef SYS_timer_delete
1253 syscall_table[SYS_timer_delete] = "timer_delete";
1255 #ifdef SYS_timer_getoverrun
1256 syscall_table[SYS_timer_getoverrun] = "timer_getoverrun";
1258 #ifdef SYS_timer_gettime
1259 syscall_table[SYS_timer_gettime] = "timer_gettime";
1261 #ifdef SYS_timer_settime
1262 syscall_table[SYS_timer_settime] = "timer_settime";
1265 syscall_table[SYS_times] = "times";
1268 syscall_table[SYS_truncate] = "truncate";
1270 #ifdef SYS_truncate64
1271 syscall_table[SYS_truncate64] = "truncate64";
1274 syscall_table[SYS_tsolsys] = "tsolsys";
1277 syscall_table[SYS_uadmin] = "uadmin";
1280 syscall_table[SYS_ulimit] = "ulimit";
1283 syscall_table[SYS_umask] = "umask";
1286 syscall_table[SYS_umount] = "umount";
1289 syscall_table[SYS_uname] = "uname";
1292 syscall_table[SYS_unblock] = "unblock";
1295 syscall_table[SYS_unlink] = "unlink";
1298 syscall_table[SYS_unmount] = "unmount";
1300 #ifdef SYS_usleep_thread
1301 syscall_table[SYS_usleep_thread] = "usleep_thread";
1304 syscall_table[SYS_uswitch] = "uswitch";
1306 #ifdef SYS_utc_adjtime
1307 syscall_table[SYS_utc_adjtime] = "utc_adjtime";
1309 #ifdef SYS_utc_gettime
1310 syscall_table[SYS_utc_gettime] = "utc_gettime";
1313 syscall_table[SYS_utime] = "utime";
1316 syscall_table[SYS_utimes] = "utimes";
1319 syscall_table[SYS_utssys] = "utssys";
1322 syscall_table[SYS_vfork] = "vfork";
1325 syscall_table[SYS_vhangup] = "vhangup";
1328 syscall_table[SYS_vtrace] = "vtrace";
1331 syscall_table[SYS_wait] = "wait";
1334 syscall_table[SYS_waitid] = "waitid";
1337 syscall_table[SYS_waitsys] = "waitsys";
1340 syscall_table[SYS_write] = "write";
1343 syscall_table[SYS_writev] = "writev";
1346 syscall_table[SYS_xenix] = "xenix";
1349 syscall_table[SYS_xmknod] = "xmknod";
1352 syscall_table[SYS_xstat] = "xstat";
1355 syscall_table[SYS_yield] = "yield";
1359 /* Prettyprint syscall NUM. */
1362 proc_prettyfprint_syscall (FILE *file, int num, int verbose)
1364 if (syscall_table[num])
1365 fprintf (file, "SYS_%s ", syscall_table[num]);
1367 fprintf (file, "<Unknown syscall %d> ", num);
1371 proc_prettyprint_syscall (int num, int verbose)
1373 proc_prettyfprint_syscall (stdout, num, verbose);
1376 /* Prettyprint all syscalls in SYSSET. */
1379 proc_prettyfprint_syscalls (FILE *file, sysset_t *sysset, int verbose)
1383 for (i = 0; i < MAX_SYSCALLS; i++)
1384 if (prismember (sysset, i))
1386 proc_prettyfprint_syscall (file, i, verbose);
1388 fprintf (file, "\n");
1392 proc_prettyprint_syscalls (sysset_t *sysset, int verbose)
1394 proc_prettyfprint_syscalls (stdout, sysset, verbose);
1397 /* Prettyprint signals. */
1399 /* Signal translation table. */
1401 static struct trans signal_table[] =
1403 { 0, "<no signal>", "no signal" },
1405 { SIGHUP, "SIGHUP", "Hangup" },
1407 { SIGINT, "SIGINT", "Interrupt (rubout)" },
1409 { SIGQUIT, "SIGQUIT", "Quit (ASCII FS)" },
1411 { SIGILL, "SIGILL", "Illegal instruction" }, /* not reset when caught */
1413 { SIGTRAP, "SIGTRAP", "Trace trap" }, /* not reset when caught */
1415 { SIGABRT, "SIGABRT", "used by abort()" }, /* replaces SIGIOT */
1417 { SIGIOT, "SIGIOT", "IOT instruction" },
1420 { SIGEMT, "SIGEMT", "EMT instruction" },
1422 { SIGFPE, "SIGFPE", "Floating point exception" },
1424 { SIGKILL, "SIGKILL", "Kill" }, /* Solaris: cannot be caught/ignored */
1427 { SIGBUS, "SIGBUS", "Bus error" },
1429 { SIGSEGV, "SIGSEGV", "Segmentation violation" },
1431 { SIGSYS, "SIGSYS", "Bad argument to system call" },
1434 { SIGPIPE, "SIGPIPE", "Write to pipe with no one to read it" },
1437 { SIGALRM, "SIGALRM", "Alarm clock" },
1439 { SIGTERM, "SIGTERM", "Software termination signal from kill" },
1441 { SIGUSR1, "SIGUSR1", "User defined signal 1" },
1444 { SIGUSR2, "SIGUSR2", "User defined signal 2" },
1447 { SIGCHLD, "SIGCHLD", "Child status changed" }, /* Posix version */
1450 { SIGCLD, "SIGCLD", "Child status changed" }, /* Solaris version */
1453 { SIGPWR, "SIGPWR", "Power-fail restart" },
1456 { SIGWINCH, "SIGWINCH", "Window size change" },
1459 { SIGURG, "SIGURG", "Urgent socket condition" },
1462 { SIGPOLL, "SIGPOLL", "Pollable event" },
1465 { SIGIO, "SIGIO", "Socket I/O possible" }, /* alias for SIGPOLL */
1468 { SIGSTOP, "SIGSTOP", "Stop, not from tty" }, /* cannot be caught or
1472 { SIGTSTP, "SIGTSTP", "User stop from tty" },
1475 { SIGCONT, "SIGCONT", "Stopped process has been continued" },
1478 { SIGTTIN, "SIGTTIN", "Background tty read attempted" },
1481 { SIGTTOU, "SIGTTOU", "Background tty write attempted" },
1484 { SIGVTALRM, "SIGVTALRM", "Virtual timer expired" },
1487 { SIGPROF, "SIGPROF", "Profiling timer expired" },
1490 { SIGXCPU, "SIGXCPU", "Exceeded CPU limit" },
1493 { SIGXFSZ, "SIGXFSZ", "Exceeded file size limit" },
1496 { SIGWAITING, "SIGWAITING", "Process's LWPs are blocked" },
1499 { SIGLWP, "SIGLWP", "Used by thread library" },
1502 { SIGFREEZE, "SIGFREEZE", "Used by CPR" },
1505 { SIGTHAW, "SIGTHAW", "Used by CPR" },
1508 { SIGCANCEL, "SIGCANCEL", "Used by libthread" },
1511 { SIGLOST, "SIGLOST", "Resource lost" },
1514 { SIG32, "SIG32", "Reserved for kernel usage (Irix)" },
1517 { SIGPTINTR, "SIGPTINTR", "Posix 1003.1b" },
1520 { SIGTRESCHED, "SIGTRESCHED", "Posix 1003.1b" },
1523 { SIGINFO, "SIGINFO", "Information request" },
1526 { SIGRESV, "SIGRESV", "Reserved by Digital for future use" },
1529 { SIGAIO, "SIGAIO", "Asynchronous I/O signal" },
1532 /* FIXME: add real-time signals. */
1535 /* Prettyprint signal number SIGNO. */
1538 proc_prettyfprint_signal (FILE *file, int signo, int verbose)
1542 for (i = 0; i < sizeof (signal_table) / sizeof (signal_table[0]); i++)
1543 if (signo == signal_table[i].value)
1545 fprintf (file, "%s", signal_table[i].name);
1547 fprintf (file, ": %s\n", signal_table[i].desc);
1549 fprintf (file, " ");
1552 fprintf (file, "Unknown signal %d%c", signo, verbose ? '\n' : ' ');
1556 proc_prettyprint_signal (int signo, int verbose)
1558 proc_prettyfprint_signal (stdout, signo, verbose);
1561 /* Prettyprint all signals in SIGSET. */
1564 proc_prettyfprint_signalset (FILE *file, sigset_t *sigset, int verbose)
1568 /* Loop over all signal numbers from 0 to NSIG, using them as the
1569 index to prismember. The signal table had better not contain
1570 aliases, for if it does they will both be printed. */
1572 for (i = 0; i < NSIG; i++)
1573 if (prismember (sigset, i))
1574 proc_prettyfprint_signal (file, i, verbose);
1577 fprintf (file, "\n");
1581 proc_prettyprint_signalset (sigset_t *sigset, int verbose)
1583 proc_prettyfprint_signalset (stdout, sigset, verbose);
1587 /* Prettyprint faults. */
1589 /* Fault translation table. */
1591 static struct trans fault_table[] =
1594 { FLTILL, "FLTILL", "Illegal instruction" },
1597 { FLTPRIV, "FLTPRIV", "Privileged instruction" },
1600 { FLTBPT, "FLTBPT", "Breakpoint trap" },
1603 { FLTTRACE, "FLTTRACE", "Trace trap" },
1606 { FLTACCESS, "FLTACCESS", "Memory access fault" },
1609 { FLTBOUNDS, "FLTBOUNDS", "Memory bounds violation" },
1612 { FLTIOVF, "FLTIOVF", "Integer overflow" },
1615 { FLTIZDIV, "FLTIZDIV", "Integer zero divide" },
1618 { FLTFPE, "FLTFPE", "Floating-point exception" },
1621 { FLTSTACK, "FLTSTACK", "Unrecoverable stack fault" },
1624 { FLTPAGE, "FLTPAGE", "Recoverable page fault" },
1627 { FLTPCINVAL, "FLTPCINVAL", "Invalid PC exception" },
1630 { FLTWATCH, "FLTWATCH", "User watchpoint" },
1633 { FLTKWATCH, "FLTKWATCH", "Kernel watchpoint" },
1636 { FLTSCWATCH, "FLTSCWATCH", "Hit a store conditional on a watched page" },
1640 /* Work horse. Accepts an index into the fault table, prints it
1644 prettyfprint_faulttable_entry (FILE *file, int i, int verbose)
1646 fprintf (file, "%s", fault_table[i].name);
1648 fprintf (file, ": %s\n", fault_table[i].desc);
1650 fprintf (file, " ");
1653 /* Prettyprint hardware fault number FAULTNO. */
1656 proc_prettyfprint_fault (FILE *file, int faultno, int verbose)
1660 for (i = 0; i < ARRAY_SIZE (fault_table); i++)
1661 if (faultno == fault_table[i].value)
1663 prettyfprint_faulttable_entry (file, i, verbose);
1667 fprintf (file, "Unknown hardware fault %d%c",
1668 faultno, verbose ? '\n' : ' ');
1672 proc_prettyprint_fault (int faultno, int verbose)
1674 proc_prettyfprint_fault (stdout, faultno, verbose);
1677 /* Prettyprint all faults in FLTSET. */
1680 proc_prettyfprint_faultset (FILE *file, fltset_t *fltset, int verbose)
1684 /* Loop through the fault table, using the value field as the index
1685 to prismember. The fault table had better not contain aliases,
1686 for if it does they will both be printed. */
1688 for (i = 0; i < ARRAY_SIZE (fault_table); i++)
1689 if (prismember (fltset, fault_table[i].value))
1690 prettyfprint_faulttable_entry (file, i, verbose);
1693 fprintf (file, "\n");
1697 proc_prettyprint_faultset (fltset_t *fltset, int verbose)
1699 proc_prettyfprint_faultset (stdout, fltset, verbose);
1702 /* TODO: actions, holds... */
1705 proc_prettyprint_actionset (struct sigaction *actions, int verbose)
1710 /* Provide a prototype to silence -Wmissing-prototypes. */
1711 void _initialize_proc_events (void);
1714 _initialize_proc_events (void)
1716 init_syscall_table ();