shithub: fuzz

Download patch

ref: 0816384f438348f9b5276ecd05c4e6db02775194
parent: 5c482db8cb339cb16bfb356c6d1bbf27d30351df
author: seh <seh@localhost>
date: Sun Nov 25 12:53:03 EST 2018

quality of life ;; add fuzz ? call to print all call names

--- a/README.md
+++ b/README.md
@@ -14,6 +14,10 @@
 
 	mk install
 
+## Building in debug mode
+
+	mk debug
+
 ## Usage
 
 To perform up to round 5 of fuzzing for the read, write, open, and close calls:
@@ -20,7 +24,11 @@
 
 	fuzz -n 5 read write open close
 
-## Recommended reading
+A list of all known system call names can be printed:
+
+	fuzz ?
+
+## Recommended reading for further development
 
 - http://doc.cat-v.org/plan_9/4th_edition/papers/comp
 - http://doc.cat-v.org/plan_9/programming/c_programming_in_plan_9
--- a/fuzz.man
+++ b/fuzz.man
@@ -25,6 +25,11 @@
 .PP
 .SH EXAMPLES
 
+To print all system calls known by fuzz:
+.EX
+fuzz ?
+.EE
+
 To fuzz the read and write system calls for two rounds:
 .EX
 fuzz -n 2 read write
--- a/main.c
+++ b/main.c
@@ -78,6 +78,14 @@
 	// Initialize the table of all system calls
 	initsctable();
 
+	// If the call name '?' is specified as the first argument, print all call names
+	if(strcmp(*argv, "?") == 0){
+		int i;
+		for(i = 0; i < NCALLS; i++)
+			print("%s\n", callnames[i]);
+		exits("Listing all known system calls");
+	}
+	
 	// Acquire a list of calls specified by spaces (fuzz -n 1 read write seek)
 	for(;*argv;argv++){
 		int index;