1 /* Child process for syn-read test.
2 Reads the contents of a test file a byte at a time, in the
3 hope that this will take long enough that we can get a
4 significant amount of contention in the kernel file system
11 #include "tests/lib.h"
12 #include "tests/filesys/base/syn-read.h"
14 const char *test_name = "child-syn-read";
16 static char buf[BUF_SIZE];
19 main (int argc, const char *argv[])
27 CHECK (argc == 2, "argc must be 2, actually %d", argc);
28 child_idx = atoi (argv[1]);
31 random_bytes (buf, sizeof buf);
33 CHECK ((fd = open (file_name)) > 1, "open \"%s\"", file_name);
34 for (i = 0; i < sizeof buf; i++)
37 CHECK (read (fd, &c, 1) > 0, "read \"%s\"", file_name);
38 compare_bytes (&c, buf + i, 1, i, file_name);