linux(4): Add a helper intended for copying timespec's from the userspace.
There are many places where we copyin Linux timespec from the userspace and then convert it to the kernel timespec. To avoid code duplication add a tiny halper for doing this. MFC after: 2 weeks
This commit is contained in:
parent
3dc2a06752
commit
707e567a40
@ -540,7 +540,6 @@ int
|
|||||||
linux_epoll_pwait2_64(struct thread *td, struct linux_epoll_pwait2_64_args *args)
|
linux_epoll_pwait2_64(struct thread *td, struct linux_epoll_pwait2_64_args *args)
|
||||||
{
|
{
|
||||||
struct timespec ts, *tsa;
|
struct timespec ts, *tsa;
|
||||||
struct l_timespec64 lts;
|
|
||||||
sigset_t mask, *pmask;
|
sigset_t mask, *pmask;
|
||||||
int error;
|
int error;
|
||||||
|
|
||||||
@ -550,9 +549,7 @@ linux_epoll_pwait2_64(struct thread *td, struct linux_epoll_pwait2_64_args *args
|
|||||||
return (error);
|
return (error);
|
||||||
|
|
||||||
if (args->timeout) {
|
if (args->timeout) {
|
||||||
if ((error = copyin(args->timeout, <s, sizeof(lts))))
|
error = linux_get_timespec64(&ts, args->timeout);
|
||||||
return (error);
|
|
||||||
error = linux_to_native_timespec64(&ts, <s);
|
|
||||||
if (error != 0)
|
if (error != 0)
|
||||||
return (error);
|
return (error);
|
||||||
tsa = &ts;
|
tsa = &ts;
|
||||||
@ -567,7 +564,6 @@ int
|
|||||||
linux_epoll_pwait2(struct thread *td, struct linux_epoll_pwait2_args *args)
|
linux_epoll_pwait2(struct thread *td, struct linux_epoll_pwait2_args *args)
|
||||||
{
|
{
|
||||||
struct timespec ts, *tsa;
|
struct timespec ts, *tsa;
|
||||||
struct l_timespec lts;
|
|
||||||
sigset_t mask, *pmask;
|
sigset_t mask, *pmask;
|
||||||
int error;
|
int error;
|
||||||
|
|
||||||
@ -577,9 +573,7 @@ linux_epoll_pwait2(struct thread *td, struct linux_epoll_pwait2_args *args)
|
|||||||
return (error);
|
return (error);
|
||||||
|
|
||||||
if (args->timeout) {
|
if (args->timeout) {
|
||||||
if ((error = copyin(args->timeout, <s, sizeof(lts))))
|
error = linux_get_timespec(&ts, args->timeout);
|
||||||
return (error);
|
|
||||||
error = linux_to_native_timespec(&ts, <s);
|
|
||||||
if (error != 0)
|
if (error != 0)
|
||||||
return (error);
|
return (error);
|
||||||
tsa = &ts;
|
tsa = &ts;
|
||||||
|
@ -816,7 +816,6 @@ linux_sys_futex(struct thread *td, struct linux_sys_futex_args *args)
|
|||||||
.val3 = args->val3,
|
.val3 = args->val3,
|
||||||
.val3_compare = true,
|
.val3_compare = true,
|
||||||
};
|
};
|
||||||
struct l_timespec lts;
|
|
||||||
int error;
|
int error;
|
||||||
|
|
||||||
switch (args->op & LINUX_FUTEX_CMD_MASK) {
|
switch (args->op & LINUX_FUTEX_CMD_MASK) {
|
||||||
@ -825,10 +824,7 @@ linux_sys_futex(struct thread *td, struct linux_sys_futex_args *args)
|
|||||||
case LINUX_FUTEX_LOCK_PI:
|
case LINUX_FUTEX_LOCK_PI:
|
||||||
case LINUX_FUTEX_LOCK_PI2:
|
case LINUX_FUTEX_LOCK_PI2:
|
||||||
if (args->timeout != NULL) {
|
if (args->timeout != NULL) {
|
||||||
error = copyin(args->timeout, <s, sizeof(lts));
|
error = linux_get_timespec(&fargs.kts, args->timeout);
|
||||||
if (error != 0)
|
|
||||||
return (error);
|
|
||||||
error = linux_to_native_timespec(&fargs.kts, <s);
|
|
||||||
if (error != 0)
|
if (error != 0)
|
||||||
return (error);
|
return (error);
|
||||||
fargs.ts = &fargs.kts;
|
fargs.ts = &fargs.kts;
|
||||||
@ -854,7 +850,6 @@ linux_sys_futex_time64(struct thread *td,
|
|||||||
.val3 = args->val3,
|
.val3 = args->val3,
|
||||||
.val3_compare = true,
|
.val3_compare = true,
|
||||||
};
|
};
|
||||||
struct l_timespec64 lts;
|
|
||||||
int error;
|
int error;
|
||||||
|
|
||||||
switch (args->op & LINUX_FUTEX_CMD_MASK) {
|
switch (args->op & LINUX_FUTEX_CMD_MASK) {
|
||||||
@ -863,10 +858,7 @@ linux_sys_futex_time64(struct thread *td,
|
|||||||
case LINUX_FUTEX_LOCK_PI:
|
case LINUX_FUTEX_LOCK_PI:
|
||||||
case LINUX_FUTEX_LOCK_PI2:
|
case LINUX_FUTEX_LOCK_PI2:
|
||||||
if (args->timeout != NULL) {
|
if (args->timeout != NULL) {
|
||||||
error = copyin(args->timeout, <s, sizeof(lts));
|
error = linux_get_timespec64(&fargs.kts, args->timeout);
|
||||||
if (error != 0)
|
|
||||||
return (error);
|
|
||||||
error = linux_to_native_timespec64(&fargs.kts, <s);
|
|
||||||
if (error != 0)
|
if (error != 0)
|
||||||
return (error);
|
return (error);
|
||||||
fargs.ts = &fargs.kts;
|
fargs.ts = &fargs.kts;
|
||||||
|
@ -510,13 +510,10 @@ int
|
|||||||
linux_semtimedop_time64(struct thread *td, struct linux_semtimedop_time64_args *args)
|
linux_semtimedop_time64(struct thread *td, struct linux_semtimedop_time64_args *args)
|
||||||
{
|
{
|
||||||
struct timespec ts, *tsa;
|
struct timespec ts, *tsa;
|
||||||
struct l_timespec64 lts;
|
|
||||||
int error;
|
int error;
|
||||||
|
|
||||||
if (args->timeout) {
|
if (args->timeout) {
|
||||||
if ((error = copyin(args->timeout, <s, sizeof(lts))))
|
error = linux_get_timespec64(&ts, args->timeout);
|
||||||
return (error);
|
|
||||||
error = linux_to_native_timespec64(&ts, <s);
|
|
||||||
if (error != 0)
|
if (error != 0)
|
||||||
return (error);
|
return (error);
|
||||||
tsa = &ts;
|
tsa = &ts;
|
||||||
@ -532,13 +529,10 @@ int
|
|||||||
linux_semtimedop(struct thread *td, struct linux_semtimedop_args *args)
|
linux_semtimedop(struct thread *td, struct linux_semtimedop_args *args)
|
||||||
{
|
{
|
||||||
struct timespec ts, *tsa;
|
struct timespec ts, *tsa;
|
||||||
struct l_timespec lts;
|
|
||||||
int error;
|
int error;
|
||||||
|
|
||||||
if (args->timeout) {
|
if (args->timeout) {
|
||||||
if ((error = copyin(args->timeout, <s, sizeof(lts))))
|
error = linux_get_timespec(&ts, args->timeout);
|
||||||
return (error);
|
|
||||||
error = linux_to_native_timespec(&ts, <s);
|
|
||||||
if (error != 0)
|
if (error != 0)
|
||||||
return (error);
|
return (error);
|
||||||
tsa = &ts;
|
tsa = &ts;
|
||||||
|
@ -2380,15 +2380,11 @@ linux_prlimit64(struct thread *td, struct linux_prlimit64_args *args)
|
|||||||
int
|
int
|
||||||
linux_pselect6(struct thread *td, struct linux_pselect6_args *args)
|
linux_pselect6(struct thread *td, struct linux_pselect6_args *args)
|
||||||
{
|
{
|
||||||
struct l_timespec lts;
|
|
||||||
struct timespec ts, *tsp;
|
struct timespec ts, *tsp;
|
||||||
int error;
|
int error;
|
||||||
|
|
||||||
if (args->tsp != NULL) {
|
if (args->tsp != NULL) {
|
||||||
error = copyin(args->tsp, <s, sizeof(lts));
|
error = linux_get_timespec(&ts, args->tsp);
|
||||||
if (error != 0)
|
|
||||||
return (error);
|
|
||||||
error = linux_to_native_timespec(&ts, <s);
|
|
||||||
if (error != 0)
|
if (error != 0)
|
||||||
return (error);
|
return (error);
|
||||||
tsp = &ts;
|
tsp = &ts;
|
||||||
@ -2472,15 +2468,11 @@ int
|
|||||||
linux_pselect6_time64(struct thread *td,
|
linux_pselect6_time64(struct thread *td,
|
||||||
struct linux_pselect6_time64_args *args)
|
struct linux_pselect6_time64_args *args)
|
||||||
{
|
{
|
||||||
struct l_timespec64 lts;
|
|
||||||
struct timespec ts, *tsp;
|
struct timespec ts, *tsp;
|
||||||
int error;
|
int error;
|
||||||
|
|
||||||
if (args->tsp != NULL) {
|
if (args->tsp != NULL) {
|
||||||
error = copyin(args->tsp, <s, sizeof(lts));
|
error = linux_get_timespec64(&ts, args->tsp);
|
||||||
if (error != 0)
|
|
||||||
return (error);
|
|
||||||
error = linux_to_native_timespec64(&ts, <s);
|
|
||||||
if (error != 0)
|
if (error != 0)
|
||||||
return (error);
|
return (error);
|
||||||
tsp = &ts;
|
tsp = &ts;
|
||||||
@ -2500,14 +2492,10 @@ int
|
|||||||
linux_ppoll(struct thread *td, struct linux_ppoll_args *args)
|
linux_ppoll(struct thread *td, struct linux_ppoll_args *args)
|
||||||
{
|
{
|
||||||
struct timespec uts, *tsp;
|
struct timespec uts, *tsp;
|
||||||
struct l_timespec lts;
|
|
||||||
int error;
|
int error;
|
||||||
|
|
||||||
if (args->tsp != NULL) {
|
if (args->tsp != NULL) {
|
||||||
error = copyin(args->tsp, <s, sizeof(lts));
|
error = linux_get_timespec(&uts, args->tsp);
|
||||||
if (error)
|
|
||||||
return (error);
|
|
||||||
error = linux_to_native_timespec(&uts, <s);
|
|
||||||
if (error != 0)
|
if (error != 0)
|
||||||
return (error);
|
return (error);
|
||||||
tsp = &uts;
|
tsp = &uts;
|
||||||
@ -2582,14 +2570,10 @@ int
|
|||||||
linux_ppoll_time64(struct thread *td, struct linux_ppoll_time64_args *args)
|
linux_ppoll_time64(struct thread *td, struct linux_ppoll_time64_args *args)
|
||||||
{
|
{
|
||||||
struct timespec uts, *tsp;
|
struct timespec uts, *tsp;
|
||||||
struct l_timespec64 lts;
|
|
||||||
int error;
|
int error;
|
||||||
|
|
||||||
if (args->tsp != NULL) {
|
if (args->tsp != NULL) {
|
||||||
error = copyin(args->tsp, <s, sizeof(lts));
|
error = linux_get_timespec64(&uts, args->tsp);
|
||||||
if (error != 0)
|
|
||||||
return (error);
|
|
||||||
error = linux_to_native_timespec64(&uts, <s);
|
|
||||||
if (error != 0)
|
if (error != 0)
|
||||||
return (error);
|
return (error);
|
||||||
tsp = &uts;
|
tsp = &uts;
|
||||||
|
@ -436,13 +436,10 @@ linux_rt_sigtimedwait(struct thread *td,
|
|||||||
struct linux_rt_sigtimedwait_args *args)
|
struct linux_rt_sigtimedwait_args *args)
|
||||||
{
|
{
|
||||||
struct timespec ts, *tsa;
|
struct timespec ts, *tsa;
|
||||||
struct l_timespec lts;
|
|
||||||
int error;
|
int error;
|
||||||
|
|
||||||
if (args->timeout) {
|
if (args->timeout) {
|
||||||
if ((error = copyin(args->timeout, <s, sizeof(lts))))
|
error = linux_get_timespec(&ts, args->timeout);
|
||||||
return (error);
|
|
||||||
error = linux_to_native_timespec(&ts, <s);
|
|
||||||
if (error != 0)
|
if (error != 0)
|
||||||
return (error);
|
return (error);
|
||||||
tsa = &ts;
|
tsa = &ts;
|
||||||
@ -490,13 +487,10 @@ linux_rt_sigtimedwait_time64(struct thread *td,
|
|||||||
struct linux_rt_sigtimedwait_time64_args *args)
|
struct linux_rt_sigtimedwait_time64_args *args)
|
||||||
{
|
{
|
||||||
struct timespec ts, *tsa;
|
struct timespec ts, *tsa;
|
||||||
struct l_timespec64 lts;
|
|
||||||
int error;
|
int error;
|
||||||
|
|
||||||
if (args->timeout) {
|
if (args->timeout) {
|
||||||
if ((error = copyin(args->timeout, <s, sizeof(lts))))
|
error = linux_get_timespec64(&ts, args->timeout);
|
||||||
return (error);
|
|
||||||
error = linux_to_native_timespec64(&ts, <s);
|
|
||||||
if (error != 0)
|
if (error != 0)
|
||||||
return (error);
|
return (error);
|
||||||
tsa = &ts;
|
tsa = &ts;
|
||||||
|
@ -1786,15 +1786,11 @@ linux_recvmmsg_common(struct thread *td, l_int s, struct l_mmsghdr *msg,
|
|||||||
int
|
int
|
||||||
linux_recvmmsg(struct thread *td, struct linux_recvmmsg_args *args)
|
linux_recvmmsg(struct thread *td, struct linux_recvmmsg_args *args)
|
||||||
{
|
{
|
||||||
struct l_timespec lts;
|
|
||||||
struct timespec ts, tts, *ptts;
|
struct timespec ts, tts, *ptts;
|
||||||
int error;
|
int error;
|
||||||
|
|
||||||
if (args->timeout) {
|
if (args->timeout) {
|
||||||
error = copyin(args->timeout, <s, sizeof(struct l_timespec));
|
error = linux_get_timespec(&ts, args->timeout);
|
||||||
if (error != 0)
|
|
||||||
return (error);
|
|
||||||
error = linux_to_native_timespec(&ts, <s);
|
|
||||||
if (error != 0)
|
if (error != 0)
|
||||||
return (error);
|
return (error);
|
||||||
getnanotime(&tts);
|
getnanotime(&tts);
|
||||||
@ -1811,15 +1807,11 @@ linux_recvmmsg(struct thread *td, struct linux_recvmmsg_args *args)
|
|||||||
int
|
int
|
||||||
linux_recvmmsg_time64(struct thread *td, struct linux_recvmmsg_time64_args *args)
|
linux_recvmmsg_time64(struct thread *td, struct linux_recvmmsg_time64_args *args)
|
||||||
{
|
{
|
||||||
struct l_timespec64 lts;
|
|
||||||
struct timespec ts, tts, *ptts;
|
struct timespec ts, tts, *ptts;
|
||||||
int error;
|
int error;
|
||||||
|
|
||||||
if (args->timeout) {
|
if (args->timeout) {
|
||||||
error = copyin(args->timeout, <s, sizeof(struct l_timespec));
|
error = linux_get_timespec64(&ts, args->timeout);
|
||||||
if (error != 0)
|
|
||||||
return (error);
|
|
||||||
error = linux_to_native_timespec64(&ts, <s);
|
|
||||||
if (error != 0)
|
if (error != 0)
|
||||||
return (error);
|
return (error);
|
||||||
getnanotime(&tts);
|
getnanotime(&tts);
|
||||||
|
@ -101,16 +101,13 @@ LIN_SDT_PROBE_DEFINE1(time, linux_clock_getres, copyout_error, "int");
|
|||||||
#if defined(__i386__) || (defined(__amd64__) && defined(COMPAT_LINUX32))
|
#if defined(__i386__) || (defined(__amd64__) && defined(COMPAT_LINUX32))
|
||||||
LIN_SDT_PROBE_DEFINE1(time, linux_clock_getres_time64, copyout_error, "int");
|
LIN_SDT_PROBE_DEFINE1(time, linux_clock_getres_time64, copyout_error, "int");
|
||||||
#endif
|
#endif
|
||||||
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, copyout_error, "int");
|
||||||
LIN_SDT_PROBE_DEFINE1(time, linux_nanosleep, copyin_error, "int");
|
LIN_SDT_PROBE_DEFINE1(time, linux_nanosleep, copyin_error, "int");
|
||||||
LIN_SDT_PROBE_DEFINE1(time, linux_clock_nanosleep, conversion_error, "int");
|
|
||||||
LIN_SDT_PROBE_DEFINE1(time, linux_clock_nanosleep, copyout_error, "int");
|
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, copyin_error, "int");
|
||||||
LIN_SDT_PROBE_DEFINE1(time, linux_common_clock_nanosleep, unsupported_flags, "int");
|
LIN_SDT_PROBE_DEFINE1(time, linux_common_clock_nanosleep, unsupported_flags, "int");
|
||||||
LIN_SDT_PROBE_DEFINE1(time, linux_common_clock_nanosleep, unsupported_clockid, "int");
|
LIN_SDT_PROBE_DEFINE1(time, linux_common_clock_nanosleep, unsupported_clockid, "int");
|
||||||
#if defined(__i386__) || (defined(__amd64__) && defined(COMPAT_LINUX32))
|
#if defined(__i386__) || (defined(__amd64__) && defined(COMPAT_LINUX32))
|
||||||
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, copyout_error, "int");
|
||||||
LIN_SDT_PROBE_DEFINE1(time, linux_clock_nanosleep_time64, copyin_error, "int");
|
LIN_SDT_PROBE_DEFINE1(time, linux_clock_nanosleep_time64, copyin_error, "int");
|
||||||
#endif
|
#endif
|
||||||
@ -162,6 +159,18 @@ linux_put_timespec(struct timespec *ntp, struct l_timespec *ltp)
|
|||||||
return (copyout(<s, ltp, sizeof(lts)));
|
return (copyout(<s, ltp, sizeof(lts)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
linux_get_timespec(struct timespec *ntp, const struct l_timespec *ultp)
|
||||||
|
{
|
||||||
|
struct l_timespec lts;
|
||||||
|
int error;
|
||||||
|
|
||||||
|
error = copyin(ultp, <s, sizeof(lts));
|
||||||
|
if (error != 0)
|
||||||
|
return (error);
|
||||||
|
return (linux_to_native_timespec(ntp, <s));
|
||||||
|
}
|
||||||
|
|
||||||
#if defined(__i386__) || (defined(__amd64__) && defined(COMPAT_LINUX32))
|
#if defined(__i386__) || (defined(__amd64__) && defined(COMPAT_LINUX32))
|
||||||
int
|
int
|
||||||
native_to_linux_timespec64(struct l_timespec64 *ltp64, struct timespec *ntp)
|
native_to_linux_timespec64(struct l_timespec64 *ltp64, struct timespec *ntp)
|
||||||
@ -203,6 +212,18 @@ linux_put_timespec64(struct timespec *ntp, struct l_timespec64 *ltp)
|
|||||||
return (error);
|
return (error);
|
||||||
return (copyout(<s, ltp, sizeof(lts)));
|
return (copyout(<s, ltp, sizeof(lts)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
linux_get_timespec64(struct timespec *ntp, const struct l_timespec64 *ultp)
|
||||||
|
{
|
||||||
|
struct l_timespec64 lts;
|
||||||
|
int error;
|
||||||
|
|
||||||
|
error = copyin(ultp, <s, sizeof(lts));
|
||||||
|
if (error != 0)
|
||||||
|
return (error);
|
||||||
|
return (linux_to_native_timespec64(ntp, <s));
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int
|
int
|
||||||
@ -508,19 +529,13 @@ int
|
|||||||
linux_clock_settime(struct thread *td, struct linux_clock_settime_args *args)
|
linux_clock_settime(struct thread *td, struct linux_clock_settime_args *args)
|
||||||
{
|
{
|
||||||
struct timespec ts;
|
struct timespec ts;
|
||||||
struct l_timespec lts;
|
|
||||||
int error;
|
int error;
|
||||||
|
|
||||||
error = copyin(args->tp, <s, sizeof(lts));
|
error = linux_get_timespec(&ts, args->tp);
|
||||||
if (error != 0) {
|
if (error != 0) {
|
||||||
LIN_SDT_PROBE1(time, linux_clock_settime, copyin_error, error);
|
LIN_SDT_PROBE1(time, linux_clock_settime, copyin_error, error);
|
||||||
return (error);
|
return (error);
|
||||||
}
|
}
|
||||||
error = linux_to_native_timespec(&ts, <s);
|
|
||||||
if (error != 0)
|
|
||||||
LIN_SDT_PROBE1(time, linux_clock_settime, conversion_error,
|
|
||||||
error);
|
|
||||||
|
|
||||||
return (linux_common_clock_settime(td, args->which, &ts));
|
return (linux_common_clock_settime(td, args->which, &ts));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -529,18 +544,13 @@ int
|
|||||||
linux_clock_settime64(struct thread *td, struct linux_clock_settime64_args *args)
|
linux_clock_settime64(struct thread *td, struct linux_clock_settime64_args *args)
|
||||||
{
|
{
|
||||||
struct timespec ts;
|
struct timespec ts;
|
||||||
struct l_timespec64 lts;
|
|
||||||
int error;
|
int error;
|
||||||
|
|
||||||
error = copyin(args->tp, <s, sizeof(lts));
|
error = linux_get_timespec64(&ts, args->tp);
|
||||||
if (error != 0) {
|
if (error != 0) {
|
||||||
LIN_SDT_PROBE1(time, linux_clock_settime64, copyin_error, error);
|
LIN_SDT_PROBE1(time, linux_clock_settime64, copyin_error, error);
|
||||||
return (error);
|
return (error);
|
||||||
}
|
}
|
||||||
error = linux_to_native_timespec64(&ts, <s);
|
|
||||||
if (error != 0)
|
|
||||||
LIN_SDT_PROBE1(time, linux_clock_settime64, conversion_error,
|
|
||||||
error);
|
|
||||||
return (linux_common_clock_settime(td, args->which, &ts));
|
return (linux_common_clock_settime(td, args->which, &ts));
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -680,26 +690,19 @@ int
|
|||||||
linux_nanosleep(struct thread *td, struct linux_nanosleep_args *args)
|
linux_nanosleep(struct thread *td, struct linux_nanosleep_args *args)
|
||||||
{
|
{
|
||||||
struct timespec *rmtp;
|
struct timespec *rmtp;
|
||||||
struct l_timespec lrqts;
|
|
||||||
struct timespec rqts, rmts;
|
struct timespec rqts, rmts;
|
||||||
int error, error2;
|
int error, error2;
|
||||||
|
|
||||||
error = copyin(args->rqtp, &lrqts, sizeof lrqts);
|
error = linux_get_timespec(&rqts, args->rqtp);
|
||||||
if (error != 0) {
|
if (error != 0) {
|
||||||
LIN_SDT_PROBE1(time, linux_nanosleep, copyin_error, error);
|
LIN_SDT_PROBE1(time, linux_nanosleep, copyin_error, error);
|
||||||
return (error);
|
return (error);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (args->rmtp != NULL)
|
if (args->rmtp != NULL)
|
||||||
rmtp = &rmts;
|
rmtp = &rmts;
|
||||||
else
|
else
|
||||||
rmtp = NULL;
|
rmtp = NULL;
|
||||||
|
|
||||||
error = linux_to_native_timespec(&rqts, &lrqts);
|
|
||||||
if (error != 0) {
|
|
||||||
LIN_SDT_PROBE1(time, linux_nanosleep, conversion_error, error);
|
|
||||||
return (error);
|
|
||||||
}
|
|
||||||
error = kern_nanosleep(td, &rqts, rmtp);
|
error = kern_nanosleep(td, &rqts, rmtp);
|
||||||
if (error == EINTR && args->rmtp != NULL) {
|
if (error == EINTR && args->rmtp != NULL) {
|
||||||
error2 = linux_put_timespec(rmtp, args->rmtp);
|
error2 = linux_put_timespec(rmtp, args->rmtp);
|
||||||
@ -746,24 +749,15 @@ linux_clock_nanosleep(struct thread *td,
|
|||||||
struct linux_clock_nanosleep_args *args)
|
struct linux_clock_nanosleep_args *args)
|
||||||
{
|
{
|
||||||
struct timespec *rmtp;
|
struct timespec *rmtp;
|
||||||
struct l_timespec lrqts;
|
|
||||||
struct timespec rqts, rmts;
|
struct timespec rqts, rmts;
|
||||||
int error, error2;
|
int error, error2;
|
||||||
|
|
||||||
error = copyin(args->rqtp, &lrqts, sizeof(lrqts));
|
error = linux_get_timespec(&rqts, args->rqtp);
|
||||||
if (error != 0) {
|
if (error != 0) {
|
||||||
LIN_SDT_PROBE1(time, linux_clock_nanosleep, copyin_error,
|
LIN_SDT_PROBE1(time, linux_clock_nanosleep, copyin_error,
|
||||||
error);
|
error);
|
||||||
return (error);
|
return (error);
|
||||||
}
|
}
|
||||||
|
|
||||||
error = linux_to_native_timespec(&rqts, &lrqts);
|
|
||||||
if (error != 0) {
|
|
||||||
LIN_SDT_PROBE1(time, linux_clock_nanosleep, conversion_error,
|
|
||||||
error);
|
|
||||||
return (error);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (args->rmtp != NULL)
|
if (args->rmtp != NULL)
|
||||||
rmtp = &rmts;
|
rmtp = &rmts;
|
||||||
else
|
else
|
||||||
@ -789,24 +783,15 @@ linux_clock_nanosleep_time64(struct thread *td,
|
|||||||
struct linux_clock_nanosleep_time64_args *args)
|
struct linux_clock_nanosleep_time64_args *args)
|
||||||
{
|
{
|
||||||
struct timespec *rmtp;
|
struct timespec *rmtp;
|
||||||
struct l_timespec64 lrqts;
|
|
||||||
struct timespec rqts, rmts;
|
struct timespec rqts, rmts;
|
||||||
int error, error2;
|
int error, error2;
|
||||||
|
|
||||||
error = copyin(args->rqtp, &lrqts, sizeof(lrqts));
|
error = linux_get_timespec64(&rqts, args->rqtp);
|
||||||
if (error != 0) {
|
if (error != 0) {
|
||||||
LIN_SDT_PROBE1(time, linux_clock_nanosleep_time64,
|
LIN_SDT_PROBE1(time, linux_clock_nanosleep_time64,
|
||||||
copyin_error, error);
|
copyin_error, error);
|
||||||
return (error);
|
return (error);
|
||||||
}
|
}
|
||||||
|
|
||||||
error = linux_to_native_timespec64(&rqts, &lrqts);
|
|
||||||
if (error != 0) {
|
|
||||||
LIN_SDT_PROBE1(time, linux_clock_nanosleep_time64,
|
|
||||||
conversion_error, error);
|
|
||||||
return (error);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (args->rmtp != NULL)
|
if (args->rmtp != NULL)
|
||||||
rmtp = &rmts;
|
rmtp = &rmts;
|
||||||
else
|
else
|
||||||
|
@ -117,6 +117,8 @@ int linux_to_native_timespec(struct timespec *,
|
|||||||
struct l_timespec *);
|
struct l_timespec *);
|
||||||
int linux_put_timespec(struct timespec *,
|
int linux_put_timespec(struct timespec *,
|
||||||
struct l_timespec *);
|
struct l_timespec *);
|
||||||
|
int linux_get_timespec(struct timespec *,
|
||||||
|
const struct l_timespec *);
|
||||||
#if defined(__i386__) || (defined(__amd64__) && defined(COMPAT_LINUX32))
|
#if defined(__i386__) || (defined(__amd64__) && defined(COMPAT_LINUX32))
|
||||||
int native_to_linux_timespec64(struct l_timespec64 *,
|
int native_to_linux_timespec64(struct l_timespec64 *,
|
||||||
struct timespec *);
|
struct timespec *);
|
||||||
@ -124,6 +126,8 @@ int linux_to_native_timespec64(struct timespec *,
|
|||||||
struct l_timespec64 *);
|
struct l_timespec64 *);
|
||||||
int linux_put_timespec64(struct timespec *,
|
int linux_put_timespec64(struct timespec *,
|
||||||
struct l_timespec64 *);
|
struct l_timespec64 *);
|
||||||
|
int linux_get_timespec64(struct timespec *,
|
||||||
|
const struct l_timespec64 *);
|
||||||
#endif
|
#endif
|
||||||
int linux_to_native_clockid(clockid_t *, clockid_t);
|
int linux_to_native_clockid(clockid_t *, clockid_t);
|
||||||
int native_to_linux_itimerspec(struct l_itimerspec *,
|
int native_to_linux_itimerspec(struct l_itimerspec *,
|
||||||
|
Loading…
Reference in New Issue
Block a user