1 #!/usr/local/bin/rune -x
8 main(int ac, char **av)
14 stdio.stdout->format("Supply filename for flock test\n");
18 if (fs.open(av[1], O_RDWR) < 0) {
19 stdio.stdout->format("open(%s) failed error %d\n",
21 } else if (fs.flock(LOCK_EX | LOCK_NB) < 0) {
22 stdio.stdout->format("flock() failed error %d\n",
25 stdio.stdout->format("flock() suceeded error %d\n",
27 stdio.stdout->format("sleeping for 2 seconds\n");
29 if (fs.flock(LOCK_UN) < 0)
30 stdio.stdout->format("flock(LOCK_UN) "
35 # Should obtain lock on each loop and destructor should
36 # release it on each loop.
38 for (off = 0; off < 1024Z; off += 32Z) {
45 stdio.stdout->format("lock %d\n", off);
47 stdio.stdout->format("result %d --> %d type=%d\n", off, fl.error, fl.type);
49 stdio.stdout->format("unlock %d\n", off);