1 /* Machine-independent support for SVR4 /proc (process file system)
3 Copyright (C) 1999, 2000, 2004 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 2 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, write to the Free Software
20 Foundation, Inc., 51 Franklin Street, Fifth Floor,
21 Boston, MA 02110-1301, USA. */
23 /* Pretty-print "events of interest".
25 This module includes pretty-print routines for:
26 * faults (hardware exceptions)
27 * signals (software interrupts)
30 FIXME: At present, the syscall translation table must be
31 initialized, which is not true of the other translation tables. */
36 #define _STRUCTURED_PROC 1
40 #include <sys/types.h>
41 #include <sys/procfs.h>
42 #ifdef HAVE_SYS_SYSCALL_H
43 #include <sys/syscall.h>
45 #ifdef HAVE_SYS_FAULT_H
46 #include <sys/fault.h>
49 /* Much of the information used in the /proc interface, particularly
50 for printing status information, is kept as tables of structures of
51 the following form. These tables can be used to map numeric values
52 to their symbolic names and to a string that describes their
57 int value
; /* The numeric value. */
58 char *name
; /* The equivalent symbolic value. */
59 char *desc
; /* Short description of value. */
63 /* Pretty print syscalls. */
65 /* Ugh -- UnixWare and Solaris spell these differently! */
68 #define SYS_lwp_create SYS_lwpcreate
72 #define SYS_lwp_exit SYS_lwpexit
76 #define SYS_lwp_wait SYS_lwpwait
80 #define SYS_lwp_self SYS_lwpself
84 #define SYS_lwp_info SYS_lwpinfo
88 #define SYS_lwp_private SYS_lwpprivate
92 #define SYS_lwp_kill SYS_lwpkill
96 #define SYS_lwp_suspend SYS_lwpsuspend
99 #ifdef SYS_lwpcontinue
100 #define SYS_lwp_continue SYS_lwpcontinue
104 /* Syscall translation table. */
106 #define MAX_SYSCALLS 262 /* Pretty arbitrary. */
107 static char *syscall_table
[MAX_SYSCALLS
];
110 init_syscall_table (void)
112 #ifdef SYS_BSD_getime
113 syscall_table
[SYS_BSD_getime
] = "BSD_getime";
115 #ifdef SYS_BSDgetpgrp
116 syscall_table
[SYS_BSDgetpgrp
] = "BSDgetpgrp";
118 #ifdef SYS_BSDsetpgrp
119 syscall_table
[SYS_BSDsetpgrp
] = "BSDsetpgrp";
122 syscall_table
[SYS_acancel
] = "acancel";
125 syscall_table
[SYS_accept
] = "accept";
128 syscall_table
[SYS_access
] = "access";
131 syscall_table
[SYS_acct
] = "acct";
134 syscall_table
[SYS_acl
] = "acl";
137 syscall_table
[SYS_aclipc
] = "aclipc";
140 syscall_table
[SYS_adjtime
] = "adjtime";
142 #ifdef SYS_afs_syscall
143 syscall_table
[SYS_afs_syscall
] = "afs_syscall";
146 syscall_table
[SYS_alarm
] = "alarm";
149 syscall_table
[SYS_alt_plock
] = "alt_plock";
151 #ifdef SYS_alt_sigpending
152 syscall_table
[SYS_alt_sigpending
] = "alt_sigpending";
155 syscall_table
[SYS_async
] = "async";
157 #ifdef SYS_async_daemon
158 syscall_table
[SYS_async_daemon
] = "async_daemon";
161 syscall_table
[SYS_audcntl
] = "audcntl";
164 syscall_table
[SYS_audgen
] = "audgen";
167 syscall_table
[SYS_auditbuf
] = "auditbuf";
170 syscall_table
[SYS_auditctl
] = "auditctl";
173 syscall_table
[SYS_auditdmp
] = "auditdmp";
176 syscall_table
[SYS_auditevt
] = "auditevt";
179 syscall_table
[SYS_auditlog
] = "auditlog";
182 syscall_table
[SYS_auditsys
] = "auditsys";
185 syscall_table
[SYS_bind
] = "bind";
188 syscall_table
[SYS_block
] = "block";
191 syscall_table
[SYS_brk
] = "brk";
194 syscall_table
[SYS_cachectl
] = "cachectl";
196 #ifdef SYS_cacheflush
197 syscall_table
[SYS_cacheflush
] = "cacheflush";
199 #ifdef SYS_cancelblock
200 syscall_table
[SYS_cancelblock
] = "cancelblock";
203 syscall_table
[SYS_cg_bind
] = "cg_bind";
205 #ifdef SYS_cg_current
206 syscall_table
[SYS_cg_current
] = "cg_current";
209 syscall_table
[SYS_cg_ids
] = "cg_ids";
212 syscall_table
[SYS_cg_info
] = "cg_info";
215 syscall_table
[SYS_cg_memloc
] = "cg_memloc";
217 #ifdef SYS_cg_processors
218 syscall_table
[SYS_cg_processors
] = "cg_processors";
221 syscall_table
[SYS_chdir
] = "chdir";
224 syscall_table
[SYS_chflags
] = "chflags";
227 syscall_table
[SYS_chmod
] = "chmod";
230 syscall_table
[SYS_chown
] = "chown";
233 syscall_table
[SYS_chroot
] = "chroot";
236 syscall_table
[SYS_clocal
] = "clocal";
238 #ifdef SYS_clock_getres
239 syscall_table
[SYS_clock_getres
] = "clock_getres";
241 #ifdef SYS_clock_gettime
242 syscall_table
[SYS_clock_gettime
] = "clock_gettime";
244 #ifdef SYS_clock_settime
245 syscall_table
[SYS_clock_settime
] = "clock_settime";
248 syscall_table
[SYS_close
] = "close";
251 syscall_table
[SYS_connect
] = "connect";
254 syscall_table
[SYS_context
] = "context";
257 syscall_table
[SYS_creat
] = "creat";
260 syscall_table
[SYS_creat64
] = "creat64";
263 syscall_table
[SYS_devstat
] = "devstat";
266 syscall_table
[SYS_dmi
] = "dmi";
269 syscall_table
[SYS_door
] = "door";
272 syscall_table
[SYS_dshmsys
] = "dshmsys";
275 syscall_table
[SYS_dup
] = "dup";
278 syscall_table
[SYS_dup2
] = "dup2";
281 syscall_table
[SYS_evsys
] = "evsys";
284 syscall_table
[SYS_evtrapret
] = "evtrapret";
287 syscall_table
[SYS_exec
] = "exec";
289 #ifdef SYS_exec_with_loader
290 syscall_table
[SYS_exec_with_loader
] = "exec_with_loader";
293 syscall_table
[SYS_execv
] = "execv";
296 syscall_table
[SYS_execve
] = "execve";
299 syscall_table
[SYS_exit
] = "exit";
302 syscall_table
[SYS_exportfs
] = "exportfs";
305 syscall_table
[SYS_facl
] = "facl";
308 syscall_table
[SYS_fchdir
] = "fchdir";
311 syscall_table
[SYS_fchflags
] = "fchflags";
314 syscall_table
[SYS_fchmod
] = "fchmod";
317 syscall_table
[SYS_fchown
] = "fchown";
320 syscall_table
[SYS_fchroot
] = "fchroot";
323 syscall_table
[SYS_fcntl
] = "fcntl";
326 syscall_table
[SYS_fdatasync
] = "fdatasync";
329 syscall_table
[SYS_fdevstat
] = "fdevstat";
332 syscall_table
[SYS_fdsync
] = "fdsync";
335 syscall_table
[SYS_filepriv
] = "filepriv";
338 syscall_table
[SYS_flock
] = "flock";
341 syscall_table
[SYS_flvlfile
] = "flvlfile";
344 syscall_table
[SYS_fork
] = "fork";
347 syscall_table
[SYS_fork1
] = "fork1";
350 syscall_table
[SYS_forkall
] = "forkall";
353 syscall_table
[SYS_fpathconf
] = "fpathconf";
356 syscall_table
[SYS_fstat
] = "fstat";
359 syscall_table
[SYS_fstat64
] = "fstat64";
362 syscall_table
[SYS_fstatfs
] = "fstatfs";
365 syscall_table
[SYS_fstatvfs
] = "fstatvfs";
367 #ifdef SYS_fstatvfs64
368 syscall_table
[SYS_fstatvfs64
] = "fstatvfs64";
371 syscall_table
[SYS_fsync
] = "fsync";
374 syscall_table
[SYS_ftruncate
] = "ftruncate";
376 #ifdef SYS_ftruncate64
377 syscall_table
[SYS_ftruncate64
] = "ftruncate64";
380 syscall_table
[SYS_fuser
] = "fuser";
383 syscall_table
[SYS_fxstat
] = "fxstat";
385 #ifdef SYS_get_sysinfo
386 syscall_table
[SYS_get_sysinfo
] = "get_sysinfo";
388 #ifdef SYS_getaddressconf
389 syscall_table
[SYS_getaddressconf
] = "getaddressconf";
391 #ifdef SYS_getcontext
392 syscall_table
[SYS_getcontext
] = "getcontext";
395 syscall_table
[SYS_getdents
] = "getdents";
397 #ifdef SYS_getdents64
398 syscall_table
[SYS_getdents64
] = "getdents64";
400 #ifdef SYS_getdirentries
401 syscall_table
[SYS_getdirentries
] = "getdirentries";
403 #ifdef SYS_getdomainname
404 syscall_table
[SYS_getdomainname
] = "getdomainname";
406 #ifdef SYS_getdtablesize
407 syscall_table
[SYS_getdtablesize
] = "getdtablesize";
410 syscall_table
[SYS_getfh
] = "getfh";
413 syscall_table
[SYS_getfsstat
] = "getfsstat";
416 syscall_table
[SYS_getgid
] = "getgid";
419 syscall_table
[SYS_getgroups
] = "getgroups";
422 syscall_table
[SYS_gethostid
] = "gethostid";
424 #ifdef SYS_gethostname
425 syscall_table
[SYS_gethostname
] = "gethostname";
428 syscall_table
[SYS_getitimer
] = "getitimer";
431 syscall_table
[SYS_getksym
] = "getksym";
434 syscall_table
[SYS_getlogin
] = "getlogin";
437 syscall_table
[SYS_getmnt
] = "getmnt";
440 syscall_table
[SYS_getmsg
] = "getmsg";
442 #ifdef SYS_getpagesize
443 syscall_table
[SYS_getpagesize
] = "getpagesize";
445 #ifdef SYS_getpeername
446 syscall_table
[SYS_getpeername
] = "getpeername";
449 syscall_table
[SYS_getpgid
] = "getpgid";
452 syscall_table
[SYS_getpgrp
] = "getpgrp";
455 syscall_table
[SYS_getpid
] = "getpid";
458 syscall_table
[SYS_getpmsg
] = "getpmsg";
460 #ifdef SYS_getpriority
461 syscall_table
[SYS_getpriority
] = "getpriority";
464 syscall_table
[SYS_getrlimit
] = "getrlimit";
466 #ifdef SYS_getrlimit64
467 syscall_table
[SYS_getrlimit64
] = "getrlimit64";
470 syscall_table
[SYS_getrusage
] = "getrusage";
473 syscall_table
[SYS_getsid
] = "getsid";
475 #ifdef SYS_getsockname
476 syscall_table
[SYS_getsockname
] = "getsockname";
478 #ifdef SYS_getsockopt
479 syscall_table
[SYS_getsockopt
] = "getsockopt";
481 #ifdef SYS_gettimeofday
482 syscall_table
[SYS_gettimeofday
] = "gettimeofday";
485 syscall_table
[SYS_getuid
] = "getuid";
488 syscall_table
[SYS_gtty
] = "gtty";
491 syscall_table
[SYS_hrtsys
] = "hrtsys";
494 syscall_table
[SYS_inst_sync
] = "inst_sync";
496 #ifdef SYS_install_utrap
497 syscall_table
[SYS_install_utrap
] = "install_utrap";
500 syscall_table
[SYS_invlpg
] = "invlpg";
503 syscall_table
[SYS_ioctl
] = "ioctl";
506 syscall_table
[SYS_kaio
] = "kaio";
509 syscall_table
[SYS_keyctl
] = "keyctl";
512 syscall_table
[SYS_kill
] = "kill";
515 syscall_table
[SYS_killpg
] = "killpg";
518 syscall_table
[SYS_kloadcall
] = "kloadcall";
521 syscall_table
[SYS_kmodcall
] = "kmodcall";
523 #ifdef SYS_ksigaction
524 syscall_table
[SYS_ksigaction
] = "ksigaction";
526 #ifdef SYS_ksigprocmask
527 syscall_table
[SYS_ksigprocmask
] = "ksigprocmask";
530 syscall_table
[SYS_ksigqueue
] = "ksigqueue";
533 syscall_table
[SYS_lchown
] = "lchown";
536 syscall_table
[SYS_link
] = "link";
539 syscall_table
[SYS_listen
] = "listen";
542 syscall_table
[SYS_llseek
] = "llseek";
545 syscall_table
[SYS_lseek
] = "lseek";
548 syscall_table
[SYS_lseek64
] = "lseek64";
551 syscall_table
[SYS_lstat
] = "lstat";
554 syscall_table
[SYS_lstat64
] = "lstat64";
557 syscall_table
[SYS_lvldom
] = "lvldom";
560 syscall_table
[SYS_lvlequal
] = "lvlequal";
563 syscall_table
[SYS_lvlfile
] = "lvlfile";
566 syscall_table
[SYS_lvlipc
] = "lvlipc";
569 syscall_table
[SYS_lvlproc
] = "lvlproc";
572 syscall_table
[SYS_lvlvfs
] = "lvlvfs";
575 syscall_table
[SYS_lwp_alarm
] = "lwp_alarm";
577 #ifdef SYS_lwp_cond_broadcast
578 syscall_table
[SYS_lwp_cond_broadcast
] = "lwp_cond_broadcast";
580 #ifdef SYS_lwp_cond_signal
581 syscall_table
[SYS_lwp_cond_signal
] = "lwp_cond_signal";
583 #ifdef SYS_lwp_cond_wait
584 syscall_table
[SYS_lwp_cond_wait
] = "lwp_cond_wait";
586 #ifdef SYS_lwp_continue
587 syscall_table
[SYS_lwp_continue
] = "lwp_continue";
589 #ifdef SYS_lwp_create
590 syscall_table
[SYS_lwp_create
] = "lwp_create";
593 syscall_table
[SYS_lwp_exit
] = "lwp_exit";
595 #ifdef SYS_lwp_getprivate
596 syscall_table
[SYS_lwp_getprivate
] = "lwp_getprivate";
599 syscall_table
[SYS_lwp_info
] = "lwp_info";
602 syscall_table
[SYS_lwp_kill
] = "lwp_kill";
604 #ifdef SYS_lwp_mutex_init
605 syscall_table
[SYS_lwp_mutex_init
] = "lwp_mutex_init";
607 #ifdef SYS_lwp_mutex_lock
608 syscall_table
[SYS_lwp_mutex_lock
] = "lwp_mutex_lock";
610 #ifdef SYS_lwp_mutex_trylock
611 syscall_table
[SYS_lwp_mutex_trylock
] = "lwp_mutex_trylock";
613 #ifdef SYS_lwp_mutex_unlock
614 syscall_table
[SYS_lwp_mutex_unlock
] = "lwp_mutex_unlock";
616 #ifdef SYS_lwp_private
617 syscall_table
[SYS_lwp_private
] = "lwp_private";
620 syscall_table
[SYS_lwp_self
] = "lwp_self";
622 #ifdef SYS_lwp_sema_post
623 syscall_table
[SYS_lwp_sema_post
] = "lwp_sema_post";
625 #ifdef SYS_lwp_sema_trywait
626 syscall_table
[SYS_lwp_sema_trywait
] = "lwp_sema_trywait";
628 #ifdef SYS_lwp_sema_wait
629 syscall_table
[SYS_lwp_sema_wait
] = "lwp_sema_wait";
631 #ifdef SYS_lwp_setprivate
632 syscall_table
[SYS_lwp_setprivate
] = "lwp_setprivate";
634 #ifdef SYS_lwp_sigredirect
635 syscall_table
[SYS_lwp_sigredirect
] = "lwp_sigredirect";
637 #ifdef SYS_lwp_suspend
638 syscall_table
[SYS_lwp_suspend
] = "lwp_suspend";
641 syscall_table
[SYS_lwp_wait
] = "lwp_wait";
644 syscall_table
[SYS_lxstat
] = "lxstat";
647 syscall_table
[SYS_madvise
] = "madvise";
650 syscall_table
[SYS_memcntl
] = "memcntl";
653 syscall_table
[SYS_mincore
] = "mincore";
656 syscall_table
[SYS_mincore
] = "mincore";
659 syscall_table
[SYS_mkdir
] = "mkdir";
662 syscall_table
[SYS_mkmld
] = "mkmld";
665 syscall_table
[SYS_mknod
] = "mknod";
668 syscall_table
[SYS_mldmode
] = "mldmode";
671 syscall_table
[SYS_mmap
] = "mmap";
674 syscall_table
[SYS_mmap64
] = "mmap64";
677 syscall_table
[SYS_modadm
] = "modadm";
680 syscall_table
[SYS_modctl
] = "modctl";
683 syscall_table
[SYS_modload
] = "modload";
686 syscall_table
[SYS_modpath
] = "modpath";
689 syscall_table
[SYS_modstat
] = "modstat";
692 syscall_table
[SYS_moduload
] = "moduload";
695 syscall_table
[SYS_mount
] = "mount";
698 syscall_table
[SYS_mprotect
] = "mprotect";
701 syscall_table
[SYS_mremap
] = "mremap";
703 #ifdef SYS_msfs_syscall
704 syscall_table
[SYS_msfs_syscall
] = "msfs_syscall";
707 syscall_table
[SYS_msgctl
] = "msgctl";
710 syscall_table
[SYS_msgget
] = "msgget";
713 syscall_table
[SYS_msgrcv
] = "msgrcv";
716 syscall_table
[SYS_msgsnd
] = "msgsnd";
719 syscall_table
[SYS_msgsys
] = "msgsys";
722 syscall_table
[SYS_msleep
] = "msleep";
725 syscall_table
[SYS_msync
] = "msync";
728 syscall_table
[SYS_munmap
] = "munmap";
731 syscall_table
[SYS_mvalid
] = "mvalid";
734 syscall_table
[SYS_mwakeup
] = "mwakeup";
737 syscall_table
[SYS_naccept
] = "naccept";
740 syscall_table
[SYS_nanosleep
] = "nanosleep";
743 syscall_table
[SYS_nfssvc
] = "nfssvc";
746 syscall_table
[SYS_nfssys
] = "nfssys";
748 #ifdef SYS_ngetpeername
749 syscall_table
[SYS_ngetpeername
] = "ngetpeername";
751 #ifdef SYS_ngetsockname
752 syscall_table
[SYS_ngetsockname
] = "ngetsockname";
755 syscall_table
[SYS_nice
] = "nice";
758 syscall_table
[SYS_nrecvfrom
] = "nrecvfrom";
761 syscall_table
[SYS_nrecvmsg
] = "nrecvmsg";
764 syscall_table
[SYS_nsendmsg
] = "nsendmsg";
766 #ifdef SYS_ntp_adjtime
767 syscall_table
[SYS_ntp_adjtime
] = "ntp_adjtime";
769 #ifdef SYS_ntp_gettime
770 syscall_table
[SYS_ntp_gettime
] = "ntp_gettime";
773 syscall_table
[SYS_nuname
] = "nuname";
776 syscall_table
[SYS_obreak
] = "obreak";
778 #ifdef SYS_old_accept
779 syscall_table
[SYS_old_accept
] = "old_accept";
782 syscall_table
[SYS_old_fstat
] = "old_fstat";
784 #ifdef SYS_old_getpeername
785 syscall_table
[SYS_old_getpeername
] = "old_getpeername";
787 #ifdef SYS_old_getpgrp
788 syscall_table
[SYS_old_getpgrp
] = "old_getpgrp";
790 #ifdef SYS_old_getsockname
791 syscall_table
[SYS_old_getsockname
] = "old_getsockname";
793 #ifdef SYS_old_killpg
794 syscall_table
[SYS_old_killpg
] = "old_killpg";
797 syscall_table
[SYS_old_lstat
] = "old_lstat";
800 syscall_table
[SYS_old_recv
] = "old_recv";
802 #ifdef SYS_old_recvfrom
803 syscall_table
[SYS_old_recvfrom
] = "old_recvfrom";
805 #ifdef SYS_old_recvmsg
806 syscall_table
[SYS_old_recvmsg
] = "old_recvmsg";
809 syscall_table
[SYS_old_send
] = "old_send";
811 #ifdef SYS_old_sendmsg
812 syscall_table
[SYS_old_sendmsg
] = "old_sendmsg";
814 #ifdef SYS_old_sigblock
815 syscall_table
[SYS_old_sigblock
] = "old_sigblock";
817 #ifdef SYS_old_sigsetmask
818 syscall_table
[SYS_old_sigsetmask
] = "old_sigsetmask";
820 #ifdef SYS_old_sigvec
821 syscall_table
[SYS_old_sigvec
] = "old_sigvec";
824 syscall_table
[SYS_old_stat
] = "old_stat";
826 #ifdef SYS_old_vhangup
827 syscall_table
[SYS_old_vhangup
] = "old_vhangup";
830 syscall_table
[SYS_old_wait
] = "old_wait";
833 syscall_table
[SYS_oldquota
] = "oldquota";
836 syscall_table
[SYS_online
] = "online";
839 syscall_table
[SYS_open
] = "open";
842 syscall_table
[SYS_open64
] = "open64";
845 syscall_table
[SYS_ovadvise
] = "ovadvise";
848 syscall_table
[SYS_p_online
] = "p_online";
851 syscall_table
[SYS_pagelock
] = "pagelock";
854 syscall_table
[SYS_pathconf
] = "pathconf";
857 syscall_table
[SYS_pause
] = "pause";
860 syscall_table
[SYS_pgrpsys
] = "pgrpsys";
863 syscall_table
[SYS_pid_block
] = "pid_block";
865 #ifdef SYS_pid_unblock
866 syscall_table
[SYS_pid_unblock
] = "pid_unblock";
869 syscall_table
[SYS_pipe
] = "pipe";
872 syscall_table
[SYS_plock
] = "plock";
875 syscall_table
[SYS_poll
] = "poll";
878 syscall_table
[SYS_prctl
] = "prctl";
881 syscall_table
[SYS_pread
] = "pread";
884 syscall_table
[SYS_pread64
] = "pread64";
887 syscall_table
[SYS_pread64
] = "pread64";
890 syscall_table
[SYS_prepblock
] = "prepblock";
893 syscall_table
[SYS_priocntl
] = "priocntl";
895 #ifdef SYS_priocntllst
896 syscall_table
[SYS_priocntllst
] = "priocntllst";
898 #ifdef SYS_priocntlset
899 syscall_table
[SYS_priocntlset
] = "priocntlset";
901 #ifdef SYS_priocntlsys
902 syscall_table
[SYS_priocntlsys
] = "priocntlsys";
905 syscall_table
[SYS_procblk
] = "procblk";
907 #ifdef SYS_processor_bind
908 syscall_table
[SYS_processor_bind
] = "processor_bind";
910 #ifdef SYS_processor_exbind
911 syscall_table
[SYS_processor_exbind
] = "processor_exbind";
913 #ifdef SYS_processor_info
914 syscall_table
[SYS_processor_info
] = "processor_info";
917 syscall_table
[SYS_procpriv
] = "procpriv";
920 syscall_table
[SYS_profil
] = "profil";
922 #ifdef SYS_proplist_syscall
923 syscall_table
[SYS_proplist_syscall
] = "proplist_syscall";
926 syscall_table
[SYS_pset
] = "pset";
929 syscall_table
[SYS_ptrace
] = "ptrace";
932 syscall_table
[SYS_putmsg
] = "putmsg";
935 syscall_table
[SYS_putpmsg
] = "putpmsg";
938 syscall_table
[SYS_pwrite
] = "pwrite";
941 syscall_table
[SYS_pwrite64
] = "pwrite64";
944 syscall_table
[SYS_quotactl
] = "quotactl";
947 syscall_table
[SYS_rdblock
] = "rdblock";
950 syscall_table
[SYS_read
] = "read";
953 syscall_table
[SYS_readlink
] = "readlink";
956 syscall_table
[SYS_readv
] = "readv";
959 syscall_table
[SYS_reboot
] = "reboot";
962 syscall_table
[SYS_recv
] = "recv";
965 syscall_table
[SYS_recvfrom
] = "recvfrom";
968 syscall_table
[SYS_recvmsg
] = "recvmsg";
971 syscall_table
[SYS_rename
] = "rename";
973 #ifdef SYS_resolvepath
974 syscall_table
[SYS_resolvepath
] = "resolvepath";
977 syscall_table
[SYS_revoke
] = "revoke";
980 syscall_table
[SYS_rfsys
] = "rfsys";
983 syscall_table
[SYS_rmdir
] = "rmdir";
986 syscall_table
[SYS_rpcsys
] = "rpcsys";
989 syscall_table
[SYS_sbrk
] = "sbrk";
992 syscall_table
[SYS_schedctl
] = "schedctl";
995 syscall_table
[SYS_secadvise
] = "secadvise";
998 syscall_table
[SYS_secsys
] = "secsys";
1001 syscall_table
[SYS_security
] = "security";
1004 syscall_table
[SYS_select
] = "select";
1007 syscall_table
[SYS_semctl
] = "semctl";
1010 syscall_table
[SYS_semget
] = "semget";
1013 syscall_table
[SYS_semop
] = "semop";
1016 syscall_table
[SYS_semsys
] = "semsys";
1019 syscall_table
[SYS_send
] = "send";
1022 syscall_table
[SYS_sendmsg
] = "sendmsg";
1025 syscall_table
[SYS_sendto
] = "sendto";
1027 #ifdef SYS_set_program_attributes
1028 syscall_table
[SYS_set_program_attributes
] = "set_program_attributes";
1030 #ifdef SYS_set_speculative
1031 syscall_table
[SYS_set_speculative
] = "set_speculative";
1033 #ifdef SYS_set_sysinfo
1034 syscall_table
[SYS_set_sysinfo
] = "set_sysinfo";
1036 #ifdef SYS_setcontext
1037 syscall_table
[SYS_setcontext
] = "setcontext";
1039 #ifdef SYS_setdomainname
1040 syscall_table
[SYS_setdomainname
] = "setdomainname";
1043 syscall_table
[SYS_setegid
] = "setegid";
1046 syscall_table
[SYS_seteuid
] = "seteuid";
1049 syscall_table
[SYS_setgid
] = "setgid";
1051 #ifdef SYS_setgroups
1052 syscall_table
[SYS_setgroups
] = "setgroups";
1054 #ifdef SYS_sethostid
1055 syscall_table
[SYS_sethostid
] = "sethostid";
1057 #ifdef SYS_sethostname
1058 syscall_table
[SYS_sethostname
] = "sethostname";
1060 #ifdef SYS_setitimer
1061 syscall_table
[SYS_setitimer
] = "setitimer";
1064 syscall_table
[SYS_setlogin
] = "setlogin";
1067 syscall_table
[SYS_setpgid
] = "setpgid";
1070 syscall_table
[SYS_setpgrp
] = "setpgrp";
1072 #ifdef SYS_setpriority
1073 syscall_table
[SYS_setpriority
] = "setpriority";
1076 syscall_table
[SYS_setregid
] = "setregid";
1079 syscall_table
[SYS_setreuid
] = "setreuid";
1081 #ifdef SYS_setrlimit
1082 syscall_table
[SYS_setrlimit
] = "setrlimit";
1084 #ifdef SYS_setrlimit64
1085 syscall_table
[SYS_setrlimit64
] = "setrlimit64";
1088 syscall_table
[SYS_setsid
] = "setsid";
1090 #ifdef SYS_setsockopt
1091 syscall_table
[SYS_setsockopt
] = "setsockopt";
1093 #ifdef SYS_settimeofday
1094 syscall_table
[SYS_settimeofday
] = "settimeofday";
1097 syscall_table
[SYS_setuid
] = "setuid";
1100 syscall_table
[SYS_sgi
] = "sgi";
1102 #ifdef SYS_sgifastpath
1103 syscall_table
[SYS_sgifastpath
] = "sgifastpath";
1106 syscall_table
[SYS_sgikopt
] = "sgikopt";
1109 syscall_table
[SYS_sginap
] = "sginap";
1112 syscall_table
[SYS_shmat
] = "shmat";
1115 syscall_table
[SYS_shmctl
] = "shmctl";
1118 syscall_table
[SYS_shmdt
] = "shmdt";
1121 syscall_table
[SYS_shmget
] = "shmget";
1124 syscall_table
[SYS_shmsys
] = "shmsys";
1127 syscall_table
[SYS_shutdown
] = "shutdown";
1129 #ifdef SYS_sigaction
1130 syscall_table
[SYS_sigaction
] = "sigaction";
1132 #ifdef SYS_sigaltstack
1133 syscall_table
[SYS_sigaltstack
] = "sigaltstack";
1135 #ifdef SYS_sigaltstack
1136 syscall_table
[SYS_sigaltstack
] = "sigaltstack";
1139 syscall_table
[SYS_sigblock
] = "sigblock";
1142 syscall_table
[SYS_signal
] = "signal";
1144 #ifdef SYS_signotify
1145 syscall_table
[SYS_signotify
] = "signotify";
1147 #ifdef SYS_signotifywait
1148 syscall_table
[SYS_signotifywait
] = "signotifywait";
1150 #ifdef SYS_sigpending
1151 syscall_table
[SYS_sigpending
] = "sigpending";
1154 syscall_table
[SYS_sigpoll
] = "sigpoll";
1156 #ifdef SYS_sigprocmask
1157 syscall_table
[SYS_sigprocmask
] = "sigprocmask";
1160 syscall_table
[SYS_sigqueue
] = "sigqueue";
1162 #ifdef SYS_sigreturn
1163 syscall_table
[SYS_sigreturn
] = "sigreturn";
1165 #ifdef SYS_sigsendset
1166 syscall_table
[SYS_sigsendset
] = "sigsendset";
1168 #ifdef SYS_sigsendsys
1169 syscall_table
[SYS_sigsendsys
] = "sigsendsys";
1171 #ifdef SYS_sigsetmask
1172 syscall_table
[SYS_sigsetmask
] = "sigsetmask";
1175 syscall_table
[SYS_sigstack
] = "sigstack";
1177 #ifdef SYS_sigsuspend
1178 syscall_table
[SYS_sigsuspend
] = "sigsuspend";
1181 syscall_table
[SYS_sigvec
] = "sigvec";
1184 syscall_table
[SYS_sigwait
] = "sigwait";
1186 #ifdef SYS_sigwaitprim
1187 syscall_table
[SYS_sigwaitprim
] = "sigwaitprim";
1190 syscall_table
[SYS_sleep
] = "sleep";
1192 #ifdef SYS_so_socket
1193 syscall_table
[SYS_so_socket
] = "so_socket";
1195 #ifdef SYS_so_socketpair
1196 syscall_table
[SYS_so_socketpair
] = "so_socketpair";
1198 #ifdef SYS_sockconfig
1199 syscall_table
[SYS_sockconfig
] = "sockconfig";
1202 syscall_table
[SYS_socket
] = "socket";
1204 #ifdef SYS_socketpair
1205 syscall_table
[SYS_socketpair
] = "socketpair";
1208 syscall_table
[SYS_sproc
] = "sproc";
1211 syscall_table
[SYS_sprocsp
] = "sprocsp";
1214 syscall_table
[SYS_sstk
] = "sstk";
1217 syscall_table
[SYS_stat
] = "stat";
1220 syscall_table
[SYS_stat64
] = "stat64";
1223 syscall_table
[SYS_statfs
] = "statfs";
1226 syscall_table
[SYS_statvfs
] = "statvfs";
1228 #ifdef SYS_statvfs64
1229 syscall_table
[SYS_statvfs64
] = "statvfs64";
1232 syscall_table
[SYS_stime
] = "stime";
1235 syscall_table
[SYS_stty
] = "stty";
1237 #ifdef SYS_subsys_info
1238 syscall_table
[SYS_subsys_info
] = "subsys_info";
1241 syscall_table
[SYS_swapctl
] = "swapctl";
1244 syscall_table
[SYS_swapon
] = "swapon";
1247 syscall_table
[SYS_symlink
] = "symlink";
1250 syscall_table
[SYS_sync
] = "sync";
1253 syscall_table
[SYS_sys3b
] = "sys3b";
1256 syscall_table
[SYS_syscall
] = "syscall";
1258 #ifdef SYS_sysconfig
1259 syscall_table
[SYS_sysconfig
] = "sysconfig";
1262 syscall_table
[SYS_sysfs
] = "sysfs";
1265 syscall_table
[SYS_sysi86
] = "sysi86";
1268 syscall_table
[SYS_sysinfo
] = "sysinfo";
1271 syscall_table
[SYS_sysmips
] = "sysmips";
1274 syscall_table
[SYS_syssun
] = "syssun";
1276 #ifdef SYS_systeminfo
1277 syscall_table
[SYS_systeminfo
] = "systeminfo";
1280 syscall_table
[SYS_table
] = "table";
1283 syscall_table
[SYS_time
] = "time";
1285 #ifdef SYS_timedwait
1286 syscall_table
[SYS_timedwait
] = "timedwait";
1288 #ifdef SYS_timer_create
1289 syscall_table
[SYS_timer_create
] = "timer_create";
1291 #ifdef SYS_timer_delete
1292 syscall_table
[SYS_timer_delete
] = "timer_delete";
1294 #ifdef SYS_timer_getoverrun
1295 syscall_table
[SYS_timer_getoverrun
] = "timer_getoverrun";
1297 #ifdef SYS_timer_gettime
1298 syscall_table
[SYS_timer_gettime
] = "timer_gettime";
1300 #ifdef SYS_timer_settime
1301 syscall_table
[SYS_timer_settime
] = "timer_settime";
1304 syscall_table
[SYS_times
] = "times";
1307 syscall_table
[SYS_truncate
] = "truncate";
1309 #ifdef SYS_truncate64
1310 syscall_table
[SYS_truncate64
] = "truncate64";
1313 syscall_table
[SYS_tsolsys
] = "tsolsys";
1316 syscall_table
[SYS_uadmin
] = "uadmin";
1319 syscall_table
[SYS_ulimit
] = "ulimit";
1322 syscall_table
[SYS_umask
] = "umask";
1325 syscall_table
[SYS_umount
] = "umount";
1328 syscall_table
[SYS_uname
] = "uname";
1331 syscall_table
[SYS_unblock
] = "unblock";
1334 syscall_table
[SYS_unlink
] = "unlink";
1337 syscall_table
[SYS_unmount
] = "unmount";
1339 #ifdef SYS_usleep_thread
1340 syscall_table
[SYS_usleep_thread
] = "usleep_thread";
1343 syscall_table
[SYS_uswitch
] = "uswitch";
1345 #ifdef SYS_utc_adjtime
1346 syscall_table
[SYS_utc_adjtime
] = "utc_adjtime";
1348 #ifdef SYS_utc_gettime
1349 syscall_table
[SYS_utc_gettime
] = "utc_gettime";
1352 syscall_table
[SYS_utime
] = "utime";
1355 syscall_table
[SYS_utimes
] = "utimes";
1358 syscall_table
[SYS_utssys
] = "utssys";
1361 syscall_table
[SYS_vfork
] = "vfork";
1364 syscall_table
[SYS_vhangup
] = "vhangup";
1367 syscall_table
[SYS_vtrace
] = "vtrace";
1370 syscall_table
[SYS_wait
] = "wait";
1373 syscall_table
[SYS_waitid
] = "waitid";
1376 syscall_table
[SYS_waitsys
] = "waitsys";
1379 syscall_table
[SYS_write
] = "write";
1382 syscall_table
[SYS_writev
] = "writev";
1385 syscall_table
[SYS_xenix
] = "xenix";
1388 syscall_table
[SYS_xmknod
] = "xmknod";
1391 syscall_table
[SYS_xstat
] = "xstat";
1394 syscall_table
[SYS_yield
] = "yield";
1398 /* Prettyprint syscall NUM. */
1401 proc_prettyfprint_syscall (FILE *file
, int num
, int verbose
)
1403 if (syscall_table
[num
])
1404 fprintf (file
, "SYS_%s ", syscall_table
[num
]);
1406 fprintf (file
, "<Unknown syscall %d> ", num
);
1410 proc_prettyprint_syscall (int num
, int verbose
)
1412 proc_prettyfprint_syscall (stdout
, num
, verbose
);
1415 /* Prettyprint all syscalls in SYSSET. */
1418 proc_prettyfprint_syscalls (FILE *file
, sysset_t
*sysset
, int verbose
)
1422 for (i
= 0; i
< MAX_SYSCALLS
; i
++)
1423 if (prismember (sysset
, i
))
1425 proc_prettyfprint_syscall (file
, i
, verbose
);
1427 fprintf (file
, "\n");
1431 proc_prettyprint_syscalls (sysset_t
*sysset
, int verbose
)
1433 proc_prettyfprint_syscalls (stdout
, sysset
, verbose
);
1436 /* Prettyprint signals. */
1438 /* Signal translation table. */
1440 static struct trans signal_table
[] =
1442 { 0, "<no signal>", "no signal" },
1444 { SIGHUP
, "SIGHUP", "Hangup" },
1447 { SIGINT
, "SIGINT", "Interrupt (rubout)" },
1450 { SIGQUIT
, "SIGQUIT", "Quit (ASCII FS)" },
1453 { SIGILL
, "SIGILL", "Illegal instruction" }, /* not reset when caught */
1456 { SIGTRAP
, "SIGTRAP", "Trace trap" }, /* not reset when caught */
1459 { SIGABRT
, "SIGABRT", "used by abort()" }, /* replaces SIGIOT */
1462 { SIGIOT
, "SIGIOT", "IOT instruction" },
1465 { SIGEMT
, "SIGEMT", "EMT instruction" },
1468 { SIGFPE
, "SIGFPE", "Floating point exception" },
1471 { SIGKILL
, "SIGKILL", "Kill" }, /* Solaris: cannot be caught/ignored */
1474 { SIGBUS
, "SIGBUS", "Bus error" },
1477 { SIGSEGV
, "SIGSEGV", "Segmentation violation" },
1480 { SIGSYS
, "SIGSYS", "Bad argument to system call" },
1483 { SIGPIPE
, "SIGPIPE", "Write to pipe with no one to read it" },
1486 { SIGALRM
, "SIGALRM", "Alarm clock" },
1489 { SIGTERM
, "SIGTERM", "Software termination signal from kill" },
1492 { SIGUSR1
, "SIGUSR1", "User defined signal 1" },
1495 { SIGUSR2
, "SIGUSR2", "User defined signal 2" },
1498 { SIGCHLD
, "SIGCHLD", "Child status changed" }, /* Posix version */
1501 { SIGCLD
, "SIGCLD", "Child status changed" }, /* Solaris version */
1504 { SIGPWR
, "SIGPWR", "Power-fail restart" },
1507 { SIGWINCH
, "SIGWINCH", "Window size change" },
1510 { SIGURG
, "SIGURG", "Urgent socket condition" },
1513 { SIGPOLL
, "SIGPOLL", "Pollable event" },
1516 { SIGIO
, "SIGIO", "Socket I/O possible" }, /* alias for SIGPOLL */
1519 { SIGSTOP
, "SIGSTOP", "Stop, not from tty" }, /* cannot be caught or ignored */
1522 { SIGTSTP
, "SIGTSTP", "User stop from tty" },
1525 { SIGCONT
, "SIGCONT", "Stopped process has been continued" },
1528 { SIGTTIN
, "SIGTTIN", "Background tty read attempted" },
1531 { SIGTTOU
, "SIGTTOU", "Background tty write attempted" },
1534 { SIGVTALRM
, "SIGVTALRM", "Virtual timer expired" },
1537 { SIGPROF
, "SIGPROF", "Profiling timer expired" },
1540 { SIGXCPU
, "SIGXCPU", "Exceeded CPU limit" },
1543 { SIGXFSZ
, "SIGXFSZ", "Exceeded file size limit" },
1546 { SIGWAITING
, "SIGWAITING", "Process's LWPs are blocked" },
1549 { SIGLWP
, "SIGLWP", "Used by thread library" },
1552 { SIGFREEZE
, "SIGFREEZE", "Used by CPR" },
1555 { SIGTHAW
, "SIGTHAW", "Used by CPR" },
1558 { SIGCANCEL
, "SIGCANCEL", "Used by libthread" },
1561 { SIGLOST
, "SIGLOST", "Resource lost" },
1564 { SIG32
, "SIG32", "Reserved for kernel usage (Irix)" },
1567 { SIGPTINTR
, "SIGPTINTR", "Posix 1003.1b" },
1570 { SIGTRESCHED
, "SIGTRESCHED", "Posix 1003.1b" },
1573 { SIGINFO
, "SIGINFO", "Information request" },
1576 { SIGRESV
, "SIGRESV", "Reserved by Digital for future use" },
1579 { SIGAIO
, "SIGAIO", "Asynchronous I/O signal" },
1582 /* FIXME: add real-time signals. */
1585 /* Prettyprint signal number SIGNO. */
1588 proc_prettyfprint_signal (FILE *file
, int signo
, int verbose
)
1592 for (i
= 0; i
< sizeof (signal_table
) / sizeof (signal_table
[0]); i
++)
1593 if (signo
== signal_table
[i
].value
)
1595 fprintf (file
, "%s", signal_table
[i
].name
);
1597 fprintf (file
, ": %s\n", signal_table
[i
].desc
);
1599 fprintf (file
, " ");
1602 fprintf (file
, "Unknown signal %d%c", signo
, verbose
? '\n' : ' ');
1606 proc_prettyprint_signal (int signo
, int verbose
)
1608 proc_prettyfprint_signal (stdout
, signo
, verbose
);
1611 /* Prettyprint all signals in SIGSET. */
1614 proc_prettyfprint_signalset (FILE *file
, sigset_t
*sigset
, int verbose
)
1618 /* Loop over all signal numbers from 0 to NSIG, using them as the
1619 index to prismember. The signal table had better not contain
1620 aliases, for if it does they will both be printed. */
1622 for (i
= 0; i
< NSIG
; i
++)
1623 if (prismember (sigset
, i
))
1624 proc_prettyfprint_signal (file
, i
, verbose
);
1627 fprintf (file
, "\n");
1631 proc_prettyprint_signalset (sigset_t
*sigset
, int verbose
)
1633 proc_prettyfprint_signalset (stdout
, sigset
, verbose
);
1637 /* Prettyprint faults. */
1639 /* Fault translation table. */
1641 static struct trans fault_table
[] =
1644 { FLTILL
, "FLTILL", "Illegal instruction" },
1647 { FLTPRIV
, "FLTPRIV", "Privileged instruction" },
1650 { FLTBPT
, "FLTBPT", "Breakpoint trap" },
1653 { FLTTRACE
, "FLTTRACE", "Trace trap" },
1656 { FLTACCESS
, "FLTACCESS", "Memory access fault" },
1659 { FLTBOUNDS
, "FLTBOUNDS", "Memory bounds violation" },
1662 { FLTIOVF
, "FLTIOVF", "Integer overflow" },
1665 { FLTIZDIV
, "FLTIZDIV", "Integer zero divide" },
1668 { FLTFPE
, "FLTFPE", "Floating-point exception" },
1671 { FLTSTACK
, "FLTSTACK", "Unrecoverable stack fault" },
1674 { FLTPAGE
, "FLTPAGE", "Recoverable page fault" },
1677 { FLTPCINVAL
, "FLTPCINVAL", "Invalid PC exception" },
1680 { FLTWATCH
, "FLTWATCH", "User watchpoint" },
1683 { FLTKWATCH
, "FLTKWATCH", "Kernel watchpoint" },
1686 { FLTSCWATCH
, "FLTSCWATCH", "Hit a store conditional on a watched page" },
1690 /* Work horse. Accepts an index into the fault table, prints it
1694 prettyfprint_faulttable_entry (FILE *file
, int i
, int verbose
)
1696 fprintf (file
, "%s", fault_table
[i
].name
);
1698 fprintf (file
, ": %s\n", fault_table
[i
].desc
);
1700 fprintf (file
, " ");
1703 /* Prettyprint hardware fault number FAULTNO. */
1706 proc_prettyfprint_fault (FILE *file
, int faultno
, int verbose
)
1710 for (i
= 0; i
< ARRAY_SIZE (fault_table
); i
++)
1711 if (faultno
== fault_table
[i
].value
)
1713 prettyfprint_faulttable_entry (file
, i
, verbose
);
1717 fprintf (file
, "Unknown hardware fault %d%c",
1718 faultno
, verbose
? '\n' : ' ');
1722 proc_prettyprint_fault (int faultno
, int verbose
)
1724 proc_prettyfprint_fault (stdout
, faultno
, verbose
);
1727 /* Prettyprint all faults in FLTSET. */
1730 proc_prettyfprint_faultset (FILE *file
, fltset_t
*fltset
, int verbose
)
1734 /* Loop through the fault table, using the value field as the index
1735 to prismember. The fault table had better not contain aliases,
1736 for if it does they will both be printed. */
1738 for (i
= 0; i
< ARRAY_SIZE (fault_table
); i
++)
1739 if (prismember (fltset
, fault_table
[i
].value
))
1740 prettyfprint_faulttable_entry (file
, i
, verbose
);
1743 fprintf (file
, "\n");
1747 proc_prettyprint_faultset (fltset_t
*fltset
, int verbose
)
1749 proc_prettyfprint_faultset (stdout
, fltset
, verbose
);
1752 /* TODO: actions, holds... */
1755 proc_prettyprint_actionset (struct sigaction
*actions
, int verbose
)
1760 /* Provide a prototype to silence -Wmissing-prototypes. */
1761 void _initialize_proc_events (void);
1764 _initialize_proc_events (void)
1766 init_syscall_table ();