henesyinit from p9fce6d0435 years agoHistory
69 lines · 1.7 KB · C
RawDownload
/* * code to dump syscall arguments */ #include "defs.h"#include "fns.h"#undef	CHDIR	/* BUG */#include "/sys/src/libc/9syscall/sys.h" char *scalltab[] = {	[SYSR1]		"sysr1()",	[ERRSTR]	"errstr(%lux)",	[BIND]		"bind(%lux, %lux, %lux)",	[CHDIR]		"chdir(%lux)",	[CLOSE]		"close(%lud)",	[DUP]		"dup(%lud, %lud)",	[ALARM]		"alarm(%lud)",	[EXEC]		"exec(%lux, %lux)",	[EXITS]		"exits(%lux)",	[FSESSION]	"session(%lud)",	[FAUTH]		"sysfauth(%lud, %lux)",	[FSTAT]		"fstat(%lud, %lux)",	[SEGBRK]	"segbrk(%lux, %lux)",	[MOUNT]		"mount(%lud, %lux, %lud, %lux)",	[OPEN]		"open(%lux, %luo)",	[READ]		"read(%lud, %lux, %lud)",	[SEEK]		"seek(%lud, %lud, %lud)",	[SLEEP]		"sleep(%lud)",	[STAT]		"stat(%lux, %lux)",	[RFORK]		"rfork(%lux)",	[WRITE]		"write(%lud, %lux, %lud)",	[PIPE]		"pipe(%lux)",	[CREATE]	"create(%lux, %lux, %luo)",	[_X3]		"deprecated()",	[BRK_]		"brk(%lux)",	[REMOVE]	"remove(%lux)",	[WSTAT]		"wstat(%lux, %lux)",	[FWSTAT]	"fwstat(%lud, %lux)",	[NOTIFY]	"notify(%lux)",	[NOTED]		"noted(%lud)",	[SEGATTACH]	"segattach(%lud, %lux, %lux, %lud)",	[SEGDETACH]	"segdetach(%lux)",	[SEGFREE]	"segfree(%lux, %lud)",	[SEGFLUSH]	"segflush(%lux, %lud)",	[RENDEZVOUS]	"rendezvous(%lux, %lud)",	[UNMOUNT]	"unmount(%lux, %lux)",	[WAIT]		"wait(%lux)",}; 	voidprintsyscall(void){	long callnr;	long sargs[5];	ulong args;	int i; 	args = mach->scalloff+mach->kbase;	if (get4(cormap, args, &callnr) < 0)		return;	if (callnr >= sizeof(scalltab)/sizeof(scalltab[0]))			return;	for (args += 4, i = 0; i < 5; i++, args += sizeof(ulong))		if (get4(cormap, args, &sargs[i]) == 0)			return;	dprint(scalltab[callnr], sargs[0], sargs[1], sargs[2], sargs[3], sargs[4]);	dprint("\n");}