]> granicus.if.org Git - strace/blob - tests/clock_adjtime.c
350e58d9f44f1c28bb915f3086997c04c53f5b93
[strace] / tests / clock_adjtime.c
1 /*
2  * This file is part of clock_adjtime strace test.
3  *
4  * Copyright (c) 2016 Dmitry V. Levin <ldv@altlinux.org>
5  * All rights reserved.
6  *
7  * SPDX-License-Identifier: GPL-2.0-or-later
8  */
9
10 #include "tests.h"
11 #include <asm/unistd.h>
12
13 #ifdef __NR_clock_adjtime
14
15 # include <stdio.h>
16 # include <time.h>
17 # include <unistd.h>
18
19 int
20 main(void)
21 {
22         long rc = syscall(__NR_clock_adjtime, CLOCK_MONOTONIC, NULL);
23         printf("clock_adjtime(CLOCK_MONOTONIC, NULL) = %ld %s (%m)\n",
24                rc, errno2name());
25
26         void *efault = tail_alloc(1);
27
28         rc = syscall(__NR_clock_adjtime, CLOCK_REALTIME, efault);
29         printf("clock_adjtime(CLOCK_REALTIME, %p) = %ld %s (%m)\n",
30                efault, rc, errno2name());
31
32         puts("+++ exited with 0 +++");
33         return 0;
34 }
35
36 #else
37
38 SKIP_MAIN_UNDEFINED("__NR_clock_adjtime")
39
40 #endif