1 /* Machine-independent support for SVR4 /proc (process file system)
3 Copyright (C) 1999-2016 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
37 #include <sys/types.h>
38 #include <sys/procfs.h>
39 #ifdef HAVE_SYS_SYSCALL_H
40 #include <sys/syscall.h>
42 #ifdef HAVE_SYS_FAULT_H
43 #include <sys/fault.h>
46 #include "proc-utils.h"
48 /* Much of the information used in the /proc interface, particularly
49 for printing status information, is kept as tables of structures of
50 the following form. These tables can be used to map numeric values
51 to their symbolic names and to a string that describes their
56 int value; /* The numeric value. */
57 char *name; /* The equivalent symbolic value. */
58 char *desc; /* Short description of value. */
62 /* Pretty print syscalls. */
64 /* Syscall translation table. */
66 #define MAX_SYSCALLS 262 /* Pretty arbitrary. */
67 static char *syscall_table[MAX_SYSCALLS];
70 init_syscall_table (void)
73 syscall_table[SYS_BSD_getime] = "BSD_getime";
76 syscall_table[SYS_BSDgetpgrp] = "BSDgetpgrp";
79 syscall_table[SYS_BSDsetpgrp] = "BSDsetpgrp";
82 syscall_table[SYS_acancel] = "acancel";
85 syscall_table[SYS_accept] = "accept";
88 syscall_table[SYS_access] = "access";
91 syscall_table[SYS_acct] = "acct";
94 syscall_table[SYS_acl] = "acl";
97 syscall_table[SYS_aclipc] = "aclipc";
100 syscall_table[SYS_adjtime] = "adjtime";
102 #ifdef SYS_afs_syscall
103 syscall_table[SYS_afs_syscall] = "afs_syscall";
106 syscall_table[SYS_alarm] = "alarm";
109 syscall_table[SYS_alt_plock] = "alt_plock";
111 #ifdef SYS_alt_sigpending
112 syscall_table[SYS_alt_sigpending] = "alt_sigpending";
115 syscall_table[SYS_async] = "async";
117 #ifdef SYS_async_daemon
118 syscall_table[SYS_async_daemon] = "async_daemon";
121 syscall_table[SYS_audcntl] = "audcntl";
124 syscall_table[SYS_audgen] = "audgen";
127 syscall_table[SYS_auditbuf] = "auditbuf";
130 syscall_table[SYS_auditctl] = "auditctl";
133 syscall_table[SYS_auditdmp] = "auditdmp";
136 syscall_table[SYS_auditevt] = "auditevt";
139 syscall_table[SYS_auditlog] = "auditlog";
142 syscall_table[SYS_auditsys] = "auditsys";
145 syscall_table[SYS_bind] = "bind";
148 syscall_table[SYS_block] = "block";
151 syscall_table[SYS_brk] = "brk";
154 syscall_table[SYS_cachectl] = "cachectl";
156 #ifdef SYS_cacheflush
157 syscall_table[SYS_cacheflush] = "cacheflush";
159 #ifdef SYS_cancelblock
160 syscall_table[SYS_cancelblock] = "cancelblock";
163 syscall_table[SYS_cg_bind] = "cg_bind";
165 #ifdef SYS_cg_current
166 syscall_table[SYS_cg_current] = "cg_current";
169 syscall_table[SYS_cg_ids] = "cg_ids";
172 syscall_table[SYS_cg_info] = "cg_info";
175 syscall_table[SYS_cg_memloc] = "cg_memloc";
177 #ifdef SYS_cg_processors
178 syscall_table[SYS_cg_processors] = "cg_processors";
181 syscall_table[SYS_chdir] = "chdir";
184 syscall_table[SYS_chflags] = "chflags";
187 syscall_table[SYS_chmod] = "chmod";
190 syscall_table[SYS_chown] = "chown";
193 syscall_table[SYS_chroot] = "chroot";
196 syscall_table[SYS_clocal] = "clocal";
198 #ifdef SYS_clock_getres
199 syscall_table[SYS_clock_getres] = "clock_getres";
201 #ifdef SYS_clock_gettime
202 syscall_table[SYS_clock_gettime] = "clock_gettime";
204 #ifdef SYS_clock_settime
205 syscall_table[SYS_clock_settime] = "clock_settime";
208 syscall_table[SYS_close] = "close";
211 syscall_table[SYS_connect] = "connect";
214 syscall_table[SYS_context] = "context";
217 syscall_table[SYS_creat] = "creat";
220 syscall_table[SYS_creat64] = "creat64";
223 syscall_table[SYS_devstat] = "devstat";
226 syscall_table[SYS_dmi] = "dmi";
229 syscall_table[SYS_door] = "door";
232 syscall_table[SYS_dshmsys] = "dshmsys";
235 syscall_table[SYS_dup] = "dup";
238 syscall_table[SYS_dup2] = "dup2";
241 syscall_table[SYS_evsys] = "evsys";
244 syscall_table[SYS_evtrapret] = "evtrapret";
247 syscall_table[SYS_exec] = "exec";
249 #ifdef SYS_exec_with_loader
250 syscall_table[SYS_exec_with_loader] = "exec_with_loader";
253 syscall_table[SYS_execv] = "execv";
256 syscall_table[SYS_execve] = "execve";
259 syscall_table[SYS_exit] = "exit";
262 syscall_table[SYS_exportfs] = "exportfs";
265 syscall_table[SYS_facl] = "facl";
268 syscall_table[SYS_fchdir] = "fchdir";
271 syscall_table[SYS_fchflags] = "fchflags";
274 syscall_table[SYS_fchmod] = "fchmod";
277 syscall_table[SYS_fchown] = "fchown";
280 syscall_table[SYS_fchroot] = "fchroot";
283 syscall_table[SYS_fcntl] = "fcntl";
286 syscall_table[SYS_fdatasync] = "fdatasync";
289 syscall_table[SYS_fdevstat] = "fdevstat";
292 syscall_table[SYS_fdsync] = "fdsync";
295 syscall_table[SYS_filepriv] = "filepriv";
298 syscall_table[SYS_flock] = "flock";
301 syscall_table[SYS_flvlfile] = "flvlfile";
304 syscall_table[SYS_fork] = "fork";
307 syscall_table[SYS_fork1] = "fork1";
310 syscall_table[SYS_forkall] = "forkall";
313 syscall_table[SYS_fpathconf] = "fpathconf";
316 syscall_table[SYS_fstat] = "fstat";
319 syscall_table[SYS_fstat64] = "fstat64";
322 syscall_table[SYS_fstatfs] = "fstatfs";
325 syscall_table[SYS_fstatvfs] = "fstatvfs";
327 #ifdef SYS_fstatvfs64
328 syscall_table[SYS_fstatvfs64] = "fstatvfs64";
331 syscall_table[SYS_fsync] = "fsync";
334 syscall_table[SYS_ftruncate] = "ftruncate";
336 #ifdef SYS_ftruncate64
337 syscall_table[SYS_ftruncate64] = "ftruncate64";
340 syscall_table[SYS_fuser] = "fuser";
343 syscall_table[SYS_fxstat] = "fxstat";
345 #ifdef SYS_get_sysinfo
346 syscall_table[SYS_get_sysinfo] = "get_sysinfo";
348 #ifdef SYS_getaddressconf
349 syscall_table[SYS_getaddressconf] = "getaddressconf";
351 #ifdef SYS_getcontext
352 syscall_table[SYS_getcontext] = "getcontext";
355 syscall_table[SYS_getdents] = "getdents";
357 #ifdef SYS_getdents64
358 syscall_table[SYS_getdents64] = "getdents64";
360 #ifdef SYS_getdirentries
361 syscall_table[SYS_getdirentries] = "getdirentries";
363 #ifdef SYS_getdomainname
364 syscall_table[SYS_getdomainname] = "getdomainname";
366 #ifdef SYS_getdtablesize
367 syscall_table[SYS_getdtablesize] = "getdtablesize";
370 syscall_table[SYS_getfh] = "getfh";
373 syscall_table[SYS_getfsstat] = "getfsstat";
376 syscall_table[SYS_getgid] = "getgid";
379 syscall_table[SYS_getgroups] = "getgroups";
382 syscall_table[SYS_gethostid] = "gethostid";
384 #ifdef SYS_gethostname
385 syscall_table[SYS_gethostname] = "gethostname";
388 syscall_table[SYS_getitimer] = "getitimer";
391 syscall_table[SYS_getksym] = "getksym";
394 syscall_table[SYS_getlogin] = "getlogin";
397 syscall_table[SYS_getmnt] = "getmnt";
400 syscall_table[SYS_getmsg] = "getmsg";
402 #ifdef SYS_getpagesize
403 syscall_table[SYS_getpagesize] = "getpagesize";
405 #ifdef SYS_getpeername
406 syscall_table[SYS_getpeername] = "getpeername";
409 syscall_table[SYS_getpgid] = "getpgid";
412 syscall_table[SYS_getpgrp] = "getpgrp";
415 syscall_table[SYS_getpid] = "getpid";
418 syscall_table[SYS_getpmsg] = "getpmsg";
420 #ifdef SYS_getpriority
421 syscall_table[SYS_getpriority] = "getpriority";
424 syscall_table[SYS_getrlimit] = "getrlimit";
426 #ifdef SYS_getrlimit64
427 syscall_table[SYS_getrlimit64] = "getrlimit64";
430 syscall_table[SYS_getrusage] = "getrusage";
433 syscall_table[SYS_getsid] = "getsid";
435 #ifdef SYS_getsockname
436 syscall_table[SYS_getsockname] = "getsockname";
438 #ifdef SYS_getsockopt
439 syscall_table[SYS_getsockopt] = "getsockopt";
441 #ifdef SYS_gettimeofday
442 syscall_table[SYS_gettimeofday] = "gettimeofday";
445 syscall_table[SYS_getuid] = "getuid";
448 syscall_table[SYS_gtty] = "gtty";
451 syscall_table[SYS_hrtsys] = "hrtsys";
454 syscall_table[SYS_inst_sync] = "inst_sync";
456 #ifdef SYS_install_utrap
457 syscall_table[SYS_install_utrap] = "install_utrap";
460 syscall_table[SYS_invlpg] = "invlpg";
463 syscall_table[SYS_ioctl] = "ioctl";
466 syscall_table[SYS_kaio] = "kaio";
469 syscall_table[SYS_keyctl] = "keyctl";
472 syscall_table[SYS_kill] = "kill";
475 syscall_table[SYS_killpg] = "killpg";
478 syscall_table[SYS_kloadcall] = "kloadcall";
481 syscall_table[SYS_kmodcall] = "kmodcall";
483 #ifdef SYS_ksigaction
484 syscall_table[SYS_ksigaction] = "ksigaction";
486 #ifdef SYS_ksigprocmask
487 syscall_table[SYS_ksigprocmask] = "ksigprocmask";
490 syscall_table[SYS_ksigqueue] = "ksigqueue";
493 syscall_table[SYS_lchown] = "lchown";
496 syscall_table[SYS_link] = "link";
499 syscall_table[SYS_listen] = "listen";
502 syscall_table[SYS_llseek] = "llseek";
505 syscall_table[SYS_lseek] = "lseek";
508 syscall_table[SYS_lseek64] = "lseek64";
511 syscall_table[SYS_lstat] = "lstat";
514 syscall_table[SYS_lstat64] = "lstat64";
517 syscall_table[SYS_lvldom] = "lvldom";
520 syscall_table[SYS_lvlequal] = "lvlequal";
523 syscall_table[SYS_lvlfile] = "lvlfile";
526 syscall_table[SYS_lvlipc] = "lvlipc";
529 syscall_table[SYS_lvlproc] = "lvlproc";
532 syscall_table[SYS_lvlvfs] = "lvlvfs";
535 syscall_table[SYS_lwp_alarm] = "lwp_alarm";
537 #ifdef SYS_lwp_cond_broadcast
538 syscall_table[SYS_lwp_cond_broadcast] = "lwp_cond_broadcast";
540 #ifdef SYS_lwp_cond_signal
541 syscall_table[SYS_lwp_cond_signal] = "lwp_cond_signal";
543 #ifdef SYS_lwp_cond_wait
544 syscall_table[SYS_lwp_cond_wait] = "lwp_cond_wait";
546 #ifdef SYS_lwp_continue
547 syscall_table[SYS_lwp_continue] = "lwp_continue";
549 #ifdef SYS_lwp_create
550 syscall_table[SYS_lwp_create] = "lwp_create";
553 syscall_table[SYS_lwp_exit] = "lwp_exit";
555 #ifdef SYS_lwp_getprivate
556 syscall_table[SYS_lwp_getprivate] = "lwp_getprivate";
559 syscall_table[SYS_lwp_info] = "lwp_info";
562 syscall_table[SYS_lwp_kill] = "lwp_kill";
564 #ifdef SYS_lwp_mutex_init
565 syscall_table[SYS_lwp_mutex_init] = "lwp_mutex_init";
567 #ifdef SYS_lwp_mutex_lock
568 syscall_table[SYS_lwp_mutex_lock] = "lwp_mutex_lock";
570 #ifdef SYS_lwp_mutex_trylock
571 syscall_table[SYS_lwp_mutex_trylock] = "lwp_mutex_trylock";
573 #ifdef SYS_lwp_mutex_unlock
574 syscall_table[SYS_lwp_mutex_unlock] = "lwp_mutex_unlock";
576 #ifdef SYS_lwp_private
577 syscall_table[SYS_lwp_private] = "lwp_private";
580 syscall_table[SYS_lwp_self] = "lwp_self";
582 #ifdef SYS_lwp_sema_post
583 syscall_table[SYS_lwp_sema_post] = "lwp_sema_post";
585 #ifdef SYS_lwp_sema_trywait
586 syscall_table[SYS_lwp_sema_trywait] = "lwp_sema_trywait";
588 #ifdef SYS_lwp_sema_wait
589 syscall_table[SYS_lwp_sema_wait] = "lwp_sema_wait";
591 #ifdef SYS_lwp_setprivate
592 syscall_table[SYS_lwp_setprivate] = "lwp_setprivate";
594 #ifdef SYS_lwp_sigredirect
595 syscall_table[SYS_lwp_sigredirect] = "lwp_sigredirect";
597 #ifdef SYS_lwp_suspend
598 syscall_table[SYS_lwp_suspend] = "lwp_suspend";
601 syscall_table[SYS_lwp_wait] = "lwp_wait";
604 syscall_table[SYS_lxstat] = "lxstat";
607 syscall_table[SYS_madvise] = "madvise";
610 syscall_table[SYS_memcntl] = "memcntl";
613 syscall_table[SYS_mincore] = "mincore";
616 syscall_table[SYS_mincore] = "mincore";
619 syscall_table[SYS_mkdir] = "mkdir";
622 syscall_table[SYS_mkmld] = "mkmld";
625 syscall_table[SYS_mknod] = "mknod";
628 syscall_table[SYS_mldmode] = "mldmode";
631 syscall_table[SYS_mmap] = "mmap";
634 syscall_table[SYS_mmap64] = "mmap64";
637 syscall_table[SYS_modadm] = "modadm";
640 syscall_table[SYS_modctl] = "modctl";
643 syscall_table[SYS_modload] = "modload";
646 syscall_table[SYS_modpath] = "modpath";
649 syscall_table[SYS_modstat] = "modstat";
652 syscall_table[SYS_moduload] = "moduload";
655 syscall_table[SYS_mount] = "mount";
658 syscall_table[SYS_mprotect] = "mprotect";
661 syscall_table[SYS_mremap] = "mremap";
663 #ifdef SYS_msfs_syscall
664 syscall_table[SYS_msfs_syscall] = "msfs_syscall";
667 syscall_table[SYS_msgctl] = "msgctl";
670 syscall_table[SYS_msgget] = "msgget";
673 syscall_table[SYS_msgrcv] = "msgrcv";
676 syscall_table[SYS_msgsnd] = "msgsnd";
679 syscall_table[SYS_msgsys] = "msgsys";
682 syscall_table[SYS_msleep] = "msleep";
685 syscall_table[SYS_msync] = "msync";
688 syscall_table[SYS_munmap] = "munmap";
691 syscall_table[SYS_mvalid] = "mvalid";
694 syscall_table[SYS_mwakeup] = "mwakeup";
697 syscall_table[SYS_naccept] = "naccept";
700 syscall_table[SYS_nanosleep] = "nanosleep";
703 syscall_table[SYS_nfssvc] = "nfssvc";
706 syscall_table[SYS_nfssys] = "nfssys";
708 #ifdef SYS_ngetpeername
709 syscall_table[SYS_ngetpeername] = "ngetpeername";
711 #ifdef SYS_ngetsockname
712 syscall_table[SYS_ngetsockname] = "ngetsockname";
715 syscall_table[SYS_nice] = "nice";
718 syscall_table[SYS_nrecvfrom] = "nrecvfrom";
721 syscall_table[SYS_nrecvmsg] = "nrecvmsg";
724 syscall_table[SYS_nsendmsg] = "nsendmsg";
726 #ifdef SYS_ntp_adjtime
727 syscall_table[SYS_ntp_adjtime] = "ntp_adjtime";
729 #ifdef SYS_ntp_gettime
730 syscall_table[SYS_ntp_gettime] = "ntp_gettime";
733 syscall_table[SYS_nuname] = "nuname";
736 syscall_table[SYS_obreak] = "obreak";
738 #ifdef SYS_old_accept
739 syscall_table[SYS_old_accept] = "old_accept";
742 syscall_table[SYS_old_fstat] = "old_fstat";
744 #ifdef SYS_old_getpeername
745 syscall_table[SYS_old_getpeername] = "old_getpeername";
747 #ifdef SYS_old_getpgrp
748 syscall_table[SYS_old_getpgrp] = "old_getpgrp";
750 #ifdef SYS_old_getsockname
751 syscall_table[SYS_old_getsockname] = "old_getsockname";
753 #ifdef SYS_old_killpg
754 syscall_table[SYS_old_killpg] = "old_killpg";
757 syscall_table[SYS_old_lstat] = "old_lstat";
760 syscall_table[SYS_old_recv] = "old_recv";
762 #ifdef SYS_old_recvfrom
763 syscall_table[SYS_old_recvfrom] = "old_recvfrom";
765 #ifdef SYS_old_recvmsg
766 syscall_table[SYS_old_recvmsg] = "old_recvmsg";
769 syscall_table[SYS_old_send] = "old_send";
771 #ifdef SYS_old_sendmsg
772 syscall_table[SYS_old_sendmsg] = "old_sendmsg";
774 #ifdef SYS_old_sigblock
775 syscall_table[SYS_old_sigblock] = "old_sigblock";
777 #ifdef SYS_old_sigsetmask
778 syscall_table[SYS_old_sigsetmask] = "old_sigsetmask";
780 #ifdef SYS_old_sigvec
781 syscall_table[SYS_old_sigvec] = "old_sigvec";
784 syscall_table[SYS_old_stat] = "old_stat";
786 #ifdef SYS_old_vhangup
787 syscall_table[SYS_old_vhangup] = "old_vhangup";
790 syscall_table[SYS_old_wait] = "old_wait";
793 syscall_table[SYS_oldquota] = "oldquota";
796 syscall_table[SYS_online] = "online";
799 syscall_table[SYS_open] = "open";
802 syscall_table[SYS_open64] = "open64";
805 syscall_table[SYS_ovadvise] = "ovadvise";
808 syscall_table[SYS_p_online] = "p_online";
811 syscall_table[SYS_pagelock] = "pagelock";
814 syscall_table[SYS_pathconf] = "pathconf";
817 syscall_table[SYS_pause] = "pause";
820 syscall_table[SYS_pgrpsys] = "pgrpsys";
823 syscall_table[SYS_pid_block] = "pid_block";
825 #ifdef SYS_pid_unblock
826 syscall_table[SYS_pid_unblock] = "pid_unblock";
829 syscall_table[SYS_pipe] = "pipe";
832 syscall_table[SYS_plock] = "plock";
835 syscall_table[SYS_poll] = "poll";
838 syscall_table[SYS_prctl] = "prctl";
841 syscall_table[SYS_pread] = "pread";
844 syscall_table[SYS_pread64] = "pread64";
847 syscall_table[SYS_pread64] = "pread64";
850 syscall_table[SYS_prepblock] = "prepblock";
853 syscall_table[SYS_priocntl] = "priocntl";
855 #ifdef SYS_priocntllst
856 syscall_table[SYS_priocntllst] = "priocntllst";
858 #ifdef SYS_priocntlset
859 syscall_table[SYS_priocntlset] = "priocntlset";
861 #ifdef SYS_priocntlsys
862 syscall_table[SYS_priocntlsys] = "priocntlsys";
865 syscall_table[SYS_procblk] = "procblk";
867 #ifdef SYS_processor_bind
868 syscall_table[SYS_processor_bind] = "processor_bind";
870 #ifdef SYS_processor_exbind
871 syscall_table[SYS_processor_exbind] = "processor_exbind";
873 #ifdef SYS_processor_info
874 syscall_table[SYS_processor_info] = "processor_info";
877 syscall_table[SYS_procpriv] = "procpriv";
880 syscall_table[SYS_profil] = "profil";
882 #ifdef SYS_proplist_syscall
883 syscall_table[SYS_proplist_syscall] = "proplist_syscall";
886 syscall_table[SYS_pset] = "pset";
889 syscall_table[SYS_ptrace] = "ptrace";
892 syscall_table[SYS_putmsg] = "putmsg";
895 syscall_table[SYS_putpmsg] = "putpmsg";
898 syscall_table[SYS_pwrite] = "pwrite";
901 syscall_table[SYS_pwrite64] = "pwrite64";
904 syscall_table[SYS_quotactl] = "quotactl";
907 syscall_table[SYS_rdblock] = "rdblock";
910 syscall_table[SYS_read] = "read";
913 syscall_table[SYS_readlink] = "readlink";
916 syscall_table[SYS_readv] = "readv";
919 syscall_table[SYS_reboot] = "reboot";
922 syscall_table[SYS_recv] = "recv";
925 syscall_table[SYS_recvfrom] = "recvfrom";
928 syscall_table[SYS_recvmsg] = "recvmsg";
931 syscall_table[SYS_rename] = "rename";
933 #ifdef SYS_resolvepath
934 syscall_table[SYS_resolvepath] = "resolvepath";
937 syscall_table[SYS_revoke] = "revoke";
940 syscall_table[SYS_rfsys] = "rfsys";
943 syscall_table[SYS_rmdir] = "rmdir";
946 syscall_table[SYS_rpcsys] = "rpcsys";
949 syscall_table[SYS_sbrk] = "sbrk";
952 syscall_table[SYS_schedctl] = "schedctl";
955 syscall_table[SYS_secadvise] = "secadvise";
958 syscall_table[SYS_secsys] = "secsys";
961 syscall_table[SYS_security] = "security";
964 syscall_table[SYS_select] = "select";
967 syscall_table[SYS_semctl] = "semctl";
970 syscall_table[SYS_semget] = "semget";
973 syscall_table[SYS_semop] = "semop";
976 syscall_table[SYS_semsys] = "semsys";
979 syscall_table[SYS_send] = "send";
982 syscall_table[SYS_sendmsg] = "sendmsg";
985 syscall_table[SYS_sendto] = "sendto";
987 #ifdef SYS_set_program_attributes
988 syscall_table[SYS_set_program_attributes] = "set_program_attributes";
990 #ifdef SYS_set_speculative
991 syscall_table[SYS_set_speculative] = "set_speculative";
993 #ifdef SYS_set_sysinfo
994 syscall_table[SYS_set_sysinfo] = "set_sysinfo";
996 #ifdef SYS_setcontext
997 syscall_table[SYS_setcontext] = "setcontext";
999 #ifdef SYS_setdomainname
1000 syscall_table[SYS_setdomainname] = "setdomainname";
1003 syscall_table[SYS_setegid] = "setegid";
1006 syscall_table[SYS_seteuid] = "seteuid";
1009 syscall_table[SYS_setgid] = "setgid";
1011 #ifdef SYS_setgroups
1012 syscall_table[SYS_setgroups] = "setgroups";
1014 #ifdef SYS_sethostid
1015 syscall_table[SYS_sethostid] = "sethostid";
1017 #ifdef SYS_sethostname
1018 syscall_table[SYS_sethostname] = "sethostname";
1020 #ifdef SYS_setitimer
1021 syscall_table[SYS_setitimer] = "setitimer";
1024 syscall_table[SYS_setlogin] = "setlogin";
1027 syscall_table[SYS_setpgid] = "setpgid";
1030 syscall_table[SYS_setpgrp] = "setpgrp";
1032 #ifdef SYS_setpriority
1033 syscall_table[SYS_setpriority] = "setpriority";
1036 syscall_table[SYS_setregid] = "setregid";
1039 syscall_table[SYS_setreuid] = "setreuid";
1041 #ifdef SYS_setrlimit
1042 syscall_table[SYS_setrlimit] = "setrlimit";
1044 #ifdef SYS_setrlimit64
1045 syscall_table[SYS_setrlimit64] = "setrlimit64";
1048 syscall_table[SYS_setsid] = "setsid";
1050 #ifdef SYS_setsockopt
1051 syscall_table[SYS_setsockopt] = "setsockopt";
1053 #ifdef SYS_settimeofday
1054 syscall_table[SYS_settimeofday] = "settimeofday";
1057 syscall_table[SYS_setuid] = "setuid";
1060 syscall_table[SYS_sgi] = "sgi";
1062 #ifdef SYS_sgifastpath
1063 syscall_table[SYS_sgifastpath] = "sgifastpath";
1066 syscall_table[SYS_sgikopt] = "sgikopt";
1069 syscall_table[SYS_sginap] = "sginap";
1072 syscall_table[SYS_shmat] = "shmat";
1075 syscall_table[SYS_shmctl] = "shmctl";
1078 syscall_table[SYS_shmdt] = "shmdt";
1081 syscall_table[SYS_shmget] = "shmget";
1084 syscall_table[SYS_shmsys] = "shmsys";
1087 syscall_table[SYS_shutdown] = "shutdown";
1089 #ifdef SYS_sigaction
1090 syscall_table[SYS_sigaction] = "sigaction";
1092 #ifdef SYS_sigaltstack
1093 syscall_table[SYS_sigaltstack] = "sigaltstack";
1095 #ifdef SYS_sigaltstack
1096 syscall_table[SYS_sigaltstack] = "sigaltstack";
1099 syscall_table[SYS_sigblock] = "sigblock";
1102 syscall_table[SYS_signal] = "signal";
1104 #ifdef SYS_signotify
1105 syscall_table[SYS_signotify] = "signotify";
1107 #ifdef SYS_signotifywait
1108 syscall_table[SYS_signotifywait] = "signotifywait";
1110 #ifdef SYS_sigpending
1111 syscall_table[SYS_sigpending] = "sigpending";
1114 syscall_table[SYS_sigpoll] = "sigpoll";
1116 #ifdef SYS_sigprocmask
1117 syscall_table[SYS_sigprocmask] = "sigprocmask";
1120 syscall_table[SYS_sigqueue] = "sigqueue";
1122 #ifdef SYS_sigreturn
1123 syscall_table[SYS_sigreturn] = "sigreturn";
1125 #ifdef SYS_sigsendset
1126 syscall_table[SYS_sigsendset] = "sigsendset";
1128 #ifdef SYS_sigsendsys
1129 syscall_table[SYS_sigsendsys] = "sigsendsys";
1131 #ifdef SYS_sigsetmask
1132 syscall_table[SYS_sigsetmask] = "sigsetmask";
1135 syscall_table[SYS_sigstack] = "sigstack";
1137 #ifdef SYS_sigsuspend
1138 syscall_table[SYS_sigsuspend] = "sigsuspend";
1141 syscall_table[SYS_sigvec] = "sigvec";
1144 syscall_table[SYS_sigwait] = "sigwait";
1146 #ifdef SYS_sigwaitprim
1147 syscall_table[SYS_sigwaitprim] = "sigwaitprim";
1150 syscall_table[SYS_sleep] = "sleep";
1152 #ifdef SYS_so_socket
1153 syscall_table[SYS_so_socket] = "so_socket";
1155 #ifdef SYS_so_socketpair
1156 syscall_table[SYS_so_socketpair] = "so_socketpair";
1158 #ifdef SYS_sockconfig
1159 syscall_table[SYS_sockconfig] = "sockconfig";
1162 syscall_table[SYS_socket] = "socket";
1164 #ifdef SYS_socketpair
1165 syscall_table[SYS_socketpair] = "socketpair";
1168 syscall_table[SYS_sproc] = "sproc";
1171 syscall_table[SYS_sprocsp] = "sprocsp";
1174 syscall_table[SYS_sstk] = "sstk";
1177 syscall_table[SYS_stat] = "stat";
1180 syscall_table[SYS_stat64] = "stat64";
1183 syscall_table[SYS_statfs] = "statfs";
1186 syscall_table[SYS_statvfs] = "statvfs";
1188 #ifdef SYS_statvfs64
1189 syscall_table[SYS_statvfs64] = "statvfs64";
1192 syscall_table[SYS_stime] = "stime";
1195 syscall_table[SYS_stty] = "stty";
1197 #ifdef SYS_subsys_info
1198 syscall_table[SYS_subsys_info] = "subsys_info";
1201 syscall_table[SYS_swapctl] = "swapctl";
1204 syscall_table[SYS_swapon] = "swapon";
1207 syscall_table[SYS_symlink] = "symlink";
1210 syscall_table[SYS_sync] = "sync";
1213 syscall_table[SYS_sys3b] = "sys3b";
1216 syscall_table[SYS_syscall] = "syscall";
1218 #ifdef SYS_sysconfig
1219 syscall_table[SYS_sysconfig] = "sysconfig";
1222 syscall_table[SYS_sysfs] = "sysfs";
1225 syscall_table[SYS_sysi86] = "sysi86";
1228 syscall_table[SYS_sysinfo] = "sysinfo";
1231 syscall_table[SYS_sysmips] = "sysmips";
1234 syscall_table[SYS_syssun] = "syssun";
1236 #ifdef SYS_systeminfo
1237 syscall_table[SYS_systeminfo] = "systeminfo";
1240 syscall_table[SYS_table] = "table";
1243 syscall_table[SYS_time] = "time";
1245 #ifdef SYS_timedwait
1246 syscall_table[SYS_timedwait] = "timedwait";
1248 #ifdef SYS_timer_create
1249 syscall_table[SYS_timer_create] = "timer_create";
1251 #ifdef SYS_timer_delete
1252 syscall_table[SYS_timer_delete] = "timer_delete";
1254 #ifdef SYS_timer_getoverrun
1255 syscall_table[SYS_timer_getoverrun] = "timer_getoverrun";
1257 #ifdef SYS_timer_gettime
1258 syscall_table[SYS_timer_gettime] = "timer_gettime";
1260 #ifdef SYS_timer_settime
1261 syscall_table[SYS_timer_settime] = "timer_settime";
1264 syscall_table[SYS_times] = "times";
1267 syscall_table[SYS_truncate] = "truncate";
1269 #ifdef SYS_truncate64
1270 syscall_table[SYS_truncate64] = "truncate64";
1273 syscall_table[SYS_tsolsys] = "tsolsys";
1276 syscall_table[SYS_uadmin] = "uadmin";
1279 syscall_table[SYS_ulimit] = "ulimit";
1282 syscall_table[SYS_umask] = "umask";
1285 syscall_table[SYS_umount] = "umount";
1288 syscall_table[SYS_uname] = "uname";
1291 syscall_table[SYS_unblock] = "unblock";
1294 syscall_table[SYS_unlink] = "unlink";
1297 syscall_table[SYS_unmount] = "unmount";
1299 #ifdef SYS_usleep_thread
1300 syscall_table[SYS_usleep_thread] = "usleep_thread";
1303 syscall_table[SYS_uswitch] = "uswitch";
1305 #ifdef SYS_utc_adjtime
1306 syscall_table[SYS_utc_adjtime] = "utc_adjtime";
1308 #ifdef SYS_utc_gettime
1309 syscall_table[SYS_utc_gettime] = "utc_gettime";
1312 syscall_table[SYS_utime] = "utime";
1315 syscall_table[SYS_utimes] = "utimes";
1318 syscall_table[SYS_utssys] = "utssys";
1321 syscall_table[SYS_vfork] = "vfork";
1324 syscall_table[SYS_vhangup] = "vhangup";
1327 syscall_table[SYS_vtrace] = "vtrace";
1330 syscall_table[SYS_wait] = "wait";
1333 syscall_table[SYS_waitid] = "waitid";
1336 syscall_table[SYS_waitsys] = "waitsys";
1339 syscall_table[SYS_write] = "write";
1342 syscall_table[SYS_writev] = "writev";
1345 syscall_table[SYS_xenix] = "xenix";
1348 syscall_table[SYS_xmknod] = "xmknod";
1351 syscall_table[SYS_xstat] = "xstat";
1354 syscall_table[SYS_yield] = "yield";
1358 /* Prettyprint syscall NUM. */
1361 proc_prettyfprint_syscall (FILE *file, int num, int verbose)
1363 if (syscall_table[num])
1364 fprintf (file, "SYS_%s ", syscall_table[num]);
1366 fprintf (file, "<Unknown syscall %d> ", num);
1370 proc_prettyprint_syscall (int num, int verbose)
1372 proc_prettyfprint_syscall (stdout, num, verbose);
1375 /* Prettyprint all syscalls in SYSSET. */
1378 proc_prettyfprint_syscalls (FILE *file, sysset_t *sysset, int verbose)
1382 for (i = 0; i < MAX_SYSCALLS; i++)
1383 if (prismember (sysset, i))
1385 proc_prettyfprint_syscall (file, i, verbose);
1387 fprintf (file, "\n");
1391 proc_prettyprint_syscalls (sysset_t *sysset, int verbose)
1393 proc_prettyfprint_syscalls (stdout, sysset, verbose);
1396 /* Prettyprint signals. */
1398 /* Signal translation table, ordered ANSI-standard signals first,
1399 other signals second, with signals in each block ordered by their
1400 numerical values on a typical POSIX platform. */
1402 static struct trans signal_table[] =
1404 { 0, "<no signal>", "no signal" },
1406 /* SIGINT, SIGILL, SIGABRT, SIGFPE, SIGSEGV and SIGTERM
1407 are ANSI-standard signals and are always available. */
1409 { SIGINT, "SIGINT", "Interrupt (rubout)" },
1410 { SIGILL, "SIGILL", "Illegal instruction" }, /* not reset when caught */
1411 { SIGABRT, "SIGABRT", "used by abort()" }, /* replaces SIGIOT */
1412 { SIGFPE, "SIGFPE", "Floating point exception" },
1413 { SIGSEGV, "SIGSEGV", "Segmentation violation" },
1414 { SIGTERM, "SIGTERM", "Software termination signal from kill" },
1416 /* All other signals need preprocessor conditionals. */
1419 { SIGHUP, "SIGHUP", "Hangup" },
1422 { SIGQUIT, "SIGQUIT", "Quit (ASCII FS)" },
1425 { SIGTRAP, "SIGTRAP", "Trace trap" }, /* not reset when caught */
1428 { SIGIOT, "SIGIOT", "IOT instruction" },
1431 { SIGEMT, "SIGEMT", "EMT instruction" },
1434 { SIGKILL, "SIGKILL", "Kill" }, /* Solaris: cannot be caught/ignored */
1437 { SIGBUS, "SIGBUS", "Bus error" },
1440 { SIGSYS, "SIGSYS", "Bad argument to system call" },
1443 { SIGPIPE, "SIGPIPE", "Write to pipe with no one to read it" },
1446 { SIGALRM, "SIGALRM", "Alarm clock" },
1449 { SIGUSR1, "SIGUSR1", "User defined signal 1" },
1452 { SIGUSR2, "SIGUSR2", "User defined signal 2" },
1455 { SIGCHLD, "SIGCHLD", "Child status changed" }, /* Posix version */
1458 { SIGCLD, "SIGCLD", "Child status changed" }, /* Solaris version */
1461 { SIGPWR, "SIGPWR", "Power-fail restart" },
1464 { SIGWINCH, "SIGWINCH", "Window size change" },
1467 { SIGURG, "SIGURG", "Urgent socket condition" },
1470 { SIGPOLL, "SIGPOLL", "Pollable event" },
1473 { SIGIO, "SIGIO", "Socket I/O possible" }, /* alias for SIGPOLL */
1476 { SIGSTOP, "SIGSTOP", "Stop, not from tty" }, /* cannot be caught or
1480 { SIGTSTP, "SIGTSTP", "User stop from tty" },
1483 { SIGCONT, "SIGCONT", "Stopped process has been continued" },
1486 { SIGTTIN, "SIGTTIN", "Background tty read attempted" },
1489 { SIGTTOU, "SIGTTOU", "Background tty write attempted" },
1492 { SIGVTALRM, "SIGVTALRM", "Virtual timer expired" },
1495 { SIGPROF, "SIGPROF", "Profiling timer expired" },
1498 { SIGXCPU, "SIGXCPU", "Exceeded CPU limit" },
1501 { SIGXFSZ, "SIGXFSZ", "Exceeded file size limit" },
1504 { SIGWAITING, "SIGWAITING", "Process's LWPs are blocked" },
1507 { SIGLWP, "SIGLWP", "Used by thread library" },
1510 { SIGFREEZE, "SIGFREEZE", "Used by CPR" },
1513 { SIGTHAW, "SIGTHAW", "Used by CPR" },
1516 { SIGCANCEL, "SIGCANCEL", "Used by libthread" },
1519 { SIGLOST, "SIGLOST", "Resource lost" },
1522 { SIG32, "SIG32", "Reserved for kernel usage (Irix)" },
1525 { SIGPTINTR, "SIGPTINTR", "Posix 1003.1b" },
1528 { SIGTRESCHED, "SIGTRESCHED", "Posix 1003.1b" },
1531 { SIGINFO, "SIGINFO", "Information request" },
1534 { SIGRESV, "SIGRESV", "Reserved by Digital for future use" },
1537 { SIGAIO, "SIGAIO", "Asynchronous I/O signal" },
1540 { SIGLIBRT, "SIGLIBRT", "Used by librt" },
1543 /* FIXME: add real-time signals. */
1546 /* Prettyprint signal number SIGNO. */
1549 proc_prettyfprint_signal (FILE *file, int signo, int verbose)
1553 for (i = 0; i < sizeof (signal_table) / sizeof (signal_table[0]); i++)
1554 if (signo == signal_table[i].value)
1556 fprintf (file, "%s", signal_table[i].name);
1558 fprintf (file, ": %s\n", signal_table[i].desc);
1560 fprintf (file, " ");
1563 fprintf (file, "Unknown signal %d%c", signo, verbose ? '\n' : ' ');
1567 proc_prettyprint_signal (int signo, int verbose)
1569 proc_prettyfprint_signal (stdout, signo, verbose);
1572 /* Prettyprint all signals in SIGSET. */
1575 proc_prettyfprint_signalset (FILE *file, sigset_t *sigset, int verbose)
1579 /* Loop over all signal numbers from 0 to NSIG, using them as the
1580 index to prismember. The signal table had better not contain
1581 aliases, for if it does they will both be printed. */
1583 for (i = 0; i < NSIG; i++)
1584 if (prismember (sigset, i))
1585 proc_prettyfprint_signal (file, i, verbose);
1588 fprintf (file, "\n");
1592 proc_prettyprint_signalset (sigset_t *sigset, int verbose)
1594 proc_prettyfprint_signalset (stdout, sigset, verbose);
1598 /* Prettyprint faults. */
1600 /* Fault translation table. */
1602 static struct trans fault_table[] =
1605 { FLTILL, "FLTILL", "Illegal instruction" },
1608 { FLTPRIV, "FLTPRIV", "Privileged instruction" },
1611 { FLTBPT, "FLTBPT", "Breakpoint trap" },
1614 { FLTTRACE, "FLTTRACE", "Trace trap" },
1617 { FLTACCESS, "FLTACCESS", "Memory access fault" },
1620 { FLTBOUNDS, "FLTBOUNDS", "Memory bounds violation" },
1623 { FLTIOVF, "FLTIOVF", "Integer overflow" },
1626 { FLTIZDIV, "FLTIZDIV", "Integer zero divide" },
1629 { FLTFPE, "FLTFPE", "Floating-point exception" },
1632 { FLTSTACK, "FLTSTACK", "Unrecoverable stack fault" },
1635 { FLTPAGE, "FLTPAGE", "Recoverable page fault" },
1638 { FLTPCINVAL, "FLTPCINVAL", "Invalid PC exception" },
1641 { FLTWATCH, "FLTWATCH", "User watchpoint" },
1644 { FLTKWATCH, "FLTKWATCH", "Kernel watchpoint" },
1647 { FLTSCWATCH, "FLTSCWATCH", "Hit a store conditional on a watched page" },
1651 /* Work horse. Accepts an index into the fault table, prints it
1655 prettyfprint_faulttable_entry (FILE *file, int i, int verbose)
1657 fprintf (file, "%s", fault_table[i].name);
1659 fprintf (file, ": %s\n", fault_table[i].desc);
1661 fprintf (file, " ");
1664 /* Prettyprint hardware fault number FAULTNO. */
1667 proc_prettyfprint_fault (FILE *file, int faultno, int verbose)
1671 for (i = 0; i < ARRAY_SIZE (fault_table); i++)
1672 if (faultno == fault_table[i].value)
1674 prettyfprint_faulttable_entry (file, i, verbose);
1678 fprintf (file, "Unknown hardware fault %d%c",
1679 faultno, verbose ? '\n' : ' ');
1683 proc_prettyprint_fault (int faultno, int verbose)
1685 proc_prettyfprint_fault (stdout, faultno, verbose);
1688 /* Prettyprint all faults in FLTSET. */
1691 proc_prettyfprint_faultset (FILE *file, fltset_t *fltset, int verbose)
1695 /* Loop through the fault table, using the value field as the index
1696 to prismember. The fault table had better not contain aliases,
1697 for if it does they will both be printed. */
1699 for (i = 0; i < ARRAY_SIZE (fault_table); i++)
1700 if (prismember (fltset, fault_table[i].value))
1701 prettyfprint_faulttable_entry (file, i, verbose);
1704 fprintf (file, "\n");
1708 proc_prettyprint_faultset (fltset_t *fltset, int verbose)
1710 proc_prettyfprint_faultset (stdout, fltset, verbose);
1713 /* TODO: actions, holds... */
1716 proc_prettyprint_actionset (struct sigaction *actions, int verbose)
1721 /* Provide a prototype to silence -Wmissing-prototypes. */
1722 void _initialize_proc_events (void);
1725 _initialize_proc_events (void)
1727 init_syscall_table ();