1 #include "tests.h"
2 #include <asm/unistd.h>
3 
4 #ifdef __NR_unlinkat
5 
6 # include <stdio.h>
7 # include <unistd.h>
8 
9 int
main(void)10 main(void)
11 {
12 	static const char sample[] = "unlinkat_sample";
13 	const long fd = (long) 0xdeadbeefffffffffULL;
14 
15 	long rc = syscall(__NR_unlinkat, fd, sample, 0);
16 	printf("unlinkat(%d, \"%s\", 0) = %ld %s (%m)\n",
17 	       (int) fd, sample, rc, errno2name());
18 
19 	rc = syscall(__NR_unlinkat, -100, sample, -1L);
20 	printf("unlinkat(%s, \"%s\", %s) = %ld %s (%m)\n",
21 	       "AT_FDCWD", sample,
22 	       "AT_SYMLINK_NOFOLLOW|AT_REMOVEDIR|AT_SYMLINK_FOLLOW"
23 	       "|AT_NO_AUTOMOUNT|AT_EMPTY_PATH|0xffffe0ff",
24 	       rc, errno2name());
25 
26 	puts("+++ exited with 0 +++");
27 	return 0;
28 }
29 
30 #else
31 
32 SKIP_MAIN_UNDEFINED("__NR_unlinkat")
33 
34 #endif
35