]> granicus.if.org Git - strace/blob - tests/ftruncate.c
Update copyright headers
[strace] / tests / ftruncate.c
1 /*
2  * Copyright (c) 2015-2018 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 <asm/unistd.h>
10
11 #ifdef __NR_ftruncate
12
13 # include <stdio.h>
14 # include <unistd.h>
15
16 int
17 main(void)
18 {
19         const kernel_ulong_t len = (kernel_ulong_t) 0xdefaced0badc0deULL;
20         long rc;
21
22         if (sizeof(len) > sizeof(long))
23                 rc = ftruncate(-1, len);
24         else
25                 rc = syscall(__NR_ftruncate, -1L, len);
26
27         printf("ftruncate(-1, %llu) = %ld %s (%m)\n",
28                (unsigned long long) len, rc, errno2name());
29
30         puts("+++ exited with 0 +++");
31         return 0;
32 }
33
34 #else
35
36 SKIP_MAIN_UNDEFINED("__NR_ftruncate")
37
38 #endif