Linux nanosleep() and clock_nanosleep() system calls always
writes the remaining time into the structure pointed to by rmtp unless rmtp is NULL. The value of *rmtp can then be used to call nanosleep() again and complete the specified pause if the previous call was interrupted. Note. clock_nanosleep() with an absolute time value does not write the remaining time. While here fix whitespaces and typo in SDT_PROBE.
This commit is contained in:
parent
a71dbd5ba1
commit
859a8ae821
@ -105,14 +105,12 @@ LIN_SDT_PROBE_DEFINE1(time, linux_clock_getres, return, "int");
|
||||
LIN_SDT_PROBE_DEFINE2(time, linux_nanosleep, entry, "const struct l_timespec *",
|
||||
"struct l_timespec *");
|
||||
LIN_SDT_PROBE_DEFINE1(time, linux_nanosleep, conversion_error, "int");
|
||||
LIN_SDT_PROBE_DEFINE1(time, linux_nanosleep, nanosleep_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, return, "int");
|
||||
LIN_SDT_PROBE_DEFINE4(time, linux_clock_nanosleep, entry, "clockid_t", "int",
|
||||
"struct l_timespec *", "struct l_timespec *");
|
||||
LIN_SDT_PROBE_DEFINE1(time, linux_clock_nanosleep, conversion_error, "int");
|
||||
LIN_SDT_PROBE_DEFINE1(time, linux_clock_nanosleep, nanosleep_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, unsupported_flags, "int");
|
||||
@ -468,7 +466,7 @@ linux_nanosleep(struct thread *td, struct linux_nanosleep_args *args)
|
||||
struct timespec *rmtp;
|
||||
struct l_timespec lrqts, lrmts;
|
||||
struct timespec rqts, rmts;
|
||||
int error;
|
||||
int error, error2;
|
||||
|
||||
LIN_SDT_PROBE2(time, linux_nanosleep, entry, args->rqtp, args->rmtp);
|
||||
|
||||
@ -480,9 +478,9 @@ linux_nanosleep(struct thread *td, struct linux_nanosleep_args *args)
|
||||
}
|
||||
|
||||
if (args->rmtp != NULL)
|
||||
rmtp = &rmts;
|
||||
rmtp = &rmts;
|
||||
else
|
||||
rmtp = NULL;
|
||||
rmtp = NULL;
|
||||
|
||||
error = linux_to_native_timespec(&rqts, &lrqts);
|
||||
if (error != 0) {
|
||||
@ -491,25 +489,19 @@ linux_nanosleep(struct thread *td, struct linux_nanosleep_args *args)
|
||||
return (error);
|
||||
}
|
||||
error = kern_nanosleep(td, &rqts, rmtp);
|
||||
if (error != 0) {
|
||||
LIN_SDT_PROBE1(time, linux_nanosleep, nanosleep_error, error);
|
||||
LIN_SDT_PROBE1(time, linux_nanosleep, return, error);
|
||||
return (error);
|
||||
}
|
||||
|
||||
if (args->rmtp != NULL) {
|
||||
native_to_linux_timespec(&lrmts, rmtp);
|
||||
error = copyout(&lrmts, args->rmtp, sizeof(lrmts));
|
||||
if (error != 0) {
|
||||
native_to_linux_timespec(&lrmts, rmtp);
|
||||
error2 = copyout(&lrmts, args->rmtp, sizeof(lrmts));
|
||||
if (error2 != 0) {
|
||||
LIN_SDT_PROBE1(time, linux_nanosleep, copyout_error,
|
||||
error);
|
||||
LIN_SDT_PROBE1(time, linux_nanosleep, return, error);
|
||||
return (error);
|
||||
error2);
|
||||
LIN_SDT_PROBE1(time, linux_nanosleep, return, error2);
|
||||
return (error2);
|
||||
}
|
||||
}
|
||||
|
||||
LIN_SDT_PROBE1(time, linux_nanosleep, return, 0);
|
||||
return (0);
|
||||
LIN_SDT_PROBE1(time, linux_nanosleep, return, error);
|
||||
return (error);
|
||||
}
|
||||
|
||||
int
|
||||
@ -518,7 +510,7 @@ linux_clock_nanosleep(struct thread *td, struct linux_clock_nanosleep_args *args
|
||||
struct timespec *rmtp;
|
||||
struct l_timespec lrqts, lrmts;
|
||||
struct timespec rqts, rmts;
|
||||
int error;
|
||||
int error, error2;
|
||||
|
||||
LIN_SDT_PROBE4(time, linux_clock_nanosleep, entry, args->which,
|
||||
args->flags, args->rqtp, args->rmtp);
|
||||
@ -538,7 +530,7 @@ linux_clock_nanosleep(struct thread *td, struct linux_clock_nanosleep_args *args
|
||||
return (EINVAL);
|
||||
}
|
||||
|
||||
error = copyin(args->rqtp, &lrqts, sizeof lrqts);
|
||||
error = copyin(args->rqtp, &lrqts, sizeof(lrqts));
|
||||
if (error != 0) {
|
||||
LIN_SDT_PROBE1(time, linux_clock_nanosleep, copyin_error,
|
||||
error);
|
||||
@ -547,9 +539,9 @@ linux_clock_nanosleep(struct thread *td, struct linux_clock_nanosleep_args *args
|
||||
}
|
||||
|
||||
if (args->rmtp != NULL)
|
||||
rmtp = &rmts;
|
||||
rmtp = &rmts;
|
||||
else
|
||||
rmtp = NULL;
|
||||
rmtp = NULL;
|
||||
|
||||
error = linux_to_native_timespec(&rqts, &lrqts);
|
||||
if (error != 0) {
|
||||
@ -559,24 +551,19 @@ linux_clock_nanosleep(struct thread *td, struct linux_clock_nanosleep_args *args
|
||||
return (error);
|
||||
}
|
||||
error = kern_nanosleep(td, &rqts, rmtp);
|
||||
if (error != 0) {
|
||||
LIN_SDT_PROBE1(time, linux_clock_nanosleep, nanosleep_error,
|
||||
error);
|
||||
LIN_SDT_PROBE1(time, linux_clock_nanosleep, return, error);
|
||||
return (error);
|
||||
}
|
||||
|
||||
if (args->rmtp != NULL) {
|
||||
/* XXX. Not for TIMER_ABSTIME */
|
||||
native_to_linux_timespec(&lrmts, rmtp);
|
||||
error = copyout(&lrmts, args->rmtp, sizeof lrmts );
|
||||
if (error != 0) {
|
||||
error2 = copyout(&lrmts, args->rmtp, sizeof(lrmts));
|
||||
if (error2 != 0) {
|
||||
LIN_SDT_PROBE1(time, linux_clock_nanosleep,
|
||||
copyout_error, error);
|
||||
LIN_SDT_PROBE1(time, linux_nanosleep, return, error);
|
||||
return (error);
|
||||
copyout_error, error2);
|
||||
LIN_SDT_PROBE1(time, linux_clock_nanosleep,
|
||||
return, error2);
|
||||
return (error2);
|
||||
}
|
||||
}
|
||||
|
||||
LIN_SDT_PROBE1(time, linux_clock_nanosleep, return, 0);
|
||||
return (0);
|
||||
LIN_SDT_PROBE1(time, linux_clock_nanosleep, return, error);
|
||||
return (error);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user