aboutsummaryrefslogtreecommitdiff
path: root/linux-user/syscall_defs.h
diff options
context:
space:
mode:
authorFilip Bozuta <Filip.Bozuta@syrmia.com>2020-08-24 21:21:15 +0200
committerLaurent Vivier <laurent@vivier.eu>2020-08-28 15:24:20 +0200
commit6ac03b2cacbadbaf631ca16582f0e9b716653a32 (patch)
treeee88d37061c1c0c2da17ca6b23f88fae3251bfef /linux-user/syscall_defs.h
parentd107e375738756b0603ce0dcb5ca460966783909 (diff)
linux-user: Add support for 'clock_nanosleep_time64()' and 'clock_adjtime64()'
This patch implements functionality for following time64 syscall: *clock_nanosleep_time64() This is a year 2038 safe vairant of syscall: int clock_nanosleep(clockid_t clockid, int flags, const struct timespec *request, struct timespec *remain) --high-resolution sleep with specifiable clock-- man page: https://man7.org/linux/man-pages/man2/clock_nanosleep.2.html *clock_adjtime64() This is a year 2038 safe variant of syscall: int clock_adjtime(clockid_t clk_id, struct timex *buf) --tune kernel clock-- man page: https://man7.org/linux/man-pages/man2/clock_adjtime.2.html Implementation notes: Syscall 'clock_nanosleep_time64()' was implemented similarly to syscall 'clock_nanosleep()' except that 'host_to_target_timespec64()' and 'target_to_host_timespec64()' were used instead of the regular 'host_to_target_timespec()' and 'target_to_host_timespec()'. For 'clock_adjtime64()' a 64-bit target kernel version of 'struct timex' was defined in 'syscall_defs.h': 'struct target__kernel_timex'. This type was used to convert the values of 64-bit timex type between host and target. For this purpose a 64-bit timex converting functions 'target_to_host_timex64()' and 'host_to_target_timex64()'. An existing function 'copy_to_user_timeval64()' was used to convert the field 'time' which if of type 'struct timeval' from host to target. Function 'copy_from_user_timveal64()' was added in this patch and used to convert the 'time' field from target to host. Signed-off-by: Filip Bozuta <Filip.Bozuta@syrmia.com> Reviewed-by: Laurent Vivier <laurent@vivier.eu> Message-Id: <20200824192116.65562-2-Filip.Bozuta@syrmia.com> [lv: add missing ifdef's] Signed-off-by: Laurent Vivier <laurent@vivier.eu>
Diffstat (limited to 'linux-user/syscall_defs.h')
-rw-r--r--linux-user/syscall_defs.h31
1 files changed, 31 insertions, 0 deletions
diff --git a/linux-user/syscall_defs.h b/linux-user/syscall_defs.h
index a6abc7e70b..9d07991176 100644
--- a/linux-user/syscall_defs.h
+++ b/linux-user/syscall_defs.h
@@ -294,6 +294,37 @@ struct target_timex {
abi_int:32; abi_int:32; abi_int:32;
};
+struct target__kernel_timex {
+ abi_uint modes; /* Mode selector */
+ abi_int: 32; /* pad */
+ abi_llong offset; /* Time offset */
+ abi_llong freq; /* Frequency offset */
+ abi_llong maxerror; /* Maximum error (microseconds) */
+ abi_llong esterror; /* Estimated error (microseconds) */
+ abi_int status; /* Clock command/status */
+ abi_int: 32; /* pad */
+ abi_llong constant; /* PLL (phase-locked loop) time constant */
+ abi_llong precision; /* Clock precision (microseconds, ro) */
+ abi_llong tolerance; /* Clock freq. tolerance (ppm, ro) */
+ struct target__kernel_sock_timeval time; /* Current time */
+ abi_llong tick; /* Microseconds between clock ticks */
+ abi_llong ppsfreq; /* PPS (pulse per second) frequency */
+ abi_llong jitter; /* PPS jitter (ro); nanoseconds */
+ abi_int shift; /* PPS interval duration (seconds) */
+ abi_int: 32; /* pad */
+ abi_llong stabil; /* PPS stability */
+ abi_llong jitcnt; /* PPS jitter limit exceeded (ro) */
+ abi_llong calcnt; /* PPS calibration intervals */
+ abi_llong errcnt; /* PPS calibration errors */
+ abi_llong stbcnt; /* PPS stability limit exceeded */
+ abi_int tai; /* TAI offset */
+
+ /* Further padding bytes to allow for future expansion */
+ abi_int:32; abi_int:32; abi_int:32; abi_int:32;
+ abi_int:32; abi_int:32; abi_int:32; abi_int:32;
+ abi_int:32; abi_int:32; abi_int:32;
+};
+
typedef abi_long target_clock_t;
#define TARGET_HZ 100