mirror of
https://github.com/opnsense/src.git
synced 2026-05-28 04:12:45 -04:00
linux(4): Implement clock_settime64 system call.
MFC after: 2 weeks
This commit is contained in:
parent
9e07ae7a09
commit
19f9a0e4df
5 changed files with 62 additions and 21 deletions
|
|
@ -67,7 +67,6 @@ DUMMY(mq_getsetattr);
|
|||
/* Linux 4.11: */
|
||||
DUMMY(arch_prctl);
|
||||
/* Linux 5.0: */
|
||||
DUMMY(clock_settime64);
|
||||
DUMMY(clock_adjtime64);
|
||||
DUMMY(clock_getres_time64);
|
||||
DUMMY(clock_nanosleep_time64);
|
||||
|
|
|
|||
|
|
@ -2347,7 +2347,10 @@
|
|||
);
|
||||
}
|
||||
404 AUE_NULL STD {
|
||||
int linux_clock_settime64(void);
|
||||
int linux_clock_settime64(
|
||||
clockid_t which,
|
||||
struct l_timespec64 *tp
|
||||
);
|
||||
}
|
||||
405 AUE_NULL STD {
|
||||
int linux_clock_adjtime64(void);
|
||||
|
|
|
|||
|
|
@ -87,8 +87,13 @@ LIN_SDT_PROBE_DEFINE1(time, linux_clock_gettime64, gettime_error, "int");
|
|||
LIN_SDT_PROBE_DEFINE1(time, linux_clock_gettime64, copyout_error, "int");
|
||||
#endif
|
||||
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_common_clock_settime, settime_error, "int");
|
||||
LIN_SDT_PROBE_DEFINE1(time, linux_common_clock_settime, conversion_error, "int");
|
||||
LIN_SDT_PROBE_DEFINE1(time, linux_clock_settime, copyin_error, "int");
|
||||
#if defined(__i386__) || (defined(__amd64__) && defined(COMPAT_LINUX32))
|
||||
LIN_SDT_PROBE_DEFINE1(time, linux_clock_settime64, conversion_error, "int");
|
||||
LIN_SDT_PROBE_DEFINE1(time, linux_clock_settime64, copyin_error, "int");
|
||||
#endif
|
||||
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");
|
||||
|
|
@ -104,6 +109,8 @@ LIN_SDT_PROBE_DEFINE1(time, linux_clock_nanosleep, unsupported_clockid, "int");
|
|||
|
||||
static int linux_common_clock_gettime(struct thread *, clockid_t,
|
||||
struct timespec *);
|
||||
static int linux_common_clock_settime(struct thread *, clockid_t,
|
||||
struct timespec *);
|
||||
|
||||
int
|
||||
native_to_linux_timespec(struct l_timespec *ltp, struct timespec *ntp)
|
||||
|
|
@ -414,40 +421,70 @@ linux_clock_gettime64(struct thread *td, struct linux_clock_gettime64_args *args
|
|||
}
|
||||
#endif
|
||||
|
||||
static int
|
||||
linux_common_clock_settime(struct thread *td, clockid_t which,
|
||||
struct timespec *ts)
|
||||
{
|
||||
int error;
|
||||
clockid_t nwhich;
|
||||
|
||||
error = linux_to_native_clockid(&nwhich, which);
|
||||
if (error != 0) {
|
||||
linux_msg(curthread,
|
||||
"unsupported clock_settime clockid %d", which);
|
||||
LIN_SDT_PROBE1(time, linux_common_clock_settime, conversion_error,
|
||||
error);
|
||||
return (error);
|
||||
}
|
||||
|
||||
error = kern_clock_settime(td, nwhich, ts);
|
||||
if (error != 0)
|
||||
LIN_SDT_PROBE1(time, linux_common_clock_settime,
|
||||
settime_error, error);
|
||||
|
||||
return (error);
|
||||
}
|
||||
|
||||
int
|
||||
linux_clock_settime(struct thread *td, struct linux_clock_settime_args *args)
|
||||
{
|
||||
struct timespec ts;
|
||||
struct l_timespec lts;
|
||||
int error;
|
||||
clockid_t nwhich;
|
||||
|
||||
error = linux_to_native_clockid(&nwhich, args->which);
|
||||
if (error != 0) {
|
||||
linux_msg(curthread,
|
||||
"unsupported clock_settime clockid %d", args->which);
|
||||
LIN_SDT_PROBE1(time, linux_clock_settime, conversion_error,
|
||||
error);
|
||||
return (error);
|
||||
}
|
||||
error = copyin(args->tp, <s, sizeof lts);
|
||||
error = copyin(args->tp, <s, sizeof(lts));
|
||||
if (error != 0) {
|
||||
LIN_SDT_PROBE1(time, linux_clock_settime, copyin_error, error);
|
||||
return (error);
|
||||
}
|
||||
error = linux_to_native_timespec(&ts, <s);
|
||||
if (error != 0) {
|
||||
if (error != 0)
|
||||
LIN_SDT_PROBE1(time, linux_clock_settime, conversion_error,
|
||||
error);
|
||||
|
||||
return (linux_common_clock_settime(td, args->which, &ts));
|
||||
}
|
||||
|
||||
#if defined(__i386__) || (defined(__amd64__) && defined(COMPAT_LINUX32))
|
||||
int
|
||||
linux_clock_settime64(struct thread *td, struct linux_clock_settime64_args *args)
|
||||
{
|
||||
struct timespec ts;
|
||||
struct l_timespec64 lts;
|
||||
int error;
|
||||
|
||||
error = copyin(args->tp, <s, sizeof(lts));
|
||||
if (error != 0) {
|
||||
LIN_SDT_PROBE1(time, linux_clock_settime64, copyin_error, error);
|
||||
return (error);
|
||||
}
|
||||
|
||||
error = kern_clock_settime(td, nwhich, &ts);
|
||||
error = linux_to_native_timespec64(&ts, <s);
|
||||
if (error != 0)
|
||||
LIN_SDT_PROBE1(time, linux_clock_settime, settime_error, error);
|
||||
|
||||
return (error);
|
||||
LIN_SDT_PROBE1(time, linux_clock_settime64, conversion_error,
|
||||
error);
|
||||
return (linux_common_clock_settime(td, args->which, &ts));
|
||||
}
|
||||
#endif
|
||||
|
||||
int
|
||||
linux_clock_getres(struct thread *td, struct linux_clock_getres_args *args)
|
||||
|
|
|
|||
|
|
@ -69,7 +69,6 @@ DUMMY(vm86old);
|
|||
/* Linux 4.11: */
|
||||
DUMMY(arch_prctl);
|
||||
/* Linux 5.0: */
|
||||
DUMMY(clock_settime64);
|
||||
DUMMY(clock_adjtime64);
|
||||
DUMMY(clock_getres_time64);
|
||||
DUMMY(clock_nanosleep_time64);
|
||||
|
|
|
|||
|
|
@ -2365,7 +2365,10 @@
|
|||
);
|
||||
}
|
||||
404 AUE_NULL STD {
|
||||
int linux_clock_settime64(void);
|
||||
int linux_clock_settime64(
|
||||
clockid_t which,
|
||||
struct l_timespec64 *tp
|
||||
);
|
||||
}
|
||||
405 AUE_NULL STD {
|
||||
int linux_clock_adjtime64(void);
|
||||
|
|
|
|||
Loading…
Reference in a new issue