1 /* Opens a file and then runs a subprocess that tries to close
2 the file. (Pintos does not have inheritance of file handles,
3 so this must fail.) The parent process then attempts to use
4 the file handle, which must succeed. */
8 #include "tests/userprog/sample.inc"
10 #include "tests/main.h"
18 CHECK ((handle = open ("sample.txt")) > 1, "open \"sample.txt\"");
20 snprintf (child_cmd, sizeof child_cmd, "child-close %d", handle);
22 msg ("wait(exec()) = %d", wait (exec (child_cmd)));
24 check_file_handle (handle, "sample.txt", sample, sizeof sample - 1);