1 /* Machine-independent support for SVR4 /proc (process file system)
3 Copyright (C) 1999, 2000, 2004, 2007, 2008, 2009
4 Free Software Foundation, Inc.
6 Written by Michael Snyder at Cygnus Solutions.
7 Based on work by Fred Fish, Stu Grossman, Geoff Noer, and others.
9 This program is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 3 of the License, or
12 (at your option) any later version.
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
19 You should have received a copy of the GNU General Public License
20 along with this program. If not, see <http://www.gnu.org/licenses/>. */
22 /* Pretty-print "events of interest".
24 This module includes pretty-print routines for:
25 * faults (hardware exceptions)
26 * signals (software interrupts)
29 FIXME: At present, the syscall translation table must be
30 initialized, which is not true of the other translation tables. */
35 #define _STRUCTURED_PROC 1
39 #include <sys/types.h>
40 #include <sys/procfs.h>
41 #ifdef HAVE_SYS_SYSCALL_H
42 #include <sys/syscall.h>
44 #ifdef HAVE_SYS_FAULT_H
45 #include <sys/fault.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 /* Ugh -- UnixWare and Solaris spell these differently! */
67 #define SYS_lwp_create SYS_lwpcreate
71 #define SYS_lwp_exit SYS_lwpexit
75 #define SYS_lwp_wait SYS_lwpwait
79 #define SYS_lwp_self SYS_lwpself
83 #define SYS_lwp_info SYS_lwpinfo
87 #define SYS_lwp_private SYS_lwpprivate
91 #define SYS_lwp_kill SYS_lwpkill
95 #define SYS_lwp_suspend SYS_lwpsuspend
98 #ifdef SYS_lwpcontinue
99 #define SYS_lwp_continue SYS_lwpcontinue
103 /* Syscall translation table. */
105 #define MAX_SYSCALLS 262 /* Pretty arbitrary. */
106 static char *syscall_table[MAX_SYSCALLS];
109 init_syscall_table (void)
111 #ifdef SYS_BSD_getime
112 syscall_table[SYS_BSD_getime] = "BSD_getime";
114 #ifdef SYS_BSDgetpgrp
115 syscall_table[SYS_BSDgetpgrp] = "BSDgetpgrp";
117 #ifdef SYS_BSDsetpgrp
118 syscall_table[SYS_BSDsetpgrp] = "BSDsetpgrp";
121 syscall_table[SYS_acancel] = "acancel";
124 syscall_table[SYS_accept] = "accept";
127 syscall_table[SYS_access] = "access";
130 syscall_table[SYS_acct] = "acct";
133 syscall_table[SYS_acl] = "acl";
136 syscall_table[SYS_aclipc] = "aclipc";
139 syscall_table[SYS_adjtime] = "adjtime";
141 #ifdef SYS_afs_syscall
142 syscall_table[SYS_afs_syscall] = "afs_syscall";
145 syscall_table[SYS_alarm] = "alarm";
148 syscall_table[SYS_alt_plock] = "alt_plock";
150 #ifdef SYS_alt_sigpending
151 syscall_table[SYS_alt_sigpending] = "alt_sigpending";
154 syscall_table[SYS_async] = "async";
156 #ifdef SYS_async_daemon
157 syscall_table[SYS_async_daemon] = "async_daemon";
160 syscall_table[SYS_audcntl] = "audcntl";
163 syscall_table[SYS_audgen] = "audgen";
166 syscall_table[SYS_auditbuf] = "auditbuf";
169 syscall_table[SYS_auditctl] = "auditctl";
172 syscall_table[SYS_auditdmp] = "auditdmp";
175 syscall_table[SYS_auditevt] = "auditevt";
178 syscall_table[SYS_auditlog] = "auditlog";
181 syscall_table[SYS_auditsys] = "auditsys";
184 syscall_table[SYS_bind] = "bind";
187 syscall_table[SYS_block] = "block";
190 syscall_table[SYS_brk] = "brk";
193 syscall_table[SYS_cachectl] = "cachectl";
195 #ifdef SYS_cacheflush
196 syscall_table[SYS_cacheflush] = "cacheflush";
198 #ifdef SYS_cancelblock
199 syscall_table[SYS_cancelblock] = "cancelblock";
202 syscall_table[SYS_cg_bind] = "cg_bind";
204 #ifdef SYS_cg_current
205 syscall_table[SYS_cg_current] = "cg_current";
208 syscall_table[SYS_cg_ids] = "cg_ids";
211 syscall_table[SYS_cg_info] = "cg_info";
214 syscall_table[SYS_cg_memloc] = "cg_memloc";
216 #ifdef SYS_cg_processors
217 syscall_table[SYS_cg_processors] = "cg_processors";
220 syscall_table[SYS_chdir] = "chdir";
223 syscall_table[SYS_chflags] = "chflags";
226 syscall_table[SYS_chmod] = "chmod";
229 syscall_table[SYS_chown] = "chown";
232 syscall_table[SYS_chroot] = "chroot";
235 syscall_table[SYS_clocal] = "clocal";
237 #ifdef SYS_clock_getres
238 syscall_table[SYS_clock_getres] = "clock_getres";
240 #ifdef SYS_clock_gettime
241 syscall_table[SYS_clock_gettime] = "clock_gettime";
243 #ifdef SYS_clock_settime
244 syscall_table[SYS_clock_settime] = "clock_settime";
247 syscall_table[SYS_close] = "close";
250 syscall_table[SYS_connect] = "connect";
253 syscall_table[SYS_context] = "context";
256 syscall_table[SYS_creat] = "creat";
259 syscall_table[SYS_creat64] = "creat64";
262 syscall_table[SYS_devstat] = "devstat";
265 syscall_table[SYS_dmi] = "dmi";
268 syscall_table[SYS_door] = "door";
271 syscall_table[SYS_dshmsys] = "dshmsys";
274 syscall_table[SYS_dup] = "dup";
277 syscall_table[SYS_dup2] = "dup2";
280 syscall_table[SYS_evsys] = "evsys";
283 syscall_table[SYS_evtrapret] = "evtrapret";
286 syscall_table[SYS_exec] = "exec";
288 #ifdef SYS_exec_with_loader
289 syscall_table[SYS_exec_with_loader] = "exec_with_loader";
292 syscall_table[SYS_execv] = "execv";
295 syscall_table[SYS_execve] = "execve";
298 syscall_table[SYS_exit] = "exit";
301 syscall_table[SYS_exportfs] = "exportfs";
304 syscall_table[SYS_facl] = "facl";
307 syscall_table[SYS_fchdir] = "fchdir";
310 syscall_table[SYS_fchflags] = "fchflags";
313 syscall_table[SYS_fchmod] = "fchmod";
316 syscall_table[SYS_fchown] = "fchown";
319 syscall_table[SYS_fchroot] = "fchroot";
322 syscall_table[SYS_fcntl] = "fcntl";
325 syscall_table[SYS_fdatasync] = "fdatasync";
328 syscall_table[SYS_fdevstat] = "fdevstat";
331 syscall_table[SYS_fdsync] = "fdsync";
334 syscall_table[SYS_filepriv] = "filepriv";
337 syscall_table[SYS_flock] = "flock";
340 syscall_table[SYS_flvlfile] = "flvlfile";
343 syscall_table[SYS_fork] = "fork";
346 syscall_table[SYS_fork1] = "fork1";
349 syscall_table[SYS_forkall] = "forkall";
352 syscall_table[SYS_fpathconf] = "fpathconf";
355 syscall_table[SYS_fstat] = "fstat";
358 syscall_table[SYS_fstat64] = "fstat64";
361 syscall_table[SYS_fstatfs] = "fstatfs";
364 syscall_table[SYS_fstatvfs] = "fstatvfs";
366 #ifdef SYS_fstatvfs64
367 syscall_table[SYS_fstatvfs64] = "fstatvfs64";
370 syscall_table[SYS_fsync] = "fsync";
373 syscall_table[SYS_ftruncate] = "ftruncate";
375 #ifdef SYS_ftruncate64
376 syscall_table[SYS_ftruncate64] = "ftruncate64";
379 syscall_table[SYS_fuser] = "fuser";
382 syscall_table[SYS_fxstat] = "fxstat";
384 #ifdef SYS_get_sysinfo
385 syscall_table[SYS_get_sysinfo] = "get_sysinfo";
387 #ifdef SYS_getaddressconf
388 syscall_table[SYS_getaddressconf] = "getaddressconf";
390 #ifdef SYS_getcontext
391 syscall_table[SYS_getcontext] = "getcontext";
394 syscall_table[SYS_getdents] = "getdents";
396 #ifdef SYS_getdents64
397 syscall_table[SYS_getdents64] = "getdents64";
399 #ifdef SYS_getdirentries
400 syscall_table[SYS_getdirentries] = "getdirentries";
402 #ifdef SYS_getdomainname
403 syscall_table[SYS_getdomainname] = "getdomainname";
405 #ifdef SYS_getdtablesize
406 syscall_table[SYS_getdtablesize] = "getdtablesize";
409 syscall_table[SYS_getfh] = "getfh";
412 syscall_table[SYS_getfsstat] = "getfsstat";
415 syscall_table[SYS_getgid] = "getgid";
418 syscall_table[SYS_getgroups] = "getgroups";
421 syscall_table[SYS_gethostid] = "gethostid";
423 #ifdef SYS_gethostname
424 syscall_table[SYS_gethostname] = "gethostname";
427 syscall_table[SYS_getitimer] = "getitimer";
430 syscall_table[SYS_getksym] = "getksym";
433 syscall_table[SYS_getlogin] = "getlogin";
436 syscall_table[SYS_getmnt] = "getmnt";
439 syscall_table[SYS_getmsg] = "getmsg";
441 #ifdef SYS_getpagesize
442 syscall_table[SYS_getpagesize] = "getpagesize";
444 #ifdef SYS_getpeername
445 syscall_table[SYS_getpeername] = "getpeername";
448 syscall_table[SYS_getpgid] = "getpgid";
451 syscall_table[SYS_getpgrp] = "getpgrp";
454 syscall_table[SYS_getpid] = "getpid";
457 syscall_table[SYS_getpmsg] = "getpmsg";
459 #ifdef SYS_getpriority
460 syscall_table[SYS_getpriority] = "getpriority";
463 syscall_table[SYS_getrlimit] = "getrlimit";
465 #ifdef SYS_getrlimit64
466 syscall_table[SYS_getrlimit64] = "getrlimit64";
469 syscall_table[SYS_getrusage] = "getrusage";
472 syscall_table[SYS_getsid] = "getsid";
474 #ifdef SYS_getsockname
475 syscall_table[SYS_getsockname] = "getsockname";
477 #ifdef SYS_getsockopt
478 syscall_table[SYS_getsockopt] = "getsockopt";
480 #ifdef SYS_gettimeofday
481 syscall_table[SYS_gettimeofday] = "gettimeofday";
484 syscall_table[SYS_getuid] = "getuid";
487 syscall_table[SYS_gtty] = "gtty";
490 syscall_table[SYS_hrtsys] = "hrtsys";
493 syscall_table[SYS_inst_sync] = "inst_sync";
495 #ifdef SYS_install_utrap
496 syscall_table[SYS_install_utrap] = "install_utrap";
499 syscall_table[SYS_invlpg] = "invlpg";
502 syscall_table[SYS_ioctl] = "ioctl";
505 syscall_table[SYS_kaio] = "kaio";
508 syscall_table[SYS_keyctl] = "keyctl";
511 syscall_table[SYS_kill] = "kill";
514 syscall_table[SYS_killpg] = "killpg";
517 syscall_table[SYS_kloadcall] = "kloadcall";
520 syscall_table[SYS_kmodcall] = "kmodcall";
522 #ifdef SYS_ksigaction
523 syscall_table[SYS_ksigaction] = "ksigaction";
525 #ifdef SYS_ksigprocmask
526 syscall_table[SYS_ksigprocmask] = "ksigprocmask";
529 syscall_table[SYS_ksigqueue] = "ksigqueue";
532 syscall_table[SYS_lchown] = "lchown";
535 syscall_table[SYS_link] = "link";
538 syscall_table[SYS_listen] = "listen";
541 syscall_table[SYS_llseek] = "llseek";
544 syscall_table[SYS_lseek] = "lseek";
547 syscall_table[SYS_lseek64] = "lseek64";
550 syscall_table[SYS_lstat] = "lstat";
553 syscall_table[SYS_lstat64] = "lstat64";
556 syscall_table[SYS_lvldom] = "lvldom";
559 syscall_table[SYS_lvlequal] = "lvlequal";
562 syscall_table[SYS_lvlfile] = "lvlfile";
565 syscall_table[SYS_lvlipc] = "lvlipc";
568 syscall_table[SYS_lvlproc] = "lvlproc";
571 syscall_table[SYS_lvlvfs] = "lvlvfs";
574 syscall_table[SYS_lwp_alarm] = "lwp_alarm";
576 #ifdef SYS_lwp_cond_broadcast
577 syscall_table[SYS_lwp_cond_broadcast] = "lwp_cond_broadcast";
579 #ifdef SYS_lwp_cond_signal
580 syscall_table[SYS_lwp_cond_signal] = "lwp_cond_signal";
582 #ifdef SYS_lwp_cond_wait
583 syscall_table[SYS_lwp_cond_wait] = "lwp_cond_wait";
585 #ifdef SYS_lwp_continue
586 syscall_table[SYS_lwp_continue] = "lwp_continue";
588 #ifdef SYS_lwp_create
589 syscall_table[SYS_lwp_create] = "lwp_create";
592 syscall_table[SYS_lwp_exit] = "lwp_exit";
594 #ifdef SYS_lwp_getprivate
595 syscall_table[SYS_lwp_getprivate] = "lwp_getprivate";
598 syscall_table[SYS_lwp_info] = "lwp_info";
601 syscall_table[SYS_lwp_kill] = "lwp_kill";
603 #ifdef SYS_lwp_mutex_init
604 syscall_table[SYS_lwp_mutex_init] = "lwp_mutex_init";
606 #ifdef SYS_lwp_mutex_lock
607 syscall_table[SYS_lwp_mutex_lock] = "lwp_mutex_lock";
609 #ifdef SYS_lwp_mutex_trylock
610 syscall_table[SYS_lwp_mutex_trylock] = "lwp_mutex_trylock";
612 #ifdef SYS_lwp_mutex_unlock
613 syscall_table[SYS_lwp_mutex_unlock] = "lwp_mutex_unlock";
615 #ifdef SYS_lwp_private
616 syscall_table[SYS_lwp_private] = "lwp_private";
619 syscall_table[SYS_lwp_self] = "lwp_self";
621 #ifdef SYS_lwp_sema_post
622 syscall_table[SYS_lwp_sema_post] = "lwp_sema_post";
624 #ifdef SYS_lwp_sema_trywait
625 syscall_table[SYS_lwp_sema_trywait] = "lwp_sema_trywait";
627 #ifdef SYS_lwp_sema_wait
628 syscall_table[SYS_lwp_sema_wait] = "lwp_sema_wait";
630 #ifdef SYS_lwp_setprivate
631 syscall_table[SYS_lwp_setprivate] = "lwp_setprivate";
633 #ifdef SYS_lwp_sigredirect
634 syscall_table[SYS_lwp_sigredirect] = "lwp_sigredirect";
636 #ifdef SYS_lwp_suspend
637 syscall_table[SYS_lwp_suspend] = "lwp_suspend";
640 syscall_table[SYS_lwp_wait] = "lwp_wait";
643 syscall_table[SYS_lxstat] = "lxstat";
646 syscall_table[SYS_madvise] = "madvise";
649 syscall_table[SYS_memcntl] = "memcntl";
652 syscall_table[SYS_mincore] = "mincore";
655 syscall_table[SYS_mincore] = "mincore";
658 syscall_table[SYS_mkdir] = "mkdir";
661 syscall_table[SYS_mkmld] = "mkmld";
664 syscall_table[SYS_mknod] = "mknod";
667 syscall_table[SYS_mldmode] = "mldmode";
670 syscall_table[SYS_mmap] = "mmap";
673 syscall_table[SYS_mmap64] = "mmap64";
676 syscall_table[SYS_modadm] = "modadm";
679 syscall_table[SYS_modctl] = "modctl";
682 syscall_table[SYS_modload] = "modload";
685 syscall_table[SYS_modpath] = "modpath";
688 syscall_table[SYS_modstat] = "modstat";
691 syscall_table[SYS_moduload] = "moduload";
694 syscall_table[SYS_mount] = "mount";
697 syscall_table[SYS_mprotect] = "mprotect";
700 syscall_table[SYS_mremap] = "mremap";
702 #ifdef SYS_msfs_syscall
703 syscall_table[SYS_msfs_syscall] = "msfs_syscall";
706 syscall_table[SYS_msgctl] = "msgctl";
709 syscall_table[SYS_msgget] = "msgget";
712 syscall_table[SYS_msgrcv] = "msgrcv";
715 syscall_table[SYS_msgsnd] = "msgsnd";
718 syscall_table[SYS_msgsys] = "msgsys";
721 syscall_table[SYS_msleep] = "msleep";
724 syscall_table[SYS_msync] = "msync";
727 syscall_table[SYS_munmap] = "munmap";
730 syscall_table[SYS_mvalid] = "mvalid";
733 syscall_table[SYS_mwakeup] = "mwakeup";
736 syscall_table[SYS_naccept] = "naccept";
739 syscall_table[SYS_nanosleep] = "nanosleep";
742 syscall_table[SYS_nfssvc] = "nfssvc";
745 syscall_table[SYS_nfssys] = "nfssys";
747 #ifdef SYS_ngetpeername
748 syscall_table[SYS_ngetpeername] = "ngetpeername";
750 #ifdef SYS_ngetsockname
751 syscall_table[SYS_ngetsockname] = "ngetsockname";
754 syscall_table[SYS_nice] = "nice";
757 syscall_table[SYS_nrecvfrom] = "nrecvfrom";
760 syscall_table[SYS_nrecvmsg] = "nrecvmsg";
763 syscall_table[SYS_nsendmsg] = "nsendmsg";
765 #ifdef SYS_ntp_adjtime
766 syscall_table[SYS_ntp_adjtime] = "ntp_adjtime";
768 #ifdef SYS_ntp_gettime
769 syscall_table[SYS_ntp_gettime] = "ntp_gettime";
772 syscall_table[SYS_nuname] = "nuname";
775 syscall_table[SYS_obreak] = "obreak";
777 #ifdef SYS_old_accept
778 syscall_table[SYS_old_accept] = "old_accept";
781 syscall_table[SYS_old_fstat] = "old_fstat";
783 #ifdef SYS_old_getpeername
784 syscall_table[SYS_old_getpeername] = "old_getpeername";
786 #ifdef SYS_old_getpgrp
787 syscall_table[SYS_old_getpgrp] = "old_getpgrp";
789 #ifdef SYS_old_getsockname
790 syscall_table[SYS_old_getsockname] = "old_getsockname";
792 #ifdef SYS_old_killpg
793 syscall_table[SYS_old_killpg] = "old_killpg";
796 syscall_table[SYS_old_lstat] = "old_lstat";
799 syscall_table[SYS_old_recv] = "old_recv";
801 #ifdef SYS_old_recvfrom
802 syscall_table[SYS_old_recvfrom] = "old_recvfrom";
804 #ifdef SYS_old_recvmsg
805 syscall_table[SYS_old_recvmsg] = "old_recvmsg";
808 syscall_table[SYS_old_send] = "old_send";
810 #ifdef SYS_old_sendmsg
811 syscall_table[SYS_old_sendmsg] = "old_sendmsg";
813 #ifdef SYS_old_sigblock
814 syscall_table[SYS_old_sigblock] = "old_sigblock";
816 #ifdef SYS_old_sigsetmask
817 syscall_table[SYS_old_sigsetmask] = "old_sigsetmask";
819 #ifdef SYS_old_sigvec
820 syscall_table[SYS_old_sigvec] = "old_sigvec";
823 syscall_table[SYS_old_stat] = "old_stat";
825 #ifdef SYS_old_vhangup
826 syscall_table[SYS_old_vhangup] = "old_vhangup";
829 syscall_table[SYS_old_wait] = "old_wait";
832 syscall_table[SYS_oldquota] = "oldquota";
835 syscall_table[SYS_online] = "online";
838 syscall_table[SYS_open] = "open";
841 syscall_table[SYS_open64] = "open64";
844 syscall_table[SYS_ovadvise] = "ovadvise";
847 syscall_table[SYS_p_online] = "p_online";
850 syscall_table[SYS_pagelock] = "pagelock";
853 syscall_table[SYS_pathconf] = "pathconf";
856 syscall_table[SYS_pause] = "pause";
859 syscall_table[SYS_pgrpsys] = "pgrpsys";
862 syscall_table[SYS_pid_block] = "pid_block";
864 #ifdef SYS_pid_unblock
865 syscall_table[SYS_pid_unblock] = "pid_unblock";
868 syscall_table[SYS_pipe] = "pipe";
871 syscall_table[SYS_plock] = "plock";
874 syscall_table[SYS_poll] = "poll";
877 syscall_table[SYS_prctl] = "prctl";
880 syscall_table[SYS_pread] = "pread";
883 syscall_table[SYS_pread64] = "pread64";
886 syscall_table[SYS_pread64] = "pread64";
889 syscall_table[SYS_prepblock] = "prepblock";
892 syscall_table[SYS_priocntl] = "priocntl";
894 #ifdef SYS_priocntllst
895 syscall_table[SYS_priocntllst] = "priocntllst";
897 #ifdef SYS_priocntlset
898 syscall_table[SYS_priocntlset] = "priocntlset";
900 #ifdef SYS_priocntlsys
901 syscall_table[SYS_priocntlsys] = "priocntlsys";
904 syscall_table[SYS_procblk] = "procblk";
906 #ifdef SYS_processor_bind
907 syscall_table[SYS_processor_bind] = "processor_bind";
909 #ifdef SYS_processor_exbind
910 syscall_table[SYS_processor_exbind] = "processor_exbind";
912 #ifdef SYS_processor_info
913 syscall_table[SYS_processor_info] = "processor_info";
916 syscall_table[SYS_procpriv] = "procpriv";
919 syscall_table[SYS_profil] = "profil";
921 #ifdef SYS_proplist_syscall
922 syscall_table[SYS_proplist_syscall] = "proplist_syscall";
925 syscall_table[SYS_pset] = "pset";
928 syscall_table[SYS_ptrace] = "ptrace";
931 syscall_table[SYS_putmsg] = "putmsg";
934 syscall_table[SYS_putpmsg] = "putpmsg";
937 syscall_table[SYS_pwrite] = "pwrite";
940 syscall_table[SYS_pwrite64] = "pwrite64";
943 syscall_table[SYS_quotactl] = "quotactl";
946 syscall_table[SYS_rdblock] = "rdblock";
949 syscall_table[SYS_read] = "read";
952 syscall_table[SYS_readlink] = "readlink";
955 syscall_table[SYS_readv] = "readv";
958 syscall_table[SYS_reboot] = "reboot";
961 syscall_table[SYS_recv] = "recv";
964 syscall_table[SYS_recvfrom] = "recvfrom";
967 syscall_table[SYS_recvmsg] = "recvmsg";
970 syscall_table[SYS_rename] = "rename";
972 #ifdef SYS_resolvepath
973 syscall_table[SYS_resolvepath] = "resolvepath";
976 syscall_table[SYS_revoke] = "revoke";
979 syscall_table[SYS_rfsys] = "rfsys";
982 syscall_table[SYS_rmdir] = "rmdir";
985 syscall_table[SYS_rpcsys] = "rpcsys";
988 syscall_table[SYS_sbrk] = "sbrk";
991 syscall_table[SYS_schedctl] = "schedctl";
994 syscall_table[SYS_secadvise] = "secadvise";
997 syscall_table[SYS_secsys] = "secsys";
1000 syscall_table[SYS_security] = "security";
1003 syscall_table[SYS_select] = "select";
1006 syscall_table[SYS_semctl] = "semctl";
1009 syscall_table[SYS_semget] = "semget";
1012 syscall_table[SYS_semop] = "semop";
1015 syscall_table[SYS_semsys] = "semsys";
1018 syscall_table[SYS_send] = "send";
1021 syscall_table[SYS_sendmsg] = "sendmsg";
1024 syscall_table[SYS_sendto] = "sendto";
1026 #ifdef SYS_set_program_attributes
1027 syscall_table[SYS_set_program_attributes] = "set_program_attributes";
1029 #ifdef SYS_set_speculative
1030 syscall_table[SYS_set_speculative] = "set_speculative";
1032 #ifdef SYS_set_sysinfo
1033 syscall_table[SYS_set_sysinfo] = "set_sysinfo";
1035 #ifdef SYS_setcontext
1036 syscall_table[SYS_setcontext] = "setcontext";
1038 #ifdef SYS_setdomainname
1039 syscall_table[SYS_setdomainname] = "setdomainname";
1042 syscall_table[SYS_setegid] = "setegid";
1045 syscall_table[SYS_seteuid] = "seteuid";
1048 syscall_table[SYS_setgid] = "setgid";
1050 #ifdef SYS_setgroups
1051 syscall_table[SYS_setgroups] = "setgroups";
1053 #ifdef SYS_sethostid
1054 syscall_table[SYS_sethostid] = "sethostid";
1056 #ifdef SYS_sethostname
1057 syscall_table[SYS_sethostname] = "sethostname";
1059 #ifdef SYS_setitimer
1060 syscall_table[SYS_setitimer] = "setitimer";
1063 syscall_table[SYS_setlogin] = "setlogin";
1066 syscall_table[SYS_setpgid] = "setpgid";
1069 syscall_table[SYS_setpgrp] = "setpgrp";
1071 #ifdef SYS_setpriority
1072 syscall_table[SYS_setpriority] = "setpriority";
1075 syscall_table[SYS_setregid] = "setregid";
1078 syscall_table[SYS_setreuid] = "setreuid";
1080 #ifdef SYS_setrlimit
1081 syscall_table[SYS_setrlimit] = "setrlimit";
1083 #ifdef SYS_setrlimit64
1084 syscall_table[SYS_setrlimit64] = "setrlimit64";
1087 syscall_table[SYS_setsid] = "setsid";
1089 #ifdef SYS_setsockopt
1090 syscall_table[SYS_setsockopt] = "setsockopt";
1092 #ifdef SYS_settimeofday
1093 syscall_table[SYS_settimeofday] = "settimeofday";
1096 syscall_table[SYS_setuid] = "setuid";
1099 syscall_table[SYS_sgi] = "sgi";
1101 #ifdef SYS_sgifastpath
1102 syscall_table[SYS_sgifastpath] = "sgifastpath";
1105 syscall_table[SYS_sgikopt] = "sgikopt";
1108 syscall_table[SYS_sginap] = "sginap";
1111 syscall_table[SYS_shmat] = "shmat";
1114 syscall_table[SYS_shmctl] = "shmctl";
1117 syscall_table[SYS_shmdt] = "shmdt";
1120 syscall_table[SYS_shmget] = "shmget";
1123 syscall_table[SYS_shmsys] = "shmsys";
1126 syscall_table[SYS_shutdown] = "shutdown";
1128 #ifdef SYS_sigaction
1129 syscall_table[SYS_sigaction] = "sigaction";
1131 #ifdef SYS_sigaltstack
1132 syscall_table[SYS_sigaltstack] = "sigaltstack";
1134 #ifdef SYS_sigaltstack
1135 syscall_table[SYS_sigaltstack] = "sigaltstack";
1138 syscall_table[SYS_sigblock] = "sigblock";
1141 syscall_table[SYS_signal] = "signal";
1143 #ifdef SYS_signotify
1144 syscall_table[SYS_signotify] = "signotify";
1146 #ifdef SYS_signotifywait
1147 syscall_table[SYS_signotifywait] = "signotifywait";
1149 #ifdef SYS_sigpending
1150 syscall_table[SYS_sigpending] = "sigpending";
1153 syscall_table[SYS_sigpoll] = "sigpoll";
1155 #ifdef SYS_sigprocmask
1156 syscall_table[SYS_sigprocmask] = "sigprocmask";
1159 syscall_table[SYS_sigqueue] = "sigqueue";
1161 #ifdef SYS_sigreturn
1162 syscall_table[SYS_sigreturn] = "sigreturn";
1164 #ifdef SYS_sigsendset
1165 syscall_table[SYS_sigsendset] = "sigsendset";
1167 #ifdef SYS_sigsendsys
1168 syscall_table[SYS_sigsendsys] = "sigsendsys";
1170 #ifdef SYS_sigsetmask
1171 syscall_table[SYS_sigsetmask] = "sigsetmask";
1174 syscall_table[SYS_sigstack] = "sigstack";
1176 #ifdef SYS_sigsuspend
1177 syscall_table[SYS_sigsuspend] = "sigsuspend";
1180 syscall_table[SYS_sigvec] = "sigvec";
1183 syscall_table[SYS_sigwait] = "sigwait";
1185 #ifdef SYS_sigwaitprim
1186 syscall_table[SYS_sigwaitprim] = "sigwaitprim";
1189 syscall_table[SYS_sleep] = "sleep";
1191 #ifdef SYS_so_socket
1192 syscall_table[SYS_so_socket] = "so_socket";
1194 #ifdef SYS_so_socketpair
1195 syscall_table[SYS_so_socketpair] = "so_socketpair";
1197 #ifdef SYS_sockconfig
1198 syscall_table[SYS_sockconfig] = "sockconfig";
1201 syscall_table[SYS_socket] = "socket";
1203 #ifdef SYS_socketpair
1204 syscall_table[SYS_socketpair] = "socketpair";
1207 syscall_table[SYS_sproc] = "sproc";
1210 syscall_table[SYS_sprocsp] = "sprocsp";
1213 syscall_table[SYS_sstk] = "sstk";
1216 syscall_table[SYS_stat] = "stat";
1219 syscall_table[SYS_stat64] = "stat64";
1222 syscall_table[SYS_statfs] = "statfs";
1225 syscall_table[SYS_statvfs] = "statvfs";
1227 #ifdef SYS_statvfs64
1228 syscall_table[SYS_statvfs64] = "statvfs64";
1231 syscall_table[SYS_stime] = "stime";
1234 syscall_table[SYS_stty] = "stty";
1236 #ifdef SYS_subsys_info
1237 syscall_table[SYS_subsys_info] = "subsys_info";
1240 syscall_table[SYS_swapctl] = "swapctl";
1243 syscall_table[SYS_swapon] = "swapon";
1246 syscall_table[SYS_symlink] = "symlink";
1249 syscall_table[SYS_sync] = "sync";
1252 syscall_table[SYS_sys3b] = "sys3b";
1255 syscall_table[SYS_syscall] = "syscall";
1257 #ifdef SYS_sysconfig
1258 syscall_table[SYS_sysconfig] = "sysconfig";
1261 syscall_table[SYS_sysfs] = "sysfs";
1264 syscall_table[SYS_sysi86] = "sysi86";
1267 syscall_table[SYS_sysinfo] = "sysinfo";
1270 syscall_table[SYS_sysmips] = "sysmips";
1273 syscall_table[SYS_syssun] = "syssun";
1275 #ifdef SYS_systeminfo
1276 syscall_table[SYS_systeminfo] = "systeminfo";
1279 syscall_table[SYS_table] = "table";
1282 syscall_table[SYS_time] = "time";
1284 #ifdef SYS_timedwait
1285 syscall_table[SYS_timedwait] = "timedwait";
1287 #ifdef SYS_timer_create
1288 syscall_table[SYS_timer_create] = "timer_create";
1290 #ifdef SYS_timer_delete
1291 syscall_table[SYS_timer_delete] = "timer_delete";
1293 #ifdef SYS_timer_getoverrun
1294 syscall_table[SYS_timer_getoverrun] = "timer_getoverrun";
1296 #ifdef SYS_timer_gettime
1297 syscall_table[SYS_timer_gettime] = "timer_gettime";
1299 #ifdef SYS_timer_settime
1300 syscall_table[SYS_timer_settime] = "timer_settime";
1303 syscall_table[SYS_times] = "times";
1306 syscall_table[SYS_truncate] = "truncate";
1308 #ifdef SYS_truncate64
1309 syscall_table[SYS_truncate64] = "truncate64";
1312 syscall_table[SYS_tsolsys] = "tsolsys";
1315 syscall_table[SYS_uadmin] = "uadmin";
1318 syscall_table[SYS_ulimit] = "ulimit";
1321 syscall_table[SYS_umask] = "umask";
1324 syscall_table[SYS_umount] = "umount";
1327 syscall_table[SYS_uname] = "uname";
1330 syscall_table[SYS_unblock] = "unblock";
1333 syscall_table[SYS_unlink] = "unlink";
1336 syscall_table[SYS_unmount] = "unmount";
1338 #ifdef SYS_usleep_thread
1339 syscall_table[SYS_usleep_thread] = "usleep_thread";
1342 syscall_table[SYS_uswitch] = "uswitch";
1344 #ifdef SYS_utc_adjtime
1345 syscall_table[SYS_utc_adjtime] = "utc_adjtime";
1347 #ifdef SYS_utc_gettime
1348 syscall_table[SYS_utc_gettime] = "utc_gettime";
1351 syscall_table[SYS_utime] = "utime";
1354 syscall_table[SYS_utimes] = "utimes";
1357 syscall_table[SYS_utssys] = "utssys";
1360 syscall_table[SYS_vfork] = "vfork";
1363 syscall_table[SYS_vhangup] = "vhangup";
1366 syscall_table[SYS_vtrace] = "vtrace";
1369 syscall_table[SYS_wait] = "wait";
1372 syscall_table[SYS_waitid] = "waitid";
1375 syscall_table[SYS_waitsys] = "waitsys";
1378 syscall_table[SYS_write] = "write";
1381 syscall_table[SYS_writev] = "writev";
1384 syscall_table[SYS_xenix] = "xenix";
1387 syscall_table[SYS_xmknod] = "xmknod";
1390 syscall_table[SYS_xstat] = "xstat";
1393 syscall_table[SYS_yield] = "yield";
1397 /* Prettyprint syscall NUM. */
1400 proc_prettyfprint_syscall (FILE *file, int num, int verbose)
1402 if (syscall_table[num])
1403 fprintf (file, "SYS_%s ", syscall_table[num]);
1405 fprintf (file, "<Unknown syscall %d> ", num);
1409 proc_prettyprint_syscall (int num, int verbose)
1411 proc_prettyfprint_syscall (stdout, num, verbose);
1414 /* Prettyprint all syscalls in SYSSET. */
1417 proc_prettyfprint_syscalls (FILE *file, sysset_t *sysset, int verbose)
1421 for (i = 0; i < MAX_SYSCALLS; i++)
1422 if (prismember (sysset, i))
1424 proc_prettyfprint_syscall (file, i, verbose);
1426 fprintf (file, "\n");
1430 proc_prettyprint_syscalls (sysset_t *sysset, int verbose)
1432 proc_prettyfprint_syscalls (stdout, sysset, verbose);
1435 /* Prettyprint signals. */
1437 /* Signal translation table. */
1439 static struct trans signal_table[] =
1441 { 0, "<no signal>", "no signal" },
1443 { SIGHUP, "SIGHUP", "Hangup" },
1446 { SIGINT, "SIGINT", "Interrupt (rubout)" },
1449 { SIGQUIT, "SIGQUIT", "Quit (ASCII FS)" },
1452 { SIGILL, "SIGILL", "Illegal instruction" }, /* not reset when caught */
1455 { SIGTRAP, "SIGTRAP", "Trace trap" }, /* not reset when caught */
1458 { SIGABRT, "SIGABRT", "used by abort()" }, /* replaces SIGIOT */
1461 { SIGIOT, "SIGIOT", "IOT instruction" },
1464 { SIGEMT, "SIGEMT", "EMT instruction" },
1467 { SIGFPE, "SIGFPE", "Floating point exception" },
1470 { SIGKILL, "SIGKILL", "Kill" }, /* Solaris: cannot be caught/ignored */
1473 { SIGBUS, "SIGBUS", "Bus error" },
1476 { SIGSEGV, "SIGSEGV", "Segmentation violation" },
1479 { SIGSYS, "SIGSYS", "Bad argument to system call" },
1482 { SIGPIPE, "SIGPIPE", "Write to pipe with no one to read it" },
1485 { SIGALRM, "SIGALRM", "Alarm clock" },
1488 { SIGTERM, "SIGTERM", "Software termination signal from kill" },
1491 { SIGUSR1, "SIGUSR1", "User defined signal 1" },
1494 { SIGUSR2, "SIGUSR2", "User defined signal 2" },
1497 { SIGCHLD, "SIGCHLD", "Child status changed" }, /* Posix version */
1500 { SIGCLD, "SIGCLD", "Child status changed" }, /* Solaris version */
1503 { SIGPWR, "SIGPWR", "Power-fail restart" },
1506 { SIGWINCH, "SIGWINCH", "Window size change" },
1509 { SIGURG, "SIGURG", "Urgent socket condition" },
1512 { SIGPOLL, "SIGPOLL", "Pollable event" },
1515 { SIGIO, "SIGIO", "Socket I/O possible" }, /* alias for SIGPOLL */
1518 { SIGSTOP, "SIGSTOP", "Stop, not from tty" }, /* cannot be caught or ignored */
1521 { SIGTSTP, "SIGTSTP", "User stop from tty" },
1524 { SIGCONT, "SIGCONT", "Stopped process has been continued" },
1527 { SIGTTIN, "SIGTTIN", "Background tty read attempted" },
1530 { SIGTTOU, "SIGTTOU", "Background tty write attempted" },
1533 { SIGVTALRM, "SIGVTALRM", "Virtual timer expired" },
1536 { SIGPROF, "SIGPROF", "Profiling timer expired" },
1539 { SIGXCPU, "SIGXCPU", "Exceeded CPU limit" },
1542 { SIGXFSZ, "SIGXFSZ", "Exceeded file size limit" },
1545 { SIGWAITING, "SIGWAITING", "Process's LWPs are blocked" },
1548 { SIGLWP, "SIGLWP", "Used by thread library" },
1551 { SIGFREEZE, "SIGFREEZE", "Used by CPR" },
1554 { SIGTHAW, "SIGTHAW", "Used by CPR" },
1557 { SIGCANCEL, "SIGCANCEL", "Used by libthread" },
1560 { SIGLOST, "SIGLOST", "Resource lost" },
1563 { SIG32, "SIG32", "Reserved for kernel usage (Irix)" },
1566 { SIGPTINTR, "SIGPTINTR", "Posix 1003.1b" },
1569 { SIGTRESCHED, "SIGTRESCHED", "Posix 1003.1b" },
1572 { SIGINFO, "SIGINFO", "Information request" },
1575 { SIGRESV, "SIGRESV", "Reserved by Digital for future use" },
1578 { SIGAIO, "SIGAIO", "Asynchronous I/O signal" },
1581 /* FIXME: add real-time signals. */
1584 /* Prettyprint signal number SIGNO. */
1587 proc_prettyfprint_signal (FILE *file, int signo, int verbose)
1591 for (i = 0; i < sizeof (signal_table) / sizeof (signal_table[0]); i++)
1592 if (signo == signal_table[i].value)
1594 fprintf (file, "%s", signal_table[i].name);
1596 fprintf (file, ": %s\n", signal_table[i].desc);
1598 fprintf (file, " ");
1601 fprintf (file, "Unknown signal %d%c", signo, verbose ? '\n' : ' ');
1605 proc_prettyprint_signal (int signo, int verbose)
1607 proc_prettyfprint_signal (stdout, signo, verbose);
1610 /* Prettyprint all signals in SIGSET. */
1613 proc_prettyfprint_signalset (FILE *file, sigset_t *sigset, int verbose)
1617 /* Loop over all signal numbers from 0 to NSIG, using them as the
1618 index to prismember. The signal table had better not contain
1619 aliases, for if it does they will both be printed. */
1621 for (i = 0; i < NSIG; i++)
1622 if (prismember (sigset, i))
1623 proc_prettyfprint_signal (file, i, verbose);
1626 fprintf (file, "\n");
1630 proc_prettyprint_signalset (sigset_t *sigset, int verbose)
1632 proc_prettyfprint_signalset (stdout, sigset, verbose);
1636 /* Prettyprint faults. */
1638 /* Fault translation table. */
1640 static struct trans fault_table[] =
1643 { FLTILL, "FLTILL", "Illegal instruction" },
1646 { FLTPRIV, "FLTPRIV", "Privileged instruction" },
1649 { FLTBPT, "FLTBPT", "Breakpoint trap" },
1652 { FLTTRACE, "FLTTRACE", "Trace trap" },
1655 { FLTACCESS, "FLTACCESS", "Memory access fault" },
1658 { FLTBOUNDS, "FLTBOUNDS", "Memory bounds violation" },
1661 { FLTIOVF, "FLTIOVF", "Integer overflow" },
1664 { FLTIZDIV, "FLTIZDIV", "Integer zero divide" },
1667 { FLTFPE, "FLTFPE", "Floating-point exception" },
1670 { FLTSTACK, "FLTSTACK", "Unrecoverable stack fault" },
1673 { FLTPAGE, "FLTPAGE", "Recoverable page fault" },
1676 { FLTPCINVAL, "FLTPCINVAL", "Invalid PC exception" },
1679 { FLTWATCH, "FLTWATCH", "User watchpoint" },
1682 { FLTKWATCH, "FLTKWATCH", "Kernel watchpoint" },
1685 { FLTSCWATCH, "FLTSCWATCH", "Hit a store conditional on a watched page" },
1689 /* Work horse. Accepts an index into the fault table, prints it
1693 prettyfprint_faulttable_entry (FILE *file, int i, int verbose)
1695 fprintf (file, "%s", fault_table[i].name);
1697 fprintf (file, ": %s\n", fault_table[i].desc);
1699 fprintf (file, " ");
1702 /* Prettyprint hardware fault number FAULTNO. */
1705 proc_prettyfprint_fault (FILE *file, int faultno, int verbose)
1709 for (i = 0; i < ARRAY_SIZE (fault_table); i++)
1710 if (faultno == fault_table[i].value)
1712 prettyfprint_faulttable_entry (file, i, verbose);
1716 fprintf (file, "Unknown hardware fault %d%c",
1717 faultno, verbose ? '\n' : ' ');
1721 proc_prettyprint_fault (int faultno, int verbose)
1723 proc_prettyfprint_fault (stdout, faultno, verbose);
1726 /* Prettyprint all faults in FLTSET. */
1729 proc_prettyfprint_faultset (FILE *file, fltset_t *fltset, int verbose)
1733 /* Loop through the fault table, using the value field as the index
1734 to prismember. The fault table had better not contain aliases,
1735 for if it does they will both be printed. */
1737 for (i = 0; i < ARRAY_SIZE (fault_table); i++)
1738 if (prismember (fltset, fault_table[i].value))
1739 prettyfprint_faulttable_entry (file, i, verbose);
1742 fprintf (file, "\n");
1746 proc_prettyprint_faultset (fltset_t *fltset, int verbose)
1748 proc_prettyfprint_faultset (stdout, fltset, verbose);
1751 /* TODO: actions, holds... */
1754 proc_prettyprint_actionset (struct sigaction *actions, int verbose)
1759 /* Provide a prototype to silence -Wmissing-prototypes. */
1760 void _initialize_proc_events (void);
1763 _initialize_proc_events (void)
1765 init_syscall_table ();