summaryrefslogtreecommitdiffstats
path: root/sys/sys
diff options
context:
space:
mode:
authorvangyzen <vangyzen@FreeBSD.org>2017-05-01 01:36:54 +0000
committervangyzen <vangyzen@FreeBSD.org>2017-05-01 01:36:54 +0000
commit1f3f7c15d6db5da93247e3a10bb3f1ff40f61915 (patch)
tree2c49170567af964db6609d58aff8eb6a7649f4ce /sys/sys
parent57723a7d7f1db867d4acce11b84c8389cefc9acd (diff)
downloadFreeBSD-src-1f3f7c15d6db5da93247e3a10bb3f1ff40f61915.zip
FreeBSD-src-1f3f7c15d6db5da93247e3a10bb3f1ff40f61915.tar.gz
MFC r315526
Add clock_nanosleep() Add a clock_nanosleep() syscall, as specified by POSIX. Make nanosleep() a wrapper around it. Attach the clock_nanosleep test from NetBSD. Adjust it for the FreeBSD behavior of updating rmtp only when interrupted by a signal. I believe this to be POSIX-compliant, since POSIX mentions the rmtp parameter only in the paragraph about EINTR. This is also what Linux does. (NetBSD updates rmtp unconditionally.) Copy the whole nanosleep.2 man page from NetBSD because it is complete and closely resembles the POSIX description. Edit, polish, and reword it a bit, being sure to keep any relevant text from the FreeBSD page. Regenerate syscall files. Relnotes: yes Sponsored by: Dell EMC
Diffstat (limited to 'sys/sys')
-rw-r--r--sys/sys/syscall.h1
-rw-r--r--sys/sys/syscall.mk1
-rw-r--r--sys/sys/syscallsubr.h2
-rw-r--r--sys/sys/sysproto.h8
4 files changed, 12 insertions, 0 deletions
diff --git a/sys/sys/syscall.h b/sys/sys/syscall.h
index a39a9f2..806a549 100644
--- a/sys/sys/syscall.h
+++ b/sys/sys/syscall.h
@@ -219,6 +219,7 @@
#define SYS_ffclock_getcounter 241
#define SYS_ffclock_setestimate 242
#define SYS_ffclock_getestimate 243
+#define SYS_clock_nanosleep 244
#define SYS_clock_getcpuclockid2 247
#define SYS_ntp_gettime 248
#define SYS_minherit 250
diff --git a/sys/sys/syscall.mk b/sys/sys/syscall.mk
index 1a073ef..113572d 100644
--- a/sys/sys/syscall.mk
+++ b/sys/sys/syscall.mk
@@ -159,6 +159,7 @@ MIASM = \
ffclock_getcounter.o \
ffclock_setestimate.o \
ffclock_getestimate.o \
+ clock_nanosleep.o \
clock_getcpuclockid2.o \
ntp_gettime.o \
minherit.o \
diff --git a/sys/sys/syscallsubr.h b/sys/sys/syscallsubr.h
index ff2a110..16af617 100644
--- a/sys/sys/syscallsubr.h
+++ b/sys/sys/syscallsubr.h
@@ -83,6 +83,8 @@ int kern_clock_getres(struct thread *td, clockid_t clock_id,
struct timespec *ts);
int kern_clock_gettime(struct thread *td, clockid_t clock_id,
struct timespec *ats);
+int kern_clock_nanosleep(struct thread *td, clockid_t clock_id, int flags,
+ const struct timespec *rqtp, struct timespec *rmtp);
int kern_clock_settime(struct thread *td, clockid_t clock_id,
struct timespec *ats);
int kern_close(struct thread *td, int fd);
diff --git a/sys/sys/sysproto.h b/sys/sys/sysproto.h
index df6e8fa..9843ad5 100644
--- a/sys/sys/sysproto.h
+++ b/sys/sys/sysproto.h
@@ -698,6 +698,12 @@ struct ffclock_setestimate_args {
struct ffclock_getestimate_args {
char cest_l_[PADL_(struct ffclock_estimate *)]; struct ffclock_estimate * cest; char cest_r_[PADR_(struct ffclock_estimate *)];
};
+struct clock_nanosleep_args {
+ char clock_id_l_[PADL_(clockid_t)]; clockid_t clock_id; char clock_id_r_[PADR_(clockid_t)];
+ char flags_l_[PADL_(int)]; int flags; char flags_r_[PADR_(int)];
+ char rqtp_l_[PADL_(const struct timespec *)]; const struct timespec * rqtp; char rqtp_r_[PADR_(const struct timespec *)];
+ char rmtp_l_[PADL_(struct timespec *)]; struct timespec * rmtp; char rmtp_r_[PADR_(struct timespec *)];
+};
struct clock_getcpuclockid2_args {
char id_l_[PADL_(id_t)]; id_t id; char id_r_[PADR_(id_t)];
char which_l_[PADL_(int)]; int which; char which_r_[PADR_(int)];
@@ -1942,6 +1948,7 @@ int sys_nanosleep(struct thread *, struct nanosleep_args *);
int sys_ffclock_getcounter(struct thread *, struct ffclock_getcounter_args *);
int sys_ffclock_setestimate(struct thread *, struct ffclock_setestimate_args *);
int sys_ffclock_getestimate(struct thread *, struct ffclock_getestimate_args *);
+int sys_clock_nanosleep(struct thread *, struct clock_nanosleep_args *);
int sys_clock_getcpuclockid2(struct thread *, struct clock_getcpuclockid2_args *);
int sys_ntp_gettime(struct thread *, struct ntp_gettime_args *);
int sys_minherit(struct thread *, struct minherit_args *);
@@ -2713,6 +2720,7 @@ int freebsd10_pipe(struct thread *, struct freebsd10_pipe_args *);
#define SYS_AUE_ffclock_getcounter AUE_NULL
#define SYS_AUE_ffclock_setestimate AUE_NULL
#define SYS_AUE_ffclock_getestimate AUE_NULL
+#define SYS_AUE_clock_nanosleep AUE_NULL
#define SYS_AUE_clock_getcpuclockid2 AUE_NULL
#define SYS_AUE_ntp_gettime AUE_NULL
#define SYS_AUE_minherit AUE_MINHERIT
OpenPOWER on IntegriCloud