8#include "tests/userprog/sample.inc"
18 CHECK ((handle =
open (
"sample.txt")) > 1,
"open \"sample.txt\"");
20 snprintf (child_cmd,
sizeof child_cmd,
"child-close %d", handle);
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 open(const char *file)
pid_t exec(const char *file)
void msg(const char *format,...)
void check_file_handle(int fd, const char *file_name, const void *buf_, size_t size)
#define CHECK(SUCCESS,...)
Takes an expression to test for SUCCESS and a message, which may include printf-style arguments.
void test_main(void)
Opens a file and then runs a subprocess that tries to close the file.