]> granicus.if.org Git - strace/blob - tests/flock.c
tests: add flock.test
[strace] / tests / flock.c
1 #include "tests.h"
2 #include <sys/syscall.h>
3
4 #ifdef __NR_flock
5
6 # include <errno.h>
7 # include <sys/file.h>
8 # include <stdio.h>
9 # include <unistd.h>
10
11 int
12 main(void)
13 {
14         const unsigned long fd = (long int) 0xdeadbeefffffffff;
15         int rc = syscall(__NR_flock, fd, LOCK_SH);
16         printf("flock(%d, LOCK_SH) = %d %s (%m)\n",
17                (int) fd, rc,
18                errno == ENOSYS ? "ENOSYS" : "EBADF");
19
20         puts("+++ exited with 0 +++");
21         return 0;
22 }
23
24 #else
25
26 SKIP_MAIN_UNDEFINED("__NR_flock")
27
28 #endif