1 /* Machine-independent support for SVR4 /proc (process file system)
3 Copyright (C) 1999, 2000, 2004, 2007, 2008 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 /* Much of the information used in the /proc interface, particularly
48 for printing status information, is kept as tables of structures of
49 the following form. These tables can be used to map numeric values
50 to their symbolic names and to a string that describes their
55 int value; /* The numeric value. */
56 char *name; /* The equivalent symbolic value. */
57 char *desc; /* Short description of value. */
61 /* Pretty print syscalls. */
63 /* Ugh -- UnixWare and Solaris spell these differently! */
66 #define SYS_lwp_create SYS_lwpcreate
70 #define SYS_lwp_exit SYS_lwpexit
74 #define SYS_lwp_wait SYS_lwpwait
78 #define SYS_lwp_self SYS_lwpself
82 #define SYS_lwp_info SYS_lwpinfo
86 #define SYS_lwp_private SYS_lwpprivate
90 #define SYS_lwp_kill SYS_lwpkill
94 #define SYS_lwp_suspend SYS_lwpsuspend
97 #ifdef SYS_lwpcontinue
98 #define SYS_lwp_continue SYS_lwpcontinue
102 /* Syscall translation table. */
104 #define MAX_SYSCALLS 262 /* Pretty arbitrary. */
105 static char *syscall_table[MAX_SYSCALLS];
108 init_syscall_table (void)
110 #ifdef SYS_BSD_getime
111 syscall_table[SYS_BSD_getime] = "BSD_getime";
113 #ifdef SYS_BSDgetpgrp
114 syscall_table[SYS_BSDgetpgrp] = "BSDgetpgrp";
116 #ifdef SYS_BSDsetpgrp
117 syscall_table[SYS_BSDsetpgrp] = "BSDsetpgrp";
120 syscall_table[SYS_acancel] = "acancel";
123 syscall_table[SYS_accept] = "accept";
126 syscall_table[SYS_access] = "access";
129 syscall_table[SYS_acct] = "acct";
132 syscall_table[SYS_acl] = "acl";
135 syscall_table[SYS_aclipc] = "aclipc";
138 syscall_table[SYS_adjtime] = "adjtime";
140 #ifdef SYS_afs_syscall
141 syscall_table[SYS_afs_syscall] = "afs_syscall";
144 syscall_table[SYS_alarm] = "alarm";
147 syscall_table[SYS_alt_plock] = "alt_plock";
149 #ifdef SYS_alt_sigpending
150 syscall_table[SYS_alt_sigpending] = "alt_sigpending";
153 syscall_table[SYS_async] = "async";
155 #ifdef SYS_async_daemon
156 syscall_table[SYS_async_daemon] = "async_daemon";
159 syscall_table[SYS_audcntl] = "audcntl";
162 syscall_table[SYS_audgen] = "audgen";
165 syscall_table[SYS_auditbuf] = "auditbuf";
168 syscall_table[SYS_auditctl] = "auditctl";
171 syscall_table[SYS_auditdmp] = "auditdmp";
174 syscall_table[SYS_auditevt] = "auditevt";
177 syscall_table[SYS_auditlog] = "auditlog";
180 syscall_table[SYS_auditsys] = "auditsys";
183 syscall_table[SYS_bind] = "bind";
186 syscall_table[SYS_block] = "block";
189 syscall_table[SYS_brk] = "brk";
192 syscall_table[SYS_cachectl] = "cachectl";
194 #ifdef SYS_cacheflush
195 syscall_table[SYS_cacheflush] = "cacheflush";
197 #ifdef SYS_cancelblock
198 syscall_table[SYS_cancelblock] = "cancelblock";
201 syscall_table[SYS_cg_bind] = "cg_bind";
203 #ifdef SYS_cg_current
204 syscall_table[SYS_cg_current] = "cg_current";
207 syscall_table[SYS_cg_ids] = "cg_ids";
210 syscall_table[SYS_cg_info] = "cg_info";
213 syscall_table[SYS_cg_memloc] = "cg_memloc";
215 #ifdef SYS_cg_processors
216 syscall_table[SYS_cg_processors] = "cg_processors";
219 syscall_table[SYS_chdir] = "chdir";
222 syscall_table[SYS_chflags] = "chflags";
225 syscall_table[SYS_chmod] = "chmod";
228 syscall_table[SYS_chown] = "chown";
231 syscall_table[SYS_chroot] = "chroot";
234 syscall_table[SYS_clocal] = "clocal";
236 #ifdef SYS_clock_getres
237 syscall_table[SYS_clock_getres] = "clock_getres";
239 #ifdef SYS_clock_gettime
240 syscall_table[SYS_clock_gettime] = "clock_gettime";
242 #ifdef SYS_clock_settime
243 syscall_table[SYS_clock_settime] = "clock_settime";
246 syscall_table[SYS_close] = "close";
249 syscall_table[SYS_connect] = "connect";
252 syscall_table[SYS_context] = "context";
255 syscall_table[SYS_creat] = "creat";
258 syscall_table[SYS_creat64] = "creat64";
261 syscall_table[SYS_devstat] = "devstat";
264 syscall_table[SYS_dmi] = "dmi";
267 syscall_table[SYS_door] = "door";
270 syscall_table[SYS_dshmsys] = "dshmsys";
273 syscall_table[SYS_dup] = "dup";
276 syscall_table[SYS_dup2] = "dup2";
279 syscall_table[SYS_evsys] = "evsys";
282 syscall_table[SYS_evtrapret] = "evtrapret";
285 syscall_table[SYS_exec] = "exec";
287 #ifdef SYS_exec_with_loader
288 syscall_table[SYS_exec_with_loader] = "exec_with_loader";
291 syscall_table[SYS_execv] = "execv";
294 syscall_table[SYS_execve] = "execve";
297 syscall_table[SYS_exit] = "exit";
300 syscall_table[SYS_exportfs] = "exportfs";
303 syscall_table[SYS_facl] = "facl";
306 syscall_table[SYS_fchdir] = "fchdir";
309 syscall_table[SYS_fchflags] = "fchflags";
312 syscall_table[SYS_fchmod] = "fchmod";
315 syscall_table[SYS_fchown] = "fchown";
318 syscall_table[SYS_fchroot] = "fchroot";
321 syscall_table[SYS_fcntl] = "fcntl";
324 syscall_table[SYS_fdatasync] = "fdatasync";
327 syscall_table[SYS_fdevstat] = "fdevstat";
330 syscall_table[SYS_fdsync] = "fdsync";
333 syscall_table[SYS_filepriv] = "filepriv";
336 syscall_table[SYS_flock] = "flock";
339 syscall_table[SYS_flvlfile] = "flvlfile";
342 syscall_table[SYS_fork] = "fork";
345 syscall_table[SYS_fork1] = "fork1";
348 syscall_table[SYS_forkall] = "forkall";
351 syscall_table[SYS_fpathconf] = "fpathconf";
354 syscall_table[SYS_fstat] = "fstat";
357 syscall_table[SYS_fstat64] = "fstat64";
360 syscall_table[SYS_fstatfs] = "fstatfs";
363 syscall_table[SYS_fstatvfs] = "fstatvfs";
365 #ifdef SYS_fstatvfs64
366 syscall_table[SYS_fstatvfs64] = "fstatvfs64";
369 syscall_table[SYS_fsync] = "fsync";
372 syscall_table[SYS_ftruncate] = "ftruncate";
374 #ifdef SYS_ftruncate64
375 syscall_table[SYS_ftruncate64] = "ftruncate64";
378 syscall_table[SYS_fuser] = "fuser";
381 syscall_table[SYS_fxstat] = "fxstat";
383 #ifdef SYS_get_sysinfo
384 syscall_table[SYS_get_sysinfo] = "get_sysinfo";
386 #ifdef SYS_getaddressconf
387 syscall_table[SYS_getaddressconf] = "getaddressconf";
389 #ifdef SYS_getcontext
390 syscall_table[SYS_getcontext] = "getcontext";
393 syscall_table[SYS_getdents] = "getdents";
395 #ifdef SYS_getdents64
396 syscall_table[SYS_getdents64] = "getdents64";
398 #ifdef SYS_getdirentries
399 syscall_table[SYS_getdirentries] = "getdirentries";
401 #ifdef SYS_getdomainname
402 syscall_table[SYS_getdomainname] = "getdomainname";
404 #ifdef SYS_getdtablesize
405 syscall_table[SYS_getdtablesize] = "getdtablesize";
408 syscall_table[SYS_getfh] = "getfh";
411 syscall_table[SYS_getfsstat] = "getfsstat";
414 syscall_table[SYS_getgid] = "getgid";
417 syscall_table[SYS_getgroups] = "getgroups";
420 syscall_table[SYS_gethostid] = "gethostid";
422 #ifdef SYS_gethostname
423 syscall_table[SYS_gethostname] = "gethostname";
426 syscall_table[SYS_getitimer] = "getitimer";
429 syscall_table[SYS_getksym] = "getksym";
432 syscall_table[SYS_getlogin] = "getlogin";
435 syscall_table[SYS_getmnt] = "getmnt";
438 syscall_table[SYS_getmsg] = "getmsg";
440 #ifdef SYS_getpagesize
441 syscall_table[SYS_getpagesize] = "getpagesize";
443 #ifdef SYS_getpeername
444 syscall_table[SYS_getpeername] = "getpeername";
447 syscall_table[SYS_getpgid] = "getpgid";
450 syscall_table[SYS_getpgrp] = "getpgrp";
453 syscall_table[SYS_getpid] = "getpid";
456 syscall_table[SYS_getpmsg] = "getpmsg";
458 #ifdef SYS_getpriority
459 syscall_table[SYS_getpriority] = "getpriority";
462 syscall_table[SYS_getrlimit] = "getrlimit";
464 #ifdef SYS_getrlimit64
465 syscall_table[SYS_getrlimit64] = "getrlimit64";
468 syscall_table[SYS_getrusage] = "getrusage";
471 syscall_table[SYS_getsid] = "getsid";
473 #ifdef SYS_getsockname
474 syscall_table[SYS_getsockname] = "getsockname";
476 #ifdef SYS_getsockopt
477 syscall_table[SYS_getsockopt] = "getsockopt";
479 #ifdef SYS_gettimeofday
480 syscall_table[SYS_gettimeofday] = "gettimeofday";
483 syscall_table[SYS_getuid] = "getuid";
486 syscall_table[SYS_gtty] = "gtty";
489 syscall_table[SYS_hrtsys] = "hrtsys";
492 syscall_table[SYS_inst_sync] = "inst_sync";
494 #ifdef SYS_install_utrap
495 syscall_table[SYS_install_utrap] = "install_utrap";
498 syscall_table[SYS_invlpg] = "invlpg";
501 syscall_table[SYS_ioctl] = "ioctl";
504 syscall_table[SYS_kaio] = "kaio";
507 syscall_table[SYS_keyctl] = "keyctl";
510 syscall_table[SYS_kill] = "kill";
513 syscall_table[SYS_killpg] = "killpg";
516 syscall_table[SYS_kloadcall] = "kloadcall";
519 syscall_table[SYS_kmodcall] = "kmodcall";
521 #ifdef SYS_ksigaction
522 syscall_table[SYS_ksigaction] = "ksigaction";
524 #ifdef SYS_ksigprocmask
525 syscall_table[SYS_ksigprocmask] = "ksigprocmask";
528 syscall_table[SYS_ksigqueue] = "ksigqueue";
531 syscall_table[SYS_lchown] = "lchown";
534 syscall_table[SYS_link] = "link";
537 syscall_table[SYS_listen] = "listen";
540 syscall_table[SYS_llseek] = "llseek";
543 syscall_table[SYS_lseek] = "lseek";
546 syscall_table[SYS_lseek64] = "lseek64";
549 syscall_table[SYS_lstat] = "lstat";
552 syscall_table[SYS_lstat64] = "lstat64";
555 syscall_table[SYS_lvldom] = "lvldom";
558 syscall_table[SYS_lvlequal] = "lvlequal";
561 syscall_table[SYS_lvlfile] = "lvlfile";
564 syscall_table[SYS_lvlipc] = "lvlipc";
567 syscall_table[SYS_lvlproc] = "lvlproc";
570 syscall_table[SYS_lvlvfs] = "lvlvfs";
573 syscall_table[SYS_lwp_alarm] = "lwp_alarm";
575 #ifdef SYS_lwp_cond_broadcast
576 syscall_table[SYS_lwp_cond_broadcast] = "lwp_cond_broadcast";
578 #ifdef SYS_lwp_cond_signal
579 syscall_table[SYS_lwp_cond_signal] = "lwp_cond_signal";
581 #ifdef SYS_lwp_cond_wait
582 syscall_table[SYS_lwp_cond_wait] = "lwp_cond_wait";
584 #ifdef SYS_lwp_continue
585 syscall_table[SYS_lwp_continue] = "lwp_continue";
587 #ifdef SYS_lwp_create
588 syscall_table[SYS_lwp_create] = "lwp_create";
591 syscall_table[SYS_lwp_exit] = "lwp_exit";
593 #ifdef SYS_lwp_getprivate
594 syscall_table[SYS_lwp_getprivate] = "lwp_getprivate";
597 syscall_table[SYS_lwp_info] = "lwp_info";
600 syscall_table[SYS_lwp_kill] = "lwp_kill";
602 #ifdef SYS_lwp_mutex_init
603 syscall_table[SYS_lwp_mutex_init] = "lwp_mutex_init";
605 #ifdef SYS_lwp_mutex_lock
606 syscall_table[SYS_lwp_mutex_lock] = "lwp_mutex_lock";
608 #ifdef SYS_lwp_mutex_trylock
609 syscall_table[SYS_lwp_mutex_trylock] = "lwp_mutex_trylock";
611 #ifdef SYS_lwp_mutex_unlock
612 syscall_table[SYS_lwp_mutex_unlock] = "lwp_mutex_unlock";
614 #ifdef SYS_lwp_private
615 syscall_table[SYS_lwp_private] = "lwp_private";
618 syscall_table[SYS_lwp_self] = "lwp_self";
620 #ifdef SYS_lwp_sema_post
621 syscall_table[SYS_lwp_sema_post] = "lwp_sema_post";
623 #ifdef SYS_lwp_sema_trywait
624 syscall_table[SYS_lwp_sema_trywait] = "lwp_sema_trywait";
626 #ifdef SYS_lwp_sema_wait
627 syscall_table[SYS_lwp_sema_wait] = "lwp_sema_wait";
629 #ifdef SYS_lwp_setprivate
630 syscall_table[SYS_lwp_setprivate] = "lwp_setprivate";
632 #ifdef SYS_lwp_sigredirect
633 syscall_table[SYS_lwp_sigredirect] = "lwp_sigredirect";
635 #ifdef SYS_lwp_suspend
636 syscall_table[SYS_lwp_suspend] = "lwp_suspend";
639 syscall_table[SYS_lwp_wait] = "lwp_wait";
642 syscall_table[SYS_lxstat] = "lxstat";
645 syscall_table[SYS_madvise] = "madvise";
648 syscall_table[SYS_memcntl] = "memcntl";
651 syscall_table[SYS_mincore] = "mincore";
654 syscall_table[SYS_mincore] = "mincore";
657 syscall_table[SYS_mkdir] = "mkdir";
660 syscall_table[SYS_mkmld] = "mkmld";
663 syscall_table[SYS_mknod] = "mknod";
666 syscall_table[SYS_mldmode] = "mldmode";
669 syscall_table[SYS_mmap] = "mmap";
672 syscall_table[SYS_mmap64] = "mmap64";
675 syscall_table[SYS_modadm] = "modadm";
678 syscall_table[SYS_modctl] = "modctl";
681 syscall_table[SYS_modload] = "modload";
684 syscall_table[SYS_modpath] = "modpath";
687 syscall_table[SYS_modstat] = "modstat";
690 syscall_table[SYS_moduload] = "moduload";
693 syscall_table[SYS_mount] = "mount";
696 syscall_table[SYS_mprotect] = "mprotect";
699 syscall_table[SYS_mremap] = "mremap";
701 #ifdef SYS_msfs_syscall
702 syscall_table[SYS_msfs_syscall] = "msfs_syscall";
705 syscall_table[SYS_msgctl] = "msgctl";
708 syscall_table[SYS_msgget] = "msgget";
711 syscall_table[SYS_msgrcv] = "msgrcv";
714 syscall_table[SYS_msgsnd] = "msgsnd";
717 syscall_table[SYS_msgsys] = "msgsys";
720 syscall_table[SYS_msleep] = "msleep";
723 syscall_table[SYS_msync] = "msync";
726 syscall_table[SYS_munmap] = "munmap";
729 syscall_table[SYS_mvalid] = "mvalid";
732 syscall_table[SYS_mwakeup] = "mwakeup";
735 syscall_table[SYS_naccept] = "naccept";
738 syscall_table[SYS_nanosleep] = "nanosleep";
741 syscall_table[SYS_nfssvc] = "nfssvc";
744 syscall_table[SYS_nfssys] = "nfssys";
746 #ifdef SYS_ngetpeername
747 syscall_table[SYS_ngetpeername] = "ngetpeername";
749 #ifdef SYS_ngetsockname
750 syscall_table[SYS_ngetsockname] = "ngetsockname";
753 syscall_table[SYS_nice] = "nice";
756 syscall_table[SYS_nrecvfrom] = "nrecvfrom";
759 syscall_table[SYS_nrecvmsg] = "nrecvmsg";
762 syscall_table[SYS_nsendmsg] = "nsendmsg";
764 #ifdef SYS_ntp_adjtime
765 syscall_table[SYS_ntp_adjtime] = "ntp_adjtime";
767 #ifdef SYS_ntp_gettime
768 syscall_table[SYS_ntp_gettime] = "ntp_gettime";
771 syscall_table[SYS_nuname] = "nuname";
774 syscall_table[SYS_obreak] = "obreak";
776 #ifdef SYS_old_accept
777 syscall_table[SYS_old_accept] = "old_accept";
780 syscall_table[SYS_old_fstat] = "old_fstat";
782 #ifdef SYS_old_getpeername
783 syscall_table[SYS_old_getpeername] = "old_getpeername";
785 #ifdef SYS_old_getpgrp
786 syscall_table[SYS_old_getpgrp] = "old_getpgrp";
788 #ifdef SYS_old_getsockname
789 syscall_table[SYS_old_getsockname] = "old_getsockname";
791 #ifdef SYS_old_killpg
792 syscall_table[SYS_old_killpg] = "old_killpg";
795 syscall_table[SYS_old_lstat] = "old_lstat";
798 syscall_table[SYS_old_recv] = "old_recv";
800 #ifdef SYS_old_recvfrom
801 syscall_table[SYS_old_recvfrom] = "old_recvfrom";
803 #ifdef SYS_old_recvmsg
804 syscall_table[SYS_old_recvmsg] = "old_recvmsg";
807 syscall_table[SYS_old_send] = "old_send";
809 #ifdef SYS_old_sendmsg
810 syscall_table[SYS_old_sendmsg] = "old_sendmsg";
812 #ifdef SYS_old_sigblock
813 syscall_table[SYS_old_sigblock] = "old_sigblock";
815 #ifdef SYS_old_sigsetmask
816 syscall_table[SYS_old_sigsetmask] = "old_sigsetmask";
818 #ifdef SYS_old_sigvec
819 syscall_table[SYS_old_sigvec] = "old_sigvec";
822 syscall_table[SYS_old_stat] = "old_stat";
824 #ifdef SYS_old_vhangup
825 syscall_table[SYS_old_vhangup] = "old_vhangup";
828 syscall_table[SYS_old_wait] = "old_wait";
831 syscall_table[SYS_oldquota] = "oldquota";
834 syscall_table[SYS_online] = "online";
837 syscall_table[SYS_open] = "open";
840 syscall_table[SYS_open64] = "open64";
843 syscall_table[SYS_ovadvise] = "ovadvise";
846 syscall_table[SYS_p_online] = "p_online";
849 syscall_table[SYS_pagelock] = "pagelock";
852 syscall_table[SYS_pathconf] = "pathconf";
855 syscall_table[SYS_pause] = "pause";
858 syscall_table[SYS_pgrpsys] = "pgrpsys";
861 syscall_table[SYS_pid_block] = "pid_block";
863 #ifdef SYS_pid_unblock
864 syscall_table[SYS_pid_unblock] = "pid_unblock";
867 syscall_table[SYS_pipe] = "pipe";
870 syscall_table[SYS_plock] = "plock";
873 syscall_table[SYS_poll] = "poll";
876 syscall_table[SYS_prctl] = "prctl";
879 syscall_table[SYS_pread] = "pread";
882 syscall_table[SYS_pread64] = "pread64";
885 syscall_table[SYS_pread64] = "pread64";
888 syscall_table[SYS_prepblock] = "prepblock";
891 syscall_table[SYS_priocntl] = "priocntl";
893 #ifdef SYS_priocntllst
894 syscall_table[SYS_priocntllst] = "priocntllst";
896 #ifdef SYS_priocntlset
897 syscall_table[SYS_priocntlset] = "priocntlset";
899 #ifdef SYS_priocntlsys
900 syscall_table[SYS_priocntlsys] = "priocntlsys";
903 syscall_table[SYS_procblk] = "procblk";
905 #ifdef SYS_processor_bind
906 syscall_table[SYS_processor_bind] = "processor_bind";
908 #ifdef SYS_processor_exbind
909 syscall_table[SYS_processor_exbind] = "processor_exbind";
911 #ifdef SYS_processor_info
912 syscall_table[SYS_processor_info] = "processor_info";
915 syscall_table[SYS_procpriv] = "procpriv";
918 syscall_table[SYS_profil] = "profil";
920 #ifdef SYS_proplist_syscall
921 syscall_table[SYS_proplist_syscall] = "proplist_syscall";
924 syscall_table[SYS_pset] = "pset";
927 syscall_table[SYS_ptrace] = "ptrace";
930 syscall_table[SYS_putmsg] = "putmsg";
933 syscall_table[SYS_putpmsg] = "putpmsg";
936 syscall_table[SYS_pwrite] = "pwrite";
939 syscall_table[SYS_pwrite64] = "pwrite64";
942 syscall_table[SYS_quotactl] = "quotactl";
945 syscall_table[SYS_rdblock] = "rdblock";
948 syscall_table[SYS_read] = "read";
951 syscall_table[SYS_readlink] = "readlink";
954 syscall_table[SYS_readv] = "readv";
957 syscall_table[SYS_reboot] = "reboot";
960 syscall_table[SYS_recv] = "recv";
963 syscall_table[SYS_recvfrom] = "recvfrom";
966 syscall_table[SYS_recvmsg] = "recvmsg";
969 syscall_table[SYS_rename] = "rename";
971 #ifdef SYS_resolvepath
972 syscall_table[SYS_resolvepath] = "resolvepath";
975 syscall_table[SYS_revoke] = "revoke";
978 syscall_table[SYS_rfsys] = "rfsys";
981 syscall_table[SYS_rmdir] = "rmdir";
984 syscall_table[SYS_rpcsys] = "rpcsys";
987 syscall_table[SYS_sbrk] = "sbrk";
990 syscall_table[SYS_schedctl] = "schedctl";
993 syscall_table[SYS_secadvise] = "secadvise";
996 syscall_table[SYS_secsys] = "secsys";
999 syscall_table[SYS_security] = "security";
1002 syscall_table[SYS_select] = "select";
1005 syscall_table[SYS_semctl] = "semctl";
1008 syscall_table[SYS_semget] = "semget";
1011 syscall_table[SYS_semop] = "semop";
1014 syscall_table[SYS_semsys] = "semsys";
1017 syscall_table[SYS_send] = "send";
1020 syscall_table[SYS_sendmsg] = "sendmsg";
1023 syscall_table[SYS_sendto] = "sendto";
1025 #ifdef SYS_set_program_attributes
1026 syscall_table[SYS_set_program_attributes] = "set_program_attributes";
1028 #ifdef SYS_set_speculative
1029 syscall_table[SYS_set_speculative] = "set_speculative";
1031 #ifdef SYS_set_sysinfo
1032 syscall_table[SYS_set_sysinfo] = "set_sysinfo";
1034 #ifdef SYS_setcontext
1035 syscall_table[SYS_setcontext] = "setcontext";
1037 #ifdef SYS_setdomainname
1038 syscall_table[SYS_setdomainname] = "setdomainname";
1041 syscall_table[SYS_setegid] = "setegid";
1044 syscall_table[SYS_seteuid] = "seteuid";
1047 syscall_table[SYS_setgid] = "setgid";
1049 #ifdef SYS_setgroups
1050 syscall_table[SYS_setgroups] = "setgroups";
1052 #ifdef SYS_sethostid
1053 syscall_table[SYS_sethostid] = "sethostid";
1055 #ifdef SYS_sethostname
1056 syscall_table[SYS_sethostname] = "sethostname";
1058 #ifdef SYS_setitimer
1059 syscall_table[SYS_setitimer] = "setitimer";
1062 syscall_table[SYS_setlogin] = "setlogin";
1065 syscall_table[SYS_setpgid] = "setpgid";
1068 syscall_table[SYS_setpgrp] = "setpgrp";
1070 #ifdef SYS_setpriority
1071 syscall_table[SYS_setpriority] = "setpriority";
1074 syscall_table[SYS_setregid] = "setregid";
1077 syscall_table[SYS_setreuid] = "setreuid";
1079 #ifdef SYS_setrlimit
1080 syscall_table[SYS_setrlimit] = "setrlimit";
1082 #ifdef SYS_setrlimit64
1083 syscall_table[SYS_setrlimit64] = "setrlimit64";
1086 syscall_table[SYS_setsid] = "setsid";
1088 #ifdef SYS_setsockopt
1089 syscall_table[SYS_setsockopt] = "setsockopt";
1091 #ifdef SYS_settimeofday
1092 syscall_table[SYS_settimeofday] = "settimeofday";
1095 syscall_table[SYS_setuid] = "setuid";
1098 syscall_table[SYS_sgi] = "sgi";
1100 #ifdef SYS_sgifastpath
1101 syscall_table[SYS_sgifastpath] = "sgifastpath";
1104 syscall_table[SYS_sgikopt] = "sgikopt";
1107 syscall_table[SYS_sginap] = "sginap";
1110 syscall_table[SYS_shmat] = "shmat";
1113 syscall_table[SYS_shmctl] = "shmctl";
1116 syscall_table[SYS_shmdt] = "shmdt";
1119 syscall_table[SYS_shmget] = "shmget";
1122 syscall_table[SYS_shmsys] = "shmsys";
1125 syscall_table[SYS_shutdown] = "shutdown";
1127 #ifdef SYS_sigaction
1128 syscall_table[SYS_sigaction] = "sigaction";
1130 #ifdef SYS_sigaltstack
1131 syscall_table[SYS_sigaltstack] = "sigaltstack";
1133 #ifdef SYS_sigaltstack
1134 syscall_table[SYS_sigaltstack] = "sigaltstack";
1137 syscall_table[SYS_sigblock] = "sigblock";
1140 syscall_table[SYS_signal] = "signal";
1142 #ifdef SYS_signotify
1143 syscall_table[SYS_signotify] = "signotify";
1145 #ifdef SYS_signotifywait
1146 syscall_table[SYS_signotifywait] = "signotifywait";
1148 #ifdef SYS_sigpending
1149 syscall_table[SYS_sigpending] = "sigpending";
1152 syscall_table[SYS_sigpoll] = "sigpoll";
1154 #ifdef SYS_sigprocmask
1155 syscall_table[SYS_sigprocmask] = "sigprocmask";
1158 syscall_table[SYS_sigqueue] = "sigqueue";
1160 #ifdef SYS_sigreturn
1161 syscall_table[SYS_sigreturn] = "sigreturn";
1163 #ifdef SYS_sigsendset
1164 syscall_table[SYS_sigsendset] = "sigsendset";
1166 #ifdef SYS_sigsendsys
1167 syscall_table[SYS_sigsendsys] = "sigsendsys";
1169 #ifdef SYS_sigsetmask
1170 syscall_table[SYS_sigsetmask] = "sigsetmask";
1173 syscall_table[SYS_sigstack] = "sigstack";
1175 #ifdef SYS_sigsuspend
1176 syscall_table[SYS_sigsuspend] = "sigsuspend";
1179 syscall_table[SYS_sigvec] = "sigvec";
1182 syscall_table[SYS_sigwait] = "sigwait";
1184 #ifdef SYS_sigwaitprim
1185 syscall_table[SYS_sigwaitprim] = "sigwaitprim";
1188 syscall_table[SYS_sleep] = "sleep";
1190 #ifdef SYS_so_socket
1191 syscall_table[SYS_so_socket] = "so_socket";
1193 #ifdef SYS_so_socketpair
1194 syscall_table[SYS_so_socketpair] = "so_socketpair";
1196 #ifdef SYS_sockconfig
1197 syscall_table[SYS_sockconfig] = "sockconfig";
1200 syscall_table[SYS_socket] = "socket";
1202 #ifdef SYS_socketpair
1203 syscall_table[SYS_socketpair] = "socketpair";
1206 syscall_table[SYS_sproc] = "sproc";
1209 syscall_table[SYS_sprocsp] = "sprocsp";
1212 syscall_table[SYS_sstk] = "sstk";
1215 syscall_table[SYS_stat] = "stat";
1218 syscall_table[SYS_stat64] = "stat64";
1221 syscall_table[SYS_statfs] = "statfs";
1224 syscall_table[SYS_statvfs] = "statvfs";
1226 #ifdef SYS_statvfs64
1227 syscall_table[SYS_statvfs64] = "statvfs64";
1230 syscall_table[SYS_stime] = "stime";
1233 syscall_table[SYS_stty] = "stty";
1235 #ifdef SYS_subsys_info
1236 syscall_table[SYS_subsys_info] = "subsys_info";
1239 syscall_table[SYS_swapctl] = "swapctl";
1242 syscall_table[SYS_swapon] = "swapon";
1245 syscall_table[SYS_symlink] = "symlink";
1248 syscall_table[SYS_sync] = "sync";
1251 syscall_table[SYS_sys3b] = "sys3b";
1254 syscall_table[SYS_syscall] = "syscall";
1256 #ifdef SYS_sysconfig
1257 syscall_table[SYS_sysconfig] = "sysconfig";
1260 syscall_table[SYS_sysfs] = "sysfs";
1263 syscall_table[SYS_sysi86] = "sysi86";
1266 syscall_table[SYS_sysinfo] = "sysinfo";
1269 syscall_table[SYS_sysmips] = "sysmips";
1272 syscall_table[SYS_syssun] = "syssun";
1274 #ifdef SYS_systeminfo
1275 syscall_table[SYS_systeminfo] = "systeminfo";
1278 syscall_table[SYS_table] = "table";
1281 syscall_table[SYS_time] = "time";
1283 #ifdef SYS_timedwait
1284 syscall_table[SYS_timedwait] = "timedwait";
1286 #ifdef SYS_timer_create
1287 syscall_table[SYS_timer_create] = "timer_create";
1289 #ifdef SYS_timer_delete
1290 syscall_table[SYS_timer_delete] = "timer_delete";
1292 #ifdef SYS_timer_getoverrun
1293 syscall_table[SYS_timer_getoverrun] = "timer_getoverrun";
1295 #ifdef SYS_timer_gettime
1296 syscall_table[SYS_timer_gettime] = "timer_gettime";
1298 #ifdef SYS_timer_settime
1299 syscall_table[SYS_timer_settime] = "timer_settime";
1302 syscall_table[SYS_times] = "times";
1305 syscall_table[SYS_truncate] = "truncate";
1307 #ifdef SYS_truncate64
1308 syscall_table[SYS_truncate64] = "truncate64";
1311 syscall_table[SYS_tsolsys] = "tsolsys";
1314 syscall_table[SYS_uadmin] = "uadmin";
1317 syscall_table[SYS_ulimit] = "ulimit";
1320 syscall_table[SYS_umask] = "umask";
1323 syscall_table[SYS_umount] = "umount";
1326 syscall_table[SYS_uname] = "uname";
1329 syscall_table[SYS_unblock] = "unblock";
1332 syscall_table[SYS_unlink] = "unlink";
1335 syscall_table[SYS_unmount] = "unmount";
1337 #ifdef SYS_usleep_thread
1338 syscall_table[SYS_usleep_thread] = "usleep_thread";
1341 syscall_table[SYS_uswitch] = "uswitch";
1343 #ifdef SYS_utc_adjtime
1344 syscall_table[SYS_utc_adjtime] = "utc_adjtime";
1346 #ifdef SYS_utc_gettime
1347 syscall_table[SYS_utc_gettime] = "utc_gettime";
1350 syscall_table[SYS_utime] = "utime";
1353 syscall_table[SYS_utimes] = "utimes";
1356 syscall_table[SYS_utssys] = "utssys";
1359 syscall_table[SYS_vfork] = "vfork";
1362 syscall_table[SYS_vhangup] = "vhangup";
1365 syscall_table[SYS_vtrace] = "vtrace";
1368 syscall_table[SYS_wait] = "wait";
1371 syscall_table[SYS_waitid] = "waitid";
1374 syscall_table[SYS_waitsys] = "waitsys";
1377 syscall_table[SYS_write] = "write";
1380 syscall_table[SYS_writev] = "writev";
1383 syscall_table[SYS_xenix] = "xenix";
1386 syscall_table[SYS_xmknod] = "xmknod";
1389 syscall_table[SYS_xstat] = "xstat";
1392 syscall_table[SYS_yield] = "yield";
1396 /* Prettyprint syscall NUM. */
1399 proc_prettyfprint_syscall (FILE *file, int num, int verbose)
1401 if (syscall_table[num])
1402 fprintf (file, "SYS_%s ", syscall_table[num]);
1404 fprintf (file, "<Unknown syscall %d> ", num);
1408 proc_prettyprint_syscall (int num, int verbose)
1410 proc_prettyfprint_syscall (stdout, num, verbose);
1413 /* Prettyprint all syscalls in SYSSET. */
1416 proc_prettyfprint_syscalls (FILE *file, sysset_t *sysset, int verbose)
1420 for (i = 0; i < MAX_SYSCALLS; i++)
1421 if (prismember (sysset, i))
1423 proc_prettyfprint_syscall (file, i, verbose);
1425 fprintf (file, "\n");
1429 proc_prettyprint_syscalls (sysset_t *sysset, int verbose)
1431 proc_prettyfprint_syscalls (stdout, sysset, verbose);
1434 /* Prettyprint signals. */
1436 /* Signal translation table. */
1438 static struct trans signal_table[] =
1440 { 0, "<no signal>", "no signal" },
1442 { SIGHUP, "SIGHUP", "Hangup" },
1445 { SIGINT, "SIGINT", "Interrupt (rubout)" },
1448 { SIGQUIT, "SIGQUIT", "Quit (ASCII FS)" },
1451 { SIGILL, "SIGILL", "Illegal instruction" }, /* not reset when caught */
1454 { SIGTRAP, "SIGTRAP", "Trace trap" }, /* not reset when caught */
1457 { SIGABRT, "SIGABRT", "used by abort()" }, /* replaces SIGIOT */
1460 { SIGIOT, "SIGIOT", "IOT instruction" },
1463 { SIGEMT, "SIGEMT", "EMT instruction" },
1466 { SIGFPE, "SIGFPE", "Floating point exception" },
1469 { SIGKILL, "SIGKILL", "Kill" }, /* Solaris: cannot be caught/ignored */
1472 { SIGBUS, "SIGBUS", "Bus error" },
1475 { SIGSEGV, "SIGSEGV", "Segmentation violation" },
1478 { SIGSYS, "SIGSYS", "Bad argument to system call" },
1481 { SIGPIPE, "SIGPIPE", "Write to pipe with no one to read it" },
1484 { SIGALRM, "SIGALRM", "Alarm clock" },
1487 { SIGTERM, "SIGTERM", "Software termination signal from kill" },
1490 { SIGUSR1, "SIGUSR1", "User defined signal 1" },
1493 { SIGUSR2, "SIGUSR2", "User defined signal 2" },
1496 { SIGCHLD, "SIGCHLD", "Child status changed" }, /* Posix version */
1499 { SIGCLD, "SIGCLD", "Child status changed" }, /* Solaris version */
1502 { SIGPWR, "SIGPWR", "Power-fail restart" },
1505 { SIGWINCH, "SIGWINCH", "Window size change" },
1508 { SIGURG, "SIGURG", "Urgent socket condition" },
1511 { SIGPOLL, "SIGPOLL", "Pollable event" },
1514 { SIGIO, "SIGIO", "Socket I/O possible" }, /* alias for SIGPOLL */
1517 { SIGSTOP, "SIGSTOP", "Stop, not from tty" }, /* cannot be caught or ignored */
1520 { SIGTSTP, "SIGTSTP", "User stop from tty" },
1523 { SIGCONT, "SIGCONT", "Stopped process has been continued" },
1526 { SIGTTIN, "SIGTTIN", "Background tty read attempted" },
1529 { SIGTTOU, "SIGTTOU", "Background tty write attempted" },
1532 { SIGVTALRM, "SIGVTALRM", "Virtual timer expired" },
1535 { SIGPROF, "SIGPROF", "Profiling timer expired" },
1538 { SIGXCPU, "SIGXCPU", "Exceeded CPU limit" },
1541 { SIGXFSZ, "SIGXFSZ", "Exceeded file size limit" },
1544 { SIGWAITING, "SIGWAITING", "Process's LWPs are blocked" },
1547 { SIGLWP, "SIGLWP", "Used by thread library" },
1550 { SIGFREEZE, "SIGFREEZE", "Used by CPR" },
1553 { SIGTHAW, "SIGTHAW", "Used by CPR" },
1556 { SIGCANCEL, "SIGCANCEL", "Used by libthread" },
1559 { SIGLOST, "SIGLOST", "Resource lost" },
1562 { SIG32, "SIG32", "Reserved for kernel usage (Irix)" },
1565 { SIGPTINTR, "SIGPTINTR", "Posix 1003.1b" },
1568 { SIGTRESCHED, "SIGTRESCHED", "Posix 1003.1b" },
1571 { SIGINFO, "SIGINFO", "Information request" },
1574 { SIGRESV, "SIGRESV", "Reserved by Digital for future use" },
1577 { SIGAIO, "SIGAIO", "Asynchronous I/O signal" },
1580 /* FIXME: add real-time signals. */
1583 /* Prettyprint signal number SIGNO. */
1586 proc_prettyfprint_signal (FILE *file, int signo, int verbose)
1590 for (i = 0; i < sizeof (signal_table) / sizeof (signal_table[0]); i++)
1591 if (signo == signal_table[i].value)
1593 fprintf (file, "%s", signal_table[i].name);
1595 fprintf (file, ": %s\n", signal_table[i].desc);
1597 fprintf (file, " ");
1600 fprintf (file, "Unknown signal %d%c", signo, verbose ? '\n' : ' ');
1604 proc_prettyprint_signal (int signo, int verbose)
1606 proc_prettyfprint_signal (stdout, signo, verbose);
1609 /* Prettyprint all signals in SIGSET. */
1612 proc_prettyfprint_signalset (FILE *file, sigset_t *sigset, int verbose)
1616 /* Loop over all signal numbers from 0 to NSIG, using them as the
1617 index to prismember. The signal table had better not contain
1618 aliases, for if it does they will both be printed. */
1620 for (i = 0; i < NSIG; i++)
1621 if (prismember (sigset, i))
1622 proc_prettyfprint_signal (file, i, verbose);
1625 fprintf (file, "\n");
1629 proc_prettyprint_signalset (sigset_t *sigset, int verbose)
1631 proc_prettyfprint_signalset (stdout, sigset, verbose);
1635 /* Prettyprint faults. */
1637 /* Fault translation table. */
1639 static struct trans fault_table[] =
1642 { FLTILL, "FLTILL", "Illegal instruction" },
1645 { FLTPRIV, "FLTPRIV", "Privileged instruction" },
1648 { FLTBPT, "FLTBPT", "Breakpoint trap" },
1651 { FLTTRACE, "FLTTRACE", "Trace trap" },
1654 { FLTACCESS, "FLTACCESS", "Memory access fault" },
1657 { FLTBOUNDS, "FLTBOUNDS", "Memory bounds violation" },
1660 { FLTIOVF, "FLTIOVF", "Integer overflow" },
1663 { FLTIZDIV, "FLTIZDIV", "Integer zero divide" },
1666 { FLTFPE, "FLTFPE", "Floating-point exception" },
1669 { FLTSTACK, "FLTSTACK", "Unrecoverable stack fault" },
1672 { FLTPAGE, "FLTPAGE", "Recoverable page fault" },
1675 { FLTPCINVAL, "FLTPCINVAL", "Invalid PC exception" },
1678 { FLTWATCH, "FLTWATCH", "User watchpoint" },
1681 { FLTKWATCH, "FLTKWATCH", "Kernel watchpoint" },
1684 { FLTSCWATCH, "FLTSCWATCH", "Hit a store conditional on a watched page" },
1688 /* Work horse. Accepts an index into the fault table, prints it
1692 prettyfprint_faulttable_entry (FILE *file, int i, int verbose)
1694 fprintf (file, "%s", fault_table[i].name);
1696 fprintf (file, ": %s\n", fault_table[i].desc);
1698 fprintf (file, " ");
1701 /* Prettyprint hardware fault number FAULTNO. */
1704 proc_prettyfprint_fault (FILE *file, int faultno, int verbose)
1708 for (i = 0; i < ARRAY_SIZE (fault_table); i++)
1709 if (faultno == fault_table[i].value)
1711 prettyfprint_faulttable_entry (file, i, verbose);
1715 fprintf (file, "Unknown hardware fault %d%c",
1716 faultno, verbose ? '\n' : ' ');
1720 proc_prettyprint_fault (int faultno, int verbose)
1722 proc_prettyfprint_fault (stdout, faultno, verbose);
1725 /* Prettyprint all faults in FLTSET. */
1728 proc_prettyfprint_faultset (FILE *file, fltset_t *fltset, int verbose)
1732 /* Loop through the fault table, using the value field as the index
1733 to prismember. The fault table had better not contain aliases,
1734 for if it does they will both be printed. */
1736 for (i = 0; i < ARRAY_SIZE (fault_table); i++)
1737 if (prismember (fltset, fault_table[i].value))
1738 prettyfprint_faulttable_entry (file, i, verbose);
1741 fprintf (file, "\n");
1745 proc_prettyprint_faultset (fltset_t *fltset, int verbose)
1747 proc_prettyfprint_faultset (stdout, fltset, verbose);
1750 /* TODO: actions, holds... */
1753 proc_prettyprint_actionset (struct sigaction *actions, int verbose)
1758 /* Provide a prototype to silence -Wmissing-prototypes. */
1759 void _initialize_proc_events (void);
1762 _initialize_proc_events (void)
1764 init_syscall_table ();