15 int n =
atoi (argv[1]);
24 snprintf (child_cmd,
sizeof child_cmd,
"multi-recurse %d", n - 1);
25 CHECK ((child_pid =
exec (child_cmd)) != -1,
"exec(\"%s\")", child_cmd);
27 code =
wait (child_pid);
29 fail (
"wait(exec(\"%s\")) returned %d", child_cmd, code);
#define UNUSED
GCC lets us add "attributes" to functions, function parameters, etc.
static void wait(struct intq *q, struct thread **waiter)
int snprintf(char *buffer, size_t buf_size, const char *format,...)
Like printf(), except that output is stored into BUFFER, which must have space for BUF_SIZE character...
int atoi(const char *s)
Converts a string representation of a signed decimal integer in S into an ‘int’, which is returned.
pid_t exec(const char *file)
int pid_t
Process identifier.
void fail(const char *format,...)
void msg(const char *format,...)
#define CHECK(SUCCESS,...)
Takes an expression to test for SUCCESS and a message, which may include printf-style arguments.
int main(int argc UNUSED, char *argv[])
const char * test_name
Executes itself recursively to the depth indicated by the first command-line argument.