summaryrefslogtreecommitdiffstats
path: root/bin/sleep
diff options
context:
space:
mode:
authorjilles <jilles@FreeBSD.org>2013-06-05 20:15:18 +0000
committerjilles <jilles@FreeBSD.org>2013-06-05 20:15:18 +0000
commit077e1ba486f8b0d260d447854bfb494b94dfcb8b (patch)
tree80f90cfaf9d8b38dd5000b045060dab9aef33048 /bin/sleep
parent7deb35147a0d314af6cbf6c187c29f7312bdf3c4 (diff)
downloadFreeBSD-src-077e1ba486f8b0d260d447854bfb494b94dfcb8b.zip
FreeBSD-src-077e1ba486f8b0d260d447854bfb494b94dfcb8b.tar.gz
sleep: Explain in a comment why the [EINTR] check is there.
Suggested by: eadler
Diffstat (limited to 'bin/sleep')
-rw-r--r--bin/sleep/sleep.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/bin/sleep/sleep.c b/bin/sleep/sleep.c
index 0d41a42..ca08272 100644
--- a/bin/sleep/sleep.c
+++ b/bin/sleep/sleep.c
@@ -82,6 +82,12 @@ main(int argc, char *argv[])
time_to_sleep.tv_nsec = 1e9 * (d - time_to_sleep.tv_sec);
signal(SIGINFO, report_request);
+
+ /*
+ * Note: [EINTR] is supposed to happen only when a signal was handled
+ * but the kernel also returns it when a ptrace-based debugger
+ * attaches. This is a bug but it is hard to fix.
+ */
while (nanosleep(&time_to_sleep, &time_to_sleep) != 0) {
if (report_requested) {
/* Reporting does not bother with nanoseconds. */
OpenPOWER on IntegriCloud