CS318 - Pintos
Pintos source browser for JHU CS318 course
|
Go to the documentation of this file.
22 CHECK ((handle =
open (
"child-rox")) > 1,
"open \"child-rox\"");
26 "try to write \"child-rox\"");
38 fail (
"bad command-line arguments");
39 if (
atoi (argv[1]) > 1)
44 snprintf (cmd,
sizeof cmd,
"child-rox %d",
atoi (argv[1]) - 1);
45 CHECK ((child =
exec (cmd)) != -1,
"exec \"%s\"", cmd);
47 CHECK (
wait (child) == 12,
"wait for \"child-rox\"");
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...
const char * test_name
Child process run by rox-child and rox-multichild tests.
int write(int fd, const void *buffer, unsigned size)
#define CHECK(SUCCESS,...)
Takes an expression to test for SUCCESS and a message, which may include printf-style arguments.
int atoi(const char *s)
Converts a string representation of a signed decimal integer in S into an ‘int’, which is returned.
#define UNUSED
GCC lets us add "attributes" to functions, function parameters, etc.
pid_t exec(const char *file)
int open(const char *file)
void fail(const char *format,...)
static void try_write(void)
static void wait(struct intq *q, struct thread **waiter)
void msg(const char *format,...)
static int isdigit(int c)
int main(int argc UNUSED, char *argv[])