xref: /freebsd/usr.bin/truss/syscall.h (revision a8445737e740901f5f2c8d24c12ef7fc8b00134e)
1 /*
2  * See i386-fbsd.c for copyright and license terms.
3  *
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  * String -- pointers to sensible data.  Note that we treat read() and
9  *	write() arguments as such, even though they may *not* be
10  *	printable data.
11  * Ptr -- pointer to some specific structure.  Just print as hex for now.
12  * Quad -- a double-word value.  e.g., lseek(int, offset_t, int)
13  * Stat -- a pointer to a stat buffer.  Currently unused.
14  * Ioctl -- an ioctl command.  Woefully limited.
15  *
16  * In addition, the pointer types (String, Ptr) may have OUT masked in --
17  * this means that the data is set on *return* from the system call -- or
18  * IN (meaning that the data is passed *into* the system call).
19  */
20 /*
21  * $Id: syscall.h,v 1.2 1997/12/06 06:51:13 sef Exp $
22  */
23 
24 enum Argtype { None = 1, Hex, Octal, Int, String, Ptr, Stat, Ioctl, Quad };
25 
26 #define ARG_MASK	0xff
27 #define OUT	0x100
28 #define IN	/*0x20*/0
29 
30 struct syscall_args {
31 	enum Argtype type;
32 	int offset;
33 };
34 
35 struct syscall {
36 	char *name;
37 	int ret_type;	/* 0, 1, or 2 return values */
38 	int nargs;	/* actual number of meaningful arguments */
39 			/* Hopefully, no syscalls with > 10 args */
40 	struct syscall_args args[10];
41 };
42 
43 struct syscall *get_syscall(const char*);
44 char *get_string(int, void*, int);
45 char *print_arg(int, struct syscall_args *, unsigned long*);
46 void print_syscall(FILE *, const char *, int, char **);
47