From 0bb7e2cddcd0fe0fb377105a32b6213479abaa7a Mon Sep 17 00:00:00 2001 From: sinetek Date: Tue, 11 May 2021 07:34:58 +0200 Subject: [PATCH] [linuxulator] add 4 calls for 64-bit compat on 32-bit intel. As of now these use the existing 32-bit system calls. * linux_utimensat_time64 * linux_clock_gettime64 * linux_clock_getres_time64 * linux_clock_nanosleep_time64 --- sys/amd64/linux32/linux.h | 5 + sys/amd64/linux32/linux32_dummy_machdep.c | 4 - sys/amd64/linux32/linux32_proto.h | 16 +- sys/amd64/linux32/linux32_sysent.c | 8 +- sys/amd64/linux32/linux32_systrace_args.c | 88 +++++- sys/amd64/linux32/syscalls.master | 24 +- sys/compat/linux/linux_misc.c | 86 ++++++ sys/compat/linux/linux_time.c | 354 ++++++++++++++++++++++ sys/compat/linux/linux_timer.h | 6 + sys/i386/linux/linux.h | 5 + sys/i386/linux/linux_dummy_machdep.c | 4 - sys/i386/linux/linux_proto.h | 16 +- sys/i386/linux/linux_sysent.c | 8 +- sys/i386/linux/linux_systrace_args.c | 88 +++++- sys/i386/linux/syscalls.master | 24 +- 15 files changed, 696 insertions(+), 40 deletions(-) diff --git a/sys/amd64/linux32/linux.h b/sys/amd64/linux32/linux.h index 244daba4b5c0..00ab485228a6 100644 --- a/sys/amd64/linux32/linux.h +++ b/sys/amd64/linux32/linux.h @@ -171,6 +171,11 @@ struct l_timespec { l_long tv_nsec; } __packed; +struct l_timespec64 { + l_ulonglong tv_sec; + l_long tv_nsec; +} __packed; + struct l_newstat { l_ushort st_dev; l_ushort __pad1; diff --git a/sys/amd64/linux32/linux32_dummy_machdep.c b/sys/amd64/linux32/linux32_dummy_machdep.c index 5eb54fefd276..988bcf170bb4 100644 --- a/sys/amd64/linux32/linux32_dummy_machdep.c +++ b/sys/amd64/linux32/linux32_dummy_machdep.c @@ -67,16 +67,12 @@ DUMMY(mq_getsetattr); /* Linux 4.11: */ DUMMY(arch_prctl); /* Linux 5.0: */ -DUMMY(clock_gettime64); DUMMY(clock_settime64); DUMMY(clock_adjtime64); -DUMMY(clock_getres_time64); -DUMMY(clock_nanosleep_time64); DUMMY(timer_gettime64); DUMMY(timer_settime64); DUMMY(timerfd_gettime64); DUMMY(timerfd_settime64); -DUMMY(utimensat_time64); DUMMY(pselect6_time64); DUMMY(ppoll_time64); DUMMY(io_pgetevents_time64); diff --git a/sys/amd64/linux32/linux32_proto.h b/sys/amd64/linux32/linux32_proto.h index f9402c8e815b..e161727e01ff 100644 --- a/sys/amd64/linux32/linux32_proto.h +++ b/sys/amd64/linux32/linux32_proto.h @@ -1519,7 +1519,8 @@ struct linux_msgctl_args { char buf_l_[PADL_(struct l_msqid_ds *)]; struct l_msqid_ds * buf; char buf_r_[PADR_(struct l_msqid_ds *)]; }; struct linux_clock_gettime64_args { - register_t dummy; + char which_l_[PADL_(clockid_t)]; clockid_t which; char which_r_[PADR_(clockid_t)]; + char tp64_l_[PADL_(struct l_timespec64 *)]; struct l_timespec64 * tp64; char tp64_r_[PADR_(struct l_timespec64 *)]; }; struct linux_clock_settime64_args { register_t dummy; @@ -1528,10 +1529,14 @@ struct linux_clock_adjtime64_args { register_t dummy; }; struct linux_clock_getres_time64_args { - register_t dummy; + char which_l_[PADL_(clockid_t)]; clockid_t which; char which_r_[PADR_(clockid_t)]; + char tp64_l_[PADL_(struct l_timespec64 *)]; struct l_timespec64 * tp64; char tp64_r_[PADR_(struct l_timespec64 *)]; }; struct linux_clock_nanosleep_time64_args { - register_t dummy; + char which_l_[PADL_(clockid_t)]; clockid_t which; char which_r_[PADR_(clockid_t)]; + char flags_l_[PADL_(int)]; int flags; char flags_r_[PADR_(int)]; + char rqtp64_l_[PADL_(struct l_timespec64 *)]; struct l_timespec64 * rqtp64; char rqtp64_r_[PADR_(struct l_timespec64 *)]; + char rmtp64_l_[PADL_(struct l_timespec64 *)]; struct l_timespec64 * rmtp64; char rmtp64_r_[PADR_(struct l_timespec64 *)]; }; struct linux_timer_gettime64_args { register_t dummy; @@ -1546,7 +1551,10 @@ struct linux_timerfd_settime64_args { register_t dummy; }; struct linux_utimensat_time64_args { - register_t dummy; + char dfd_l_[PADL_(l_int)]; l_int dfd; char dfd_r_[PADR_(l_int)]; + char pathname_l_[PADL_(const char *)]; const char * pathname; char pathname_r_[PADR_(const char *)]; + char times64_l_[PADL_(const struct l_timespec64 *)]; const struct l_timespec64 * times64; char times64_r_[PADR_(const struct l_timespec64 *)]; + char flags_l_[PADL_(l_int)]; l_int flags; char flags_r_[PADR_(l_int)]; }; struct linux_pselect6_time64_args { register_t dummy; diff --git a/sys/amd64/linux32/linux32_sysent.c b/sys/amd64/linux32/linux32_sysent.c index 6da5fcb1fad9..d529033d031a 100644 --- a/sys/amd64/linux32/linux32_sysent.c +++ b/sys/amd64/linux32/linux32_sysent.c @@ -420,16 +420,16 @@ struct sysent linux32_sysent[] = { { .sy_narg = AS(linux_msgsnd_args), .sy_call = (sy_call_t *)linux_msgsnd, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 400 = linux_msgsnd */ { .sy_narg = AS(linux_msgrcv_args), .sy_call = (sy_call_t *)linux_msgrcv, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 401 = linux_msgrcv */ { .sy_narg = AS(linux_msgctl_args), .sy_call = (sy_call_t *)linux_msgctl, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 402 = linux_msgctl */ - { .sy_narg = 0, .sy_call = (sy_call_t *)linux_clock_gettime64, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 403 = linux_clock_gettime64 */ + { .sy_narg = AS(linux_clock_gettime64_args), .sy_call = (sy_call_t *)linux_clock_gettime64, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 403 = linux_clock_gettime64 */ { .sy_narg = 0, .sy_call = (sy_call_t *)linux_clock_settime64, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 404 = linux_clock_settime64 */ { .sy_narg = 0, .sy_call = (sy_call_t *)linux_clock_adjtime64, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 405 = linux_clock_adjtime64 */ - { .sy_narg = 0, .sy_call = (sy_call_t *)linux_clock_getres_time64, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 406 = linux_clock_getres_time64 */ - { .sy_narg = 0, .sy_call = (sy_call_t *)linux_clock_nanosleep_time64, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 407 = linux_clock_nanosleep_time64 */ + { .sy_narg = AS(linux_clock_getres_time64_args), .sy_call = (sy_call_t *)linux_clock_getres_time64, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 406 = linux_clock_getres_time64 */ + { .sy_narg = AS(linux_clock_nanosleep_time64_args), .sy_call = (sy_call_t *)linux_clock_nanosleep_time64, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 407 = linux_clock_nanosleep_time64 */ { .sy_narg = 0, .sy_call = (sy_call_t *)linux_timer_gettime64, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 408 = linux_timer_gettime64 */ { .sy_narg = 0, .sy_call = (sy_call_t *)linux_timer_settime64, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 409 = linux_timer_settime64 */ { .sy_narg = 0, .sy_call = (sy_call_t *)linux_timerfd_gettime64, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 410 = linux_timerfd_gettime64 */ { .sy_narg = 0, .sy_call = (sy_call_t *)linux_timerfd_settime64, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 411 = linux_timerfd_settime64 */ - { .sy_narg = 0, .sy_call = (sy_call_t *)linux_utimensat_time64, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 412 = linux_utimensat_time64 */ + { .sy_narg = AS(linux_utimensat_time64_args), .sy_call = (sy_call_t *)linux_utimensat_time64, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 412 = linux_utimensat_time64 */ { .sy_narg = 0, .sy_call = (sy_call_t *)linux_pselect6_time64, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 413 = linux_pselect6_time64 */ { .sy_narg = 0, .sy_call = (sy_call_t *)linux_ppoll_time64, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 414 = linux_ppoll_time64 */ { .sy_narg = 0, .sy_call = (sy_call_t *)nosys, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_ABSENT }, /* 415 = nosys */ diff --git a/sys/amd64/linux32/linux32_systrace_args.c b/sys/amd64/linux32/linux32_systrace_args.c index 8e2c11e380c2..6c15548fcdf1 100644 --- a/sys/amd64/linux32/linux32_systrace_args.c +++ b/sys/amd64/linux32/linux32_systrace_args.c @@ -2962,7 +2962,10 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) } /* linux_clock_gettime64 */ case 403: { - *n_args = 0; + struct linux_clock_gettime64_args *p = params; + iarg[0] = p->which; /* clockid_t */ + uarg[1] = (intptr_t) p->tp64; /* struct l_timespec64 * */ + *n_args = 2; break; } /* linux_clock_settime64 */ @@ -2977,12 +2980,20 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) } /* linux_clock_getres_time64 */ case 406: { - *n_args = 0; + struct linux_clock_getres_time64_args *p = params; + iarg[0] = p->which; /* clockid_t */ + uarg[1] = (intptr_t) p->tp64; /* struct l_timespec64 * */ + *n_args = 2; break; } /* linux_clock_nanosleep_time64 */ case 407: { - *n_args = 0; + struct linux_clock_nanosleep_time64_args *p = params; + iarg[0] = p->which; /* clockid_t */ + iarg[1] = p->flags; /* int */ + uarg[2] = (intptr_t) p->rqtp64; /* struct l_timespec64 * */ + uarg[3] = (intptr_t) p->rmtp64; /* struct l_timespec64 * */ + *n_args = 4; break; } /* linux_timer_gettime64 */ @@ -3007,7 +3018,12 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) } /* linux_utimensat_time64 */ case 412: { - *n_args = 0; + struct linux_utimensat_time64_args *p = params; + iarg[0] = p->dfd; /* l_int */ + uarg[1] = (intptr_t) p->pathname; /* const char * */ + uarg[2] = (intptr_t) p->times64; /* const struct l_timespec64 * */ + iarg[3] = p->flags; /* l_int */ + *n_args = 4; break; } /* linux_pselect6_time64 */ @@ -7911,6 +7927,16 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *desc, size_t descsz) break; /* linux_clock_gettime64 */ case 403: + switch(ndx) { + case 0: + p = "clockid_t"; + break; + case 1: + p = "userland struct l_timespec64 *"; + break; + default: + break; + }; break; /* linux_clock_settime64 */ case 404: @@ -7920,9 +7946,35 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *desc, size_t descsz) break; /* linux_clock_getres_time64 */ case 406: + switch(ndx) { + case 0: + p = "clockid_t"; + break; + case 1: + p = "userland struct l_timespec64 *"; + break; + default: + break; + }; break; /* linux_clock_nanosleep_time64 */ case 407: + switch(ndx) { + case 0: + p = "clockid_t"; + break; + case 1: + p = "int"; + break; + case 2: + p = "userland struct l_timespec64 *"; + break; + case 3: + p = "userland struct l_timespec64 *"; + break; + default: + break; + }; break; /* linux_timer_gettime64 */ case 408: @@ -7938,6 +7990,22 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *desc, size_t descsz) break; /* linux_utimensat_time64 */ case 412: + switch(ndx) { + case 0: + p = "l_int"; + break; + case 1: + p = "userland const char *"; + break; + case 2: + p = "userland const struct l_timespec64 *"; + break; + case 3: + p = "l_int"; + break; + default: + break; + }; break; /* linux_pselect6_time64 */ case 413: @@ -9636,14 +9704,23 @@ systrace_return_setargdesc(int sysnum, int ndx, char *desc, size_t descsz) break; /* linux_clock_gettime64 */ case 403: + if (ndx == 0 || ndx == 1) + p = "int"; + break; /* linux_clock_settime64 */ case 404: /* linux_clock_adjtime64 */ case 405: /* linux_clock_getres_time64 */ case 406: + if (ndx == 0 || ndx == 1) + p = "int"; + break; /* linux_clock_nanosleep_time64 */ case 407: + if (ndx == 0 || ndx == 1) + p = "int"; + break; /* linux_timer_gettime64 */ case 408: /* linux_timer_settime64 */ @@ -9654,6 +9731,9 @@ systrace_return_setargdesc(int sysnum, int ndx, char *desc, size_t descsz) case 411: /* linux_utimensat_time64 */ case 412: + if (ndx == 0 || ndx == 1) + p = "int"; + break; /* linux_pselect6_time64 */ case 413: /* linux_ppoll_time64 */ diff --git a/sys/amd64/linux32/syscalls.master b/sys/amd64/linux32/syscalls.master index 9c0cf347d7f4..6abdf6c122b2 100644 --- a/sys/amd64/linux32/syscalls.master +++ b/sys/amd64/linux32/syscalls.master @@ -2341,7 +2341,10 @@ } ; Linux 5.0: 403 AUE_NULL STD { - int linux_clock_gettime64(void); + int linux_clock_gettime64( + clockid_t which, + struct l_timespec64 *tp64 + ); } 404 AUE_NULL STD { int linux_clock_settime64(void); @@ -2350,10 +2353,18 @@ int linux_clock_adjtime64(void); } 406 AUE_NULL STD { - int linux_clock_getres_time64(void); + int linux_clock_getres_time64( + clockid_t which, + struct l_timespec64 *tp64 + ); } 407 AUE_NULL STD { - int linux_clock_nanosleep_time64(void); + int linux_clock_nanosleep_time64( + clockid_t which, + int flags, + struct l_timespec64 *rqtp64, + struct l_timespec64 *rmtp64 + ); } 408 AUE_NULL STD { int linux_timer_gettime64(void); @@ -2368,7 +2379,12 @@ int linux_timerfd_settime64(void); } 412 AUE_NULL STD { - int linux_utimensat_time64(void); + int linux_utimensat_time64( + l_int dfd, + const char *pathname, + const struct l_timespec64 *times64, + l_int flags + ); } 413 AUE_NULL STD { int linux_pselect6_time64(void); diff --git a/sys/compat/linux/linux_misc.c b/sys/compat/linux/linux_misc.c index fc846df6689f..26cad3dee06b 100644 --- a/sys/compat/linux/linux_misc.c +++ b/sys/compat/linux/linux_misc.c @@ -887,6 +887,92 @@ linux_utimensat(struct thread *td, struct linux_utimensat_args *args) return (error); } +#ifdef COMPAT_LINUX32 +int +linux_utimensat_time64(struct thread *td, struct linux_utimensat_time64_args *args) +{ + struct l_timespec64 l_times64[2]; + struct timespec times[2], *timesp = NULL; + char *path = NULL; + int error, dfd, flags = 0; + + dfd = (args->dfd == LINUX_AT_FDCWD) ? AT_FDCWD : args->dfd; + + if (args->flags & ~LINUX_AT_SYMLINK_NOFOLLOW) + return (EINVAL); + + if (args->times64 != NULL) { + error = copyin(args->times64, l_times64, sizeof(l_times64)); + if (error != 0) + return (error); + + if (linux_utimensat_nsec_valid(l_times64[0].tv_nsec) != 0 || + linux_utimensat_nsec_valid(l_times64[1].tv_nsec) != 0) + return (EINVAL); + + times[0].tv_sec = l_times64[0].tv_sec; + switch (l_times64[0].tv_nsec) + { + case LINUX_UTIME_OMIT: + times[0].tv_nsec = UTIME_OMIT; + break; + case LINUX_UTIME_NOW: + times[0].tv_nsec = UTIME_NOW; + break; + default: + times[0].tv_nsec = l_times64[0].tv_nsec; + } + + times[1].tv_sec = l_times64[1].tv_sec; + switch (l_times64[1].tv_nsec) + { + case LINUX_UTIME_OMIT: + times[1].tv_nsec = UTIME_OMIT; + break; + case LINUX_UTIME_NOW: + times[1].tv_nsec = UTIME_NOW; + break; + default: + times[1].tv_nsec = l_times64[1].tv_nsec; + break; + } + timesp = times; + + /* This breaks POSIX, but is what the Linux kernel does + * _on purpose_ (documented in the man page for utimensat(2)), + * so we must follow that behaviour. */ + if (times[0].tv_nsec == UTIME_OMIT && + times[1].tv_nsec == UTIME_OMIT) + return (0); + } + + if (!LUSECONVPATH(td)) { + if (args->pathname != NULL) { + return (kern_utimensat(td, dfd, args->pathname, + UIO_USERSPACE, timesp, UIO_SYSSPACE, flags)); + } + } + + if (args->pathname != NULL) + LCONVPATHEXIST_AT(td, args->pathname, &path, dfd); + else if (args->flags != 0) + return (EINVAL); + + if (args->flags & LINUX_AT_SYMLINK_NOFOLLOW) + flags |= AT_SYMLINK_NOFOLLOW; + + if (path == NULL) + error = kern_futimens(td, dfd, timesp, UIO_SYSSPACE); + else { + error = kern_utimensat(td, dfd, path, UIO_SYSSPACE, timesp, + UIO_SYSSPACE, flags); + LFREEPATH(path); + } + + return (error); +} +#endif + #ifdef LINUX_LEGACY_SYSCALLS int linux_futimesat(struct thread *td, struct linux_futimesat_args *args) diff --git a/sys/compat/linux/linux_time.c b/sys/compat/linux/linux_time.c index 1d7dcc869159..141e2e295507 100644 --- a/sys/compat/linux/linux_time.c +++ b/sys/compat/linux/linux_time.c @@ -82,6 +82,9 @@ LIN_SDT_PROBE_DEFINE1(time, linux_to_native_clockid, unknown_clockid, LIN_SDT_PROBE_DEFINE1(time, linux_clock_gettime, conversion_error, "int"); LIN_SDT_PROBE_DEFINE1(time, linux_clock_gettime, gettime_error, "int"); LIN_SDT_PROBE_DEFINE1(time, linux_clock_gettime, copyout_error, "int"); +LIN_SDT_PROBE_DEFINE1(time, linux_clock_gettime64, conversion_error, "int"); +LIN_SDT_PROBE_DEFINE1(time, linux_clock_gettime64, gettime_error, "int"); +LIN_SDT_PROBE_DEFINE1(time, linux_clock_gettime64, copyout_error, "int"); LIN_SDT_PROBE_DEFINE1(time, linux_clock_settime, conversion_error, "int"); LIN_SDT_PROBE_DEFINE1(time, linux_clock_settime, settime_error, "int"); LIN_SDT_PROBE_DEFINE1(time, linux_clock_settime, copyin_error, "int"); @@ -89,6 +92,10 @@ LIN_SDT_PROBE_DEFINE0(time, linux_clock_getres, nullcall); LIN_SDT_PROBE_DEFINE1(time, linux_clock_getres, conversion_error, "int"); LIN_SDT_PROBE_DEFINE1(time, linux_clock_getres, getres_error, "int"); LIN_SDT_PROBE_DEFINE1(time, linux_clock_getres, copyout_error, "int"); +LIN_SDT_PROBE_DEFINE0(time, linux_clock_getres_time64, nullcall); +LIN_SDT_PROBE_DEFINE1(time, linux_clock_getres_time64, conversion_error, "int"); +LIN_SDT_PROBE_DEFINE1(time, linux_clock_getres_time64, getres_error, "int"); +LIN_SDT_PROBE_DEFINE1(time, linux_clock_getres_time64, copyout_error, "int"); LIN_SDT_PROBE_DEFINE1(time, linux_nanosleep, conversion_error, "int"); LIN_SDT_PROBE_DEFINE1(time, linux_nanosleep, copyout_error, "int"); LIN_SDT_PROBE_DEFINE1(time, linux_nanosleep, copyin_error, "int"); @@ -97,6 +104,11 @@ LIN_SDT_PROBE_DEFINE1(time, linux_clock_nanosleep, copyout_error, "int"); LIN_SDT_PROBE_DEFINE1(time, linux_clock_nanosleep, copyin_error, "int"); LIN_SDT_PROBE_DEFINE1(time, linux_clock_nanosleep, unsupported_flags, "int"); LIN_SDT_PROBE_DEFINE1(time, linux_clock_nanosleep, unsupported_clockid, "int"); +LIN_SDT_PROBE_DEFINE1(time, linux_clock_nanosleep_time64, conversion_error, "int"); +LIN_SDT_PROBE_DEFINE1(time, linux_clock_nanosleep_time64, copyout_error, "int"); +LIN_SDT_PROBE_DEFINE1(time, linux_clock_nanosleep_time64, copyin_error, "int"); +LIN_SDT_PROBE_DEFINE1(time, linux_clock_nanosleep_time64, unsupported_flags, "int"); +LIN_SDT_PROBE_DEFINE1(time, linux_clock_nanosleep_time64, unsupported_clockid, "int"); int native_to_linux_timespec(struct l_timespec *ltp, struct timespec *ntp) @@ -112,6 +124,20 @@ native_to_linux_timespec(struct l_timespec *ltp, struct timespec *ntp) return (0); } +#ifdef COMPAT_LINUX32 +int +native_to_linux_timespec64(struct l_timespec64 *ltp64, struct timespec *ntp) +{ + + if (ntp->tv_sec > INT_MAX || ntp->tv_sec < INT_MIN) + return (EOVERFLOW); + ltp64->tv_sec = ntp->tv_sec; + ltp64->tv_nsec = ntp->tv_nsec; + + return (0); +} +#endif + int linux_to_native_timespec(struct timespec *ntp, struct l_timespec *ltp) { @@ -124,6 +150,20 @@ linux_to_native_timespec(struct timespec *ntp, struct l_timespec *ltp) return (0); } +#ifdef COMPAT_LINUX32 +int +linux_to_native_timespec64(struct timespec *ntp, struct l_timespec64 *ltp64) +{ + + if (ltp64->tv_sec < 0 || ltp64->tv_nsec < 0 || ltp64->tv_nsec > 999999999) + return (EINVAL); + ntp->tv_sec = ltp64->tv_sec; + ntp->tv_nsec = ltp64->tv_nsec; + + return (0); +} +#endif + int native_to_linux_itimerspec(struct l_itimerspec *ltp, struct itimerspec *ntp) { @@ -348,6 +388,147 @@ linux_clock_gettime(struct thread *td, struct linux_clock_gettime_args *args) return (error); } +#ifdef COMPAT_LINUX32 +int +linux_clock_gettime64(struct thread *td, struct linux_clock_gettime64_args *args) +{ + struct l_timespec lts; + struct l_timespec64 lts64; + struct timespec tp; + struct rusage ru; + struct thread *targettd; + struct proc *p; + int error, clockwhich; + clockid_t nwhich; + pid_t pid; + lwpid_t tid; + + error = linux_to_native_clockid(&nwhich, args->which); + if (error != 0) { + linux_msg(curthread, + "unsupported clock_gettime clockid %d", args->which); + LIN_SDT_PROBE1(time, linux_clock_gettime64, conversion_error, + error); + return (error); + } + + switch (nwhich) { + case CLOCK_PROCESS_CPUTIME_ID: + if (args->which < 0) { + clockwhich = LINUX_CPUCLOCK_WHICH(args->which); + pid = LINUX_CPUCLOCK_ID(args->which); + } else { + clockwhich = LINUX_CPUCLOCK_SCHED; + pid = 0; + } + if (pid == 0) { + p = td->td_proc; + PROC_LOCK(p); + } else { + error = pget(pid, PGET_CANSEE, &p); + if (error != 0) + return (EINVAL); + } + switch (clockwhich) { + case LINUX_CPUCLOCK_PROF: + PROC_STATLOCK(p); + calcru(p, &ru.ru_utime, &ru.ru_stime); + PROC_STATUNLOCK(p); + PROC_UNLOCK(p); + timevaladd(&ru.ru_utime, &ru.ru_stime); + TIMEVAL_TO_TIMESPEC(&ru.ru_utime, &tp); + break; + case LINUX_CPUCLOCK_VIRT: + PROC_STATLOCK(p); + calcru(p, &ru.ru_utime, &ru.ru_stime); + PROC_STATUNLOCK(p); + PROC_UNLOCK(p); + TIMEVAL_TO_TIMESPEC(&ru.ru_utime, &tp); + break; + case LINUX_CPUCLOCK_SCHED: + kern_process_cputime(p, &tp); + PROC_UNLOCK(p); + break; + default: + PROC_UNLOCK(p); + return (EINVAL); + } + + break; + + case CLOCK_THREAD_CPUTIME_ID: + if (args->which < 0) { + clockwhich = LINUX_CPUCLOCK_WHICH(args->which); + tid = LINUX_CPUCLOCK_ID(args->which); + } else { + clockwhich = LINUX_CPUCLOCK_SCHED; + tid = 0; + } + p = td->td_proc; + if (tid == 0) { + targettd = td; + PROC_LOCK(p); + } else { + targettd = linux_tdfind(td, tid, p->p_pid); + if (targettd == NULL) + return (EINVAL); + } + switch (clockwhich) { + case LINUX_CPUCLOCK_PROF: + PROC_STATLOCK(p); + thread_lock(targettd); + rufetchtd(targettd, &ru); + thread_unlock(targettd); + PROC_STATUNLOCK(p); + PROC_UNLOCK(p); + timevaladd(&ru.ru_utime, &ru.ru_stime); + TIMEVAL_TO_TIMESPEC(&ru.ru_utime, &tp); + break; + case LINUX_CPUCLOCK_VIRT: + PROC_STATLOCK(p); + thread_lock(targettd); + rufetchtd(targettd, &ru); + thread_unlock(targettd); + PROC_STATUNLOCK(p); + PROC_UNLOCK(p); + TIMEVAL_TO_TIMESPEC(&ru.ru_utime, &tp); + break; + case LINUX_CPUCLOCK_SCHED: + if (td == targettd) + targettd = NULL; + kern_thread_cputime(targettd, &tp); + PROC_UNLOCK(p); + break; + default: + PROC_UNLOCK(p); + return (EINVAL); + } + break; + + default: + error = kern_clock_gettime(td, nwhich, &tp); + break; + } + if (error != 0) { + LIN_SDT_PROBE1(time, linux_clock_gettime64, gettime_error, error); + return (error); + } + error = native_to_linux_timespec(<s, &tp); + if (error != 0) + return (error); + + /* Fix up time. */ + lts64.tv_sec = lts.tv_sec; + lts64.tv_nsec = lts.tv_nsec; + + error = copyout(<s64, args->tp64, sizeof lts64); + if (error != 0) + LIN_SDT_PROBE1(time, linux_clock_gettime64, copyout_error, error); + + return (error); +} +#endif + int linux_clock_settime(struct thread *td, struct linux_clock_settime_args *args) { @@ -485,6 +666,116 @@ linux_clock_getres(struct thread *td, struct linux_clock_getres_args *args) return (error); } +#ifdef COMPAT_LINUX32 +int +linux_clock_getres_time64(struct thread *td, struct linux_clock_getres_time64_args *args) +{ + struct proc *p; + struct timespec ts; + struct l_timespec lts; + struct l_timespec64 lts64; + int error, clockwhich; + clockid_t nwhich; + pid_t pid; + lwpid_t tid; + + error = linux_to_native_clockid(&nwhich, args->which); + if (error != 0) { + linux_msg(curthread, + "unsupported clock_getres clockid %d", args->which); + LIN_SDT_PROBE1(time, linux_clock_getres_time64, conversion_error, + error); + return (error); + } + + /* + * Check user supplied clock id in case of per-process + * or thread-specific cpu-time clock. + */ + if (args->which < 0) { + switch (nwhich) { + case CLOCK_THREAD_CPUTIME_ID: + tid = LINUX_CPUCLOCK_ID(args->which); + if (tid != 0) { + p = td->td_proc; + if (linux_tdfind(td, tid, p->p_pid) == NULL) + return (EINVAL); + PROC_UNLOCK(p); + } + break; + case CLOCK_PROCESS_CPUTIME_ID: + pid = LINUX_CPUCLOCK_ID(args->which); + if (pid != 0) { + error = pget(pid, PGET_CANSEE, &p); + if (error != 0) + return (EINVAL); + PROC_UNLOCK(p); + } + break; + } + } + + if (args->tp64 == NULL) { + LIN_SDT_PROBE0(time, linux_clock_getres_time64, nullcall); + return (0); + } + + switch (nwhich) { + case CLOCK_THREAD_CPUTIME_ID: + case CLOCK_PROCESS_CPUTIME_ID: + clockwhich = LINUX_CPUCLOCK_WHICH(args->which); + /* + * In both cases (when the clock id obtained by a call to + * clock_getcpuclockid() or using the clock + * ID CLOCK_PROCESS_CPUTIME_ID Linux hardcodes precision + * of clock. The same for the CLOCK_THREAD_CPUTIME_ID clock. + * + * See Linux posix_cpu_clock_getres() implementation. + */ + if (args->which > 0 || clockwhich == LINUX_CPUCLOCK_SCHED) { + ts.tv_sec = 0; + ts.tv_nsec = 1; + goto out; + } + + switch (clockwhich) { + case LINUX_CPUCLOCK_PROF: + nwhich = CLOCK_PROF; + break; + case LINUX_CPUCLOCK_VIRT: + nwhich = CLOCK_VIRTUAL; + break; + default: + return (EINVAL); + } + break; + + default: + break; + } + error = kern_clock_getres(td, nwhich, &ts); + if (error != 0) { + LIN_SDT_PROBE1(time, linux_clock_getres_time64, getres_error, error); + return (error); + } + +out: + error = native_to_linux_timespec(<s, &ts); + if (error != 0) + return (error); + + /* Fix up time. */ + lts64.tv_sec = lts.tv_sec; + lts64.tv_nsec = lts.tv_nsec; + + error = copyout(<s64, args->tp64, sizeof lts64); + if (error != 0) + LIN_SDT_PROBE1(time, linux_clock_getres_time64, copyout_error, error); + + return (error); +} +#endif + int linux_nanosleep(struct thread *td, struct linux_nanosleep_args *args) { @@ -584,3 +875,66 @@ linux_clock_nanosleep(struct thread *td, struct linux_clock_nanosleep_args *args return (error); } + +#ifdef COMPAT_LINUX32 +int +linux_clock_nanosleep_time64(struct thread *td, struct linux_clock_nanosleep_time64_args *args) +{ + struct timespec *rmtp; + struct l_timespec64 lrqts64, lrmts64; + struct timespec rqts, rmts; + int error, error2, flags; + clockid_t clockid; + + error = linux_to_native_timerflags(&flags, args->flags); + if (error != 0) { + LIN_SDT_PROBE1(time, linux_clock_nanosleep_time64, unsupported_flags, + args->flags); + return (error); + } + + error = linux_to_native_clockid(&clockid, args->which); + if (error != 0) { + linux_msg(curthread, + "unsupported clock_nanosleep clockid %d", args->which); + LIN_SDT_PROBE1(time, linux_clock_nanosleep_time64, unsupported_clockid, + args->which); + return (error); + } + + error = copyin(args->rqtp64, &lrqts64, sizeof(lrqts64)); + if (error != 0) { + LIN_SDT_PROBE1(time, linux_clock_nanosleep_time64, copyin_error, + error); + return (error); + } + + if (args->rmtp64 != NULL) + rmtp = &rmts; + else + rmtp = NULL; + + error = linux_to_native_timespec64(&rqts, &lrqts64); + if (error != 0) { + LIN_SDT_PROBE1(time, linux_clock_nanosleep_time64, conversion_error, + error); + return (error); + } + error = kern_clock_nanosleep(td, clockid, flags, &rqts, rmtp); + if (error == EINTR && (flags & TIMER_ABSTIME) == 0 && + args->rmtp64 != NULL) { + error2 = native_to_linux_timespec64(&lrmts64, rmtp); + if (error2 != 0) + return (error2); + error2 = copyout(&lrmts64, args->rmtp64, sizeof(lrmts64)); + if (error2 != 0) { + LIN_SDT_PROBE1(time, linux_clock_nanosleep_time64, + copyout_error, error2); + return (error2); + } + } + + return (error); +} +#endif + diff --git a/sys/compat/linux/linux_timer.h b/sys/compat/linux/linux_timer.h index 5344191742bb..b5b85bea1fb2 100644 --- a/sys/compat/linux/linux_timer.h +++ b/sys/compat/linux/linux_timer.h @@ -108,6 +108,12 @@ int native_to_linux_timespec(struct l_timespec *, struct timespec *); int linux_to_native_timespec(struct timespec *, struct l_timespec *); +#ifdef COMPAT_LINUX32 +int native_to_linux_timespec64(struct l_timespec64 *, + struct timespec *); +int linux_to_native_timespec64(struct timespec *, + struct l_timespec64 *); +#endif int linux_to_native_clockid(clockid_t *, clockid_t); int native_to_linux_itimerspec(struct l_itimerspec *, struct itimerspec *); diff --git a/sys/i386/linux/linux.h b/sys/i386/linux/linux.h index ab78a9649511..dd0c1eae216e 100644 --- a/sys/i386/linux/linux.h +++ b/sys/i386/linux/linux.h @@ -142,6 +142,11 @@ struct l_timespec { l_long tv_nsec; }; +struct l_timespec64 { + l_ulonglong tv_sec; + l_long tv_nsec; +}; + struct l_newstat { l_ushort st_dev; l_ushort __pad1; diff --git a/sys/i386/linux/linux_dummy_machdep.c b/sys/i386/linux/linux_dummy_machdep.c index dfcc691a3582..dbd340ceb958 100644 --- a/sys/i386/linux/linux_dummy_machdep.c +++ b/sys/i386/linux/linux_dummy_machdep.c @@ -69,16 +69,12 @@ DUMMY(vm86old); /* Linux 4.11: */ DUMMY(arch_prctl); /* Linux 5.0: */ -DUMMY(clock_gettime64); DUMMY(clock_settime64); DUMMY(clock_adjtime64); -DUMMY(clock_getres_time64); -DUMMY(clock_nanosleep_time64); DUMMY(timer_gettime64); DUMMY(timer_settime64); DUMMY(timerfd_gettime64); DUMMY(timerfd_settime64); -DUMMY(utimensat_time64); DUMMY(pselect6_time64); DUMMY(ppoll_time64); DUMMY(io_pgetevents_time64); diff --git a/sys/i386/linux/linux_proto.h b/sys/i386/linux/linux_proto.h index ae5e591f86b7..b1faf0daf09c 100644 --- a/sys/i386/linux/linux_proto.h +++ b/sys/i386/linux/linux_proto.h @@ -1512,7 +1512,8 @@ struct linux_msgctl_args { char buf_l_[PADL_(struct l_msqid_ds *)]; struct l_msqid_ds * buf; char buf_r_[PADR_(struct l_msqid_ds *)]; }; struct linux_clock_gettime64_args { - register_t dummy; + char which_l_[PADL_(clockid_t)]; clockid_t which; char which_r_[PADR_(clockid_t)]; + char tp64_l_[PADL_(struct l_timespec64 *)]; struct l_timespec64 * tp64; char tp64_r_[PADR_(struct l_timespec64 *)]; }; struct linux_clock_settime64_args { register_t dummy; @@ -1521,10 +1522,14 @@ struct linux_clock_adjtime64_args { register_t dummy; }; struct linux_clock_getres_time64_args { - register_t dummy; + char which_l_[PADL_(clockid_t)]; clockid_t which; char which_r_[PADR_(clockid_t)]; + char tp64_l_[PADL_(struct l_timespec64 *)]; struct l_timespec64 * tp64; char tp64_r_[PADR_(struct l_timespec64 *)]; }; struct linux_clock_nanosleep_time64_args { - register_t dummy; + char which_l_[PADL_(clockid_t)]; clockid_t which; char which_r_[PADR_(clockid_t)]; + char flags_l_[PADL_(int)]; int flags; char flags_r_[PADR_(int)]; + char rqtp64_l_[PADL_(struct l_timespec64 *)]; struct l_timespec64 * rqtp64; char rqtp64_r_[PADR_(struct l_timespec64 *)]; + char rmtp64_l_[PADL_(struct l_timespec64 *)]; struct l_timespec64 * rmtp64; char rmtp64_r_[PADR_(struct l_timespec64 *)]; }; struct linux_timer_gettime64_args { register_t dummy; @@ -1539,7 +1544,10 @@ struct linux_timerfd_settime64_args { register_t dummy; }; struct linux_utimensat_time64_args { - register_t dummy; + char dfd_l_[PADL_(l_int)]; l_int dfd; char dfd_r_[PADR_(l_int)]; + char pathname_l_[PADL_(const char *)]; const char * pathname; char pathname_r_[PADR_(const char *)]; + char times64_l_[PADL_(const struct l_timespec64 *)]; const struct l_timespec64 * times64; char times64_r_[PADR_(const struct l_timespec64 *)]; + char flags_l_[PADL_(l_int)]; l_int flags; char flags_r_[PADR_(l_int)]; }; struct linux_pselect6_time64_args { register_t dummy; diff --git a/sys/i386/linux/linux_sysent.c b/sys/i386/linux/linux_sysent.c index 2b0054d7f8f6..fb29f56b112f 100644 --- a/sys/i386/linux/linux_sysent.c +++ b/sys/i386/linux/linux_sysent.c @@ -420,16 +420,16 @@ struct sysent linux_sysent[] = { { .sy_narg = AS(linux_msgsnd_args), .sy_call = (sy_call_t *)linux_msgsnd, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 400 = linux_msgsnd */ { .sy_narg = AS(linux_msgrcv_args), .sy_call = (sy_call_t *)linux_msgrcv, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 401 = linux_msgrcv */ { .sy_narg = AS(linux_msgctl_args), .sy_call = (sy_call_t *)linux_msgctl, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 402 = linux_msgctl */ - { .sy_narg = 0, .sy_call = (sy_call_t *)linux_clock_gettime64, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 403 = linux_clock_gettime64 */ + { .sy_narg = AS(linux_clock_gettime64_args), .sy_call = (sy_call_t *)linux_clock_gettime64, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 403 = linux_clock_gettime64 */ { .sy_narg = 0, .sy_call = (sy_call_t *)linux_clock_settime64, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 404 = linux_clock_settime64 */ { .sy_narg = 0, .sy_call = (sy_call_t *)linux_clock_adjtime64, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 405 = linux_clock_adjtime64 */ - { .sy_narg = 0, .sy_call = (sy_call_t *)linux_clock_getres_time64, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 406 = linux_clock_getres_time64 */ - { .sy_narg = 0, .sy_call = (sy_call_t *)linux_clock_nanosleep_time64, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 407 = linux_clock_nanosleep_time64 */ + { .sy_narg = AS(linux_clock_getres_time64_args), .sy_call = (sy_call_t *)linux_clock_getres_time64, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 406 = linux_clock_getres_time64 */ + { .sy_narg = AS(linux_clock_nanosleep_time64_args), .sy_call = (sy_call_t *)linux_clock_nanosleep_time64, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 407 = linux_clock_nanosleep_time64 */ { .sy_narg = 0, .sy_call = (sy_call_t *)linux_timer_gettime64, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 408 = linux_timer_gettime64 */ { .sy_narg = 0, .sy_call = (sy_call_t *)linux_timer_settime64, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 409 = linux_timer_settime64 */ { .sy_narg = 0, .sy_call = (sy_call_t *)linux_timerfd_gettime64, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 410 = linux_timerfd_gettime64 */ { .sy_narg = 0, .sy_call = (sy_call_t *)linux_timerfd_settime64, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 411 = linux_timerfd_settime64 */ - { .sy_narg = 0, .sy_call = (sy_call_t *)linux_utimensat_time64, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 412 = linux_utimensat_time64 */ + { .sy_narg = AS(linux_utimensat_time64_args), .sy_call = (sy_call_t *)linux_utimensat_time64, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 412 = linux_utimensat_time64 */ { .sy_narg = 0, .sy_call = (sy_call_t *)linux_pselect6_time64, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 413 = linux_pselect6_time64 */ { .sy_narg = 0, .sy_call = (sy_call_t *)linux_ppoll_time64, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 414 = linux_ppoll_time64 */ { .sy_narg = 0, .sy_call = (sy_call_t *)nosys, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_ABSENT }, /* 415 = nosys */ diff --git a/sys/i386/linux/linux_systrace_args.c b/sys/i386/linux/linux_systrace_args.c index 484c6f61558a..2a436f3bac82 100644 --- a/sys/i386/linux/linux_systrace_args.c +++ b/sys/i386/linux/linux_systrace_args.c @@ -3001,7 +3001,10 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) } /* linux_clock_gettime64 */ case 403: { - *n_args = 0; + struct linux_clock_gettime64_args *p = params; + iarg[0] = p->which; /* clockid_t */ + uarg[1] = (intptr_t) p->tp64; /* struct l_timespec64 * */ + *n_args = 2; break; } /* linux_clock_settime64 */ @@ -3016,12 +3019,20 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) } /* linux_clock_getres_time64 */ case 406: { - *n_args = 0; + struct linux_clock_getres_time64_args *p = params; + iarg[0] = p->which; /* clockid_t */ + uarg[1] = (intptr_t) p->tp64; /* struct l_timespec64 * */ + *n_args = 2; break; } /* linux_clock_nanosleep_time64 */ case 407: { - *n_args = 0; + struct linux_clock_nanosleep_time64_args *p = params; + iarg[0] = p->which; /* clockid_t */ + iarg[1] = p->flags; /* int */ + uarg[2] = (intptr_t) p->rqtp64; /* struct l_timespec64 * */ + uarg[3] = (intptr_t) p->rmtp64; /* struct l_timespec64 * */ + *n_args = 4; break; } /* linux_timer_gettime64 */ @@ -3046,7 +3057,12 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) } /* linux_utimensat_time64 */ case 412: { - *n_args = 0; + struct linux_utimensat_time64_args *p = params; + iarg[0] = p->dfd; /* l_int */ + uarg[1] = (intptr_t) p->pathname; /* const char * */ + uarg[2] = (intptr_t) p->times64; /* const struct l_timespec64 * */ + iarg[3] = p->flags; /* l_int */ + *n_args = 4; break; } /* linux_pselect6_time64 */ @@ -7988,6 +8004,16 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *desc, size_t descsz) break; /* linux_clock_gettime64 */ case 403: + switch(ndx) { + case 0: + p = "clockid_t"; + break; + case 1: + p = "userland struct l_timespec64 *"; + break; + default: + break; + }; break; /* linux_clock_settime64 */ case 404: @@ -7997,9 +8023,35 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *desc, size_t descsz) break; /* linux_clock_getres_time64 */ case 406: + switch(ndx) { + case 0: + p = "clockid_t"; + break; + case 1: + p = "userland struct l_timespec64 *"; + break; + default: + break; + }; break; /* linux_clock_nanosleep_time64 */ case 407: + switch(ndx) { + case 0: + p = "clockid_t"; + break; + case 1: + p = "int"; + break; + case 2: + p = "userland struct l_timespec64 *"; + break; + case 3: + p = "userland struct l_timespec64 *"; + break; + default: + break; + }; break; /* linux_timer_gettime64 */ case 408: @@ -8015,6 +8067,22 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *desc, size_t descsz) break; /* linux_utimensat_time64 */ case 412: + switch(ndx) { + case 0: + p = "l_int"; + break; + case 1: + p = "userland const char *"; + break; + case 2: + p = "userland const struct l_timespec64 *"; + break; + case 3: + p = "l_int"; + break; + default: + break; + }; break; /* linux_pselect6_time64 */ case 413: @@ -9742,14 +9810,23 @@ systrace_return_setargdesc(int sysnum, int ndx, char *desc, size_t descsz) break; /* linux_clock_gettime64 */ case 403: + if (ndx == 0 || ndx == 1) + p = "int"; + break; /* linux_clock_settime64 */ case 404: /* linux_clock_adjtime64 */ case 405: /* linux_clock_getres_time64 */ case 406: + if (ndx == 0 || ndx == 1) + p = "int"; + break; /* linux_clock_nanosleep_time64 */ case 407: + if (ndx == 0 || ndx == 1) + p = "int"; + break; /* linux_timer_gettime64 */ case 408: /* linux_timer_settime64 */ @@ -9760,6 +9837,9 @@ systrace_return_setargdesc(int sysnum, int ndx, char *desc, size_t descsz) case 411: /* linux_utimensat_time64 */ case 412: + if (ndx == 0 || ndx == 1) + p = "int"; + break; /* linux_pselect6_time64 */ case 413: /* linux_ppoll_time64 */ diff --git a/sys/i386/linux/syscalls.master b/sys/i386/linux/syscalls.master index ae053febd656..2b285ca917c5 100644 --- a/sys/i386/linux/syscalls.master +++ b/sys/i386/linux/syscalls.master @@ -2359,7 +2359,10 @@ } ; Linux 5.0: 403 AUE_NULL STD { - int linux_clock_gettime64(void); + int linux_clock_gettime64( + clockid_t which, + struct l_timespec64 *tp64 + ); } 404 AUE_NULL STD { int linux_clock_settime64(void); @@ -2368,10 +2371,18 @@ int linux_clock_adjtime64(void); } 406 AUE_NULL STD { - int linux_clock_getres_time64(void); + int linux_clock_getres_time64( + clockid_t which, + struct l_timespec64 *tp64 + ); } 407 AUE_NULL STD { - int linux_clock_nanosleep_time64(void); + int linux_clock_nanosleep_time64( + clockid_t which, + int flags, + struct l_timespec64 *rqtp64, + struct l_timespec64 *rmtp64 + ); } 408 AUE_NULL STD { int linux_timer_gettime64(void); @@ -2386,7 +2397,12 @@ int linux_timerfd_settime64(void); } 412 AUE_NULL STD { - int linux_utimensat_time64(void); + int linux_utimensat_time64( + l_int dfd, + const char *pathname, + const struct l_timespec64 *times64, + l_int flags + ); } 413 AUE_NULL STD { int linux_pselect6_time64(void); -- 2.31.1