summary refs log tree commit diff stats
path: root/hw/usb/dev-hid.c
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 /hw/usb/dev-hid.c
parentd107e375738756b0603ce0dcb5ca460966783909 (diff)
downloadfocaccia-qemu-6ac03b2cacbadbaf631ca16582f0e9b716653a32.tar.gz
focaccia-qemu-6ac03b2cacbadbaf631ca16582f0e9b716653a32.zip
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 'hw/usb/dev-hid.c')
0 files changed, 0 insertions, 0 deletions