1 /*
2 * Check decoding of unlinkat syscall.
3 *
4 * Copyright (c) 2016-2021 The strace developers.
5 * All rights reserved.
6 *
7 * SPDX-License-Identifier: GPL-2.0-or-later
8 */
9
10 #include "tests.h"
11 #include "scno.h"
12
13 #include <stdio.h>
14 #include <unistd.h>
15
16 int
17 main(void)
18 {
19 static const char sample[] = "unlinkat_sample";
20 const long fd = (long) 0xdeadbeefffffffffULL;
21
22 long rc = syscall(__NR_unlinkat, fd, sample, 0);
23 printf("unlinkat(%d, \"%s\", 0) = %ld %s (%m)\n",
24 (int) fd, sample, rc, errno2name());
25
26 rc = syscall(__NR_unlinkat, -100, sample, -1L);
27 printf("unlinkat(%s, \"%s\", %s) = %ld %s (%m)\n",
28 "AT_FDCWD", sample,
29 "AT_SYMLINK_NOFOLLOW|AT_REMOVEDIR|AT_SYMLINK_FOLLOW"
30 "|AT_NO_AUTOMOUNT|AT_EMPTY_PATH|AT_RECURSIVE|0xffff60ff",
31 rc, errno2name());
32
33 puts("+++ exited with 0 +++");
34 return 0;
35 }