2 * See i386-fbsd.c for copyright and license terms.
4 * System call arguments come in several flavours:
5 * Hex -- values that should be printed in hex (addresses)
6 * Octal -- Same as above, but octal
7 * Int -- normal integer values (file descriptors, for example)
8 * LongHex -- long value that should be printed in hex
9 * Name -- pointer to a NULL-terminated string.
10 * BinString -- pointer to an array of chars, printed via strvisx().
11 * Ptr -- pointer to some unspecified structure. Just print as hex for now.
12 * Stat -- a pointer to a stat buffer. Prints a couple fields.
13 * StatFs -- a pointer to a statfs buffer. Prints a few fields.
14 * Ioctl -- an ioctl command. Woefully limited.
15 * Quad -- a double-word value. e.g., lseek(int, offset_t, int)
16 * Signal -- a signal number. Prints the signal name (SIGxxx)
17 * Sockaddr -- a pointer to a struct sockaddr. Prints symbolic AF, and IP:Port
18 * StringArray -- a pointer to an array of string pointers.
19 * Timespec -- a pointer to a struct timespec. Prints both elements.
20 * Timeval -- a pointer to a struct timeval. Prints both elements.
21 * Timeval2 -- a pointer to two struct timevals. Prints both elements of both.
22 * Itimerval -- a pointer to a struct itimerval. Prints all elements.
23 * Pollfd -- a pointer to an array of struct pollfd. Prints .fd and .events.
24 * Fd_set -- a pointer to an array of fd_set. Prints the fds that are set.
25 * Sigaction -- a pointer to a struct sigaction. Prints all elements.
26 * Sigset -- a pointer to a sigset_t. Prints the signals that are set.
27 * Sigprocmask -- the first argument to sigprocmask(). Prints the name.
28 * Kevent -- a pointer to an array of struct kevents. Prints all elements.
29 * Pathconf -- the 2nd argument of pathconf().
31 * In addition, the pointer types (String, Ptr) may have OUT masked in --
32 * this means that the data is set on *return* from the system call -- or
33 * IN (meaning that the data is passed *into* the system call).
39 enum Argtype { None = 1, Hex, Octal, Int, LongHex, Name, Ptr, Stat, Ioctl, Quad,
40 Signal, Sockaddr, StringArray, Timespec, Timeval, Itimerval, Pollfd,
41 Fd_set, Sigaction, Fcntl, Mprot, Mmapflags, Whence, Readlinkres,
42 Sigset, Sigprocmask, StatFs, Kevent, Sockdomain, Socktype, Open,
43 Fcntlflag, Rusage, BinString, Shutdown, Resource, Rlimit, Timeval2,
44 Pathconf, Rforkflags, ExitStatus, Waitoptions, Idtype, Procctl,
45 LinuxSockArgs, Umtxop, Atfd, Atflags, Timespec2, Accessmode, Long,
46 Sysarch, ExecArgs, ExecEnv, PipeFds, QuadHex };
58 STAILQ_ENTRY(syscall) entries;
60 u_int ret_type; /* 0, 1, or 2 return values */
61 u_int nargs; /* actual number of meaningful arguments */
62 /* Hopefully, no syscalls with > 10 args */
63 struct syscall_args args[10];
64 struct timespec time; /* Time spent for this call */
65 int ncalls; /* Number of calls */
66 int nerror; /* Number of calls that returned with error */
69 struct syscall *get_syscall(const char *, int nargs);
70 char *print_arg(struct syscall_args *, unsigned long*, long *, struct trussinfo *);
73 * Linux Socket defines
75 #define LINUX_SOCKET 1
77 #define LINUX_CONNECT 3
78 #define LINUX_LISTEN 4
79 #define LINUX_ACCEPT 5
80 #define LINUX_GETSOCKNAME 6
81 #define LINUX_GETPEERNAME 7
82 #define LINUX_SOCKETPAIR 8
85 #define LINUX_SENDTO 11
86 #define LINUX_RECVFROM 12
87 #define LINUX_SHUTDOWN 13
88 #define LINUX_SETSOCKOPT 14
89 #define LINUX_GETSOCKOPT 15
90 #define LINUX_SENDMSG 16
91 #define LINUX_RECVMSG 17
93 #define PAD_(t) (sizeof(register_t) <= sizeof(t) ? \
94 0 : sizeof(register_t) - sizeof(t))
96 #if BYTE_ORDER == LITTLE_ENDIAN
98 #define PADR_(t) PAD_(t)
100 #define PADL_(t) PAD_(t)
105 typedef uint32_t l_ulong;
107 struct linux_socketcall_args {
108 char what_l_[PADL_(l_int)]; l_int what; char what_r_[PADR_(l_int)];
109 char args_l_[PADL_(l_ulong)]; l_ulong args; char args_r_[PADR_(l_ulong)];
112 void init_syscalls(void);
113 void print_syscall(struct trussinfo *, const char *, int, char **);
114 void print_syscall_ret(struct trussinfo *, const char *, int, char **, int,
115 long *, struct syscall *);
116 void print_summary(struct trussinfo *trussinfo);