1 /* clock_adjtime -- tune kernel clock.
2 Copyright (C) 2020-2021 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public License as
7 published by the Free Software Foundation; either version 2.1 of the
8 License, or (at your option) any later version.
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; see the file COPYING.LIB. If
17 not, see <https://www.gnu.org/licenses/>. */
23 #include <sys/timex.h>
24 #include <kernel-features.h>
27 __clock_adjtime64 (const clockid_t clock_id
, struct __timex64
*tx64
)
29 #ifndef __NR_clock_adjtime64
30 # define __NR_clock_adjtime64 __NR_clock_adjtime
32 int r
= INLINE_SYSCALL_CALL (clock_adjtime64
, clock_id
, tx64
);
33 #ifndef __ASSUME_TIME64_SYSCALLS
34 if (r
>= 0 || errno
!= ENOSYS
)
37 if (tx64
->modes
& ADJ_SETOFFSET
38 && ! in_time_t_range (tx64
->time
.tv_sec
))
40 __set_errno (EOVERFLOW
);
44 struct timex tx32
= valid_timex64_to_timex (*tx64
);
45 r
= INLINE_SYSCALL_CALL (clock_adjtime
, clock_id
, &tx32
);
47 *tx64
= valid_timex_to_timex64 (tx32
);
53 libc_hidden_def (__clock_adjtime64
)
56 __clock_adjtime (const clockid_t clock_id
, struct timex
*tx
)
58 struct __timex64 tx64
;
61 tx64
= valid_timex_to_timex64 (*tx
);
62 retval
= __clock_adjtime64 (clock_id
, &tx64
);
64 *tx
= valid_timex64_to_timex (tx64
);
69 libc_hidden_def (__clock_adjtime
);
70 strong_alias (__clock_adjtime
, clock_adjtime
)