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 filesystem
11 #include "tests/lib.h"
12 #include "tests/filesys/base/syn-read.h"
14 static char buf[BUF_SIZE];
17 main (int argc, const char *argv[])
25 CHECK (argc == 2, "argc must be 2, actually %d", argc);
26 child_idx = atoi (argv[1]);
29 random_bytes (buf, sizeof buf);
31 CHECK ((fd = open (filename)) > 1, "open \"%s\"", filename);
32 for (i = 0; i < sizeof buf; i++)
35 CHECK (read (fd, &c, 1) > 0, "read \"%s\"", filename);
36 compare_bytes (&c, buf + i, 1, i, filename);