]> granicus.if.org Git - strace/blob - tests/umount2.c
tests: change the license to GPL-2.0-or-later
[strace] / tests / umount2.c
1 /*
2  * Copyright (c) 2015-2016 Dmitry V. Levin <ldv@altlinux.org>
3  * All rights reserved.
4  *
5  * SPDX-License-Identifier: GPL-2.0-or-later
6  */
7
8 #include "tests.h"
9 #include <stdio.h>
10 #include <unistd.h>
11 #include <sys/stat.h>
12 #include <sys/mount.h>
13 #include <asm/unistd.h>
14
15 #ifdef __NR_umount2
16 # define TEST_SYSCALL_STR "umount2"
17 #else
18 # define __NR_umount2 __NR_umount
19 # define TEST_SYSCALL_STR "umount"
20 #endif
21
22 int
23 main(void)
24 {
25         static const char sample[] = "umount2.sample";
26         if (mkdir(sample, 0700))
27                 perror_msg_and_fail("mkdir: %s", sample);
28         (void) syscall(__NR_umount2, sample, 31);
29         printf("%s(\"%s\", MNT_FORCE|MNT_DETACH|MNT_EXPIRE|UMOUNT_NOFOLLOW|0x10)"
30                " = -1 EINVAL (%m)\n", TEST_SYSCALL_STR, sample);
31         if (rmdir(sample))
32                 perror_msg_and_fail("rmdir: %s", sample);
33         puts("+++ exited with 0 +++");
34         return 0;
35 }