aboutsummaryrefslogtreecommitdiffstats
path: root/man/man2/timer_create.2
diff options
context:
space:
mode:
Diffstat (limited to 'man/man2/timer_create.2')
-rw-r--r--man/man2/timer_create.220
1 files changed, 9 insertions, 11 deletions
diff --git a/man/man2/timer_create.2 b/man/man2/timer_create.2
index 287d7bda4a..90ed35ef85 100644
--- a/man/man2/timer_create.2
+++ b/man/man2/timer_create.2
@@ -353,6 +353,7 @@ Caught signal 34
\&
.\" SRC BEGIN (timer_create.c)
.EX
+#include <err.h>
#include <signal.h>
#include <stdint.h>
#include <stdio.h>
@@ -363,9 +364,6 @@ Caught signal 34
#define CLOCKID CLOCK_REALTIME
#define SIG SIGRTMIN
\&
-#define errExit(msg) do { perror(msg); exit(EXIT_FAILURE); \[rs]
- } while (0)
-\&
static void
print_siginfo(siginfo_t *si)
{
@@ -379,9 +377,9 @@ print_siginfo(siginfo_t *si)
\&
or = timer_getoverrun(*tidp);
if (or == \-1)
- errExit("timer_getoverrun");
- else
- printf(" overrun count = %d\[rs]n", or);
+ err(EXIT_FAILURE, "timer_getoverrun");
+\&
+ printf(" overrun count = %d\[rs]n", or);
}
\&
static void
@@ -421,7 +419,7 @@ main(int argc, char *argv[])
sa.sa_sigaction = handler;
sigemptyset(&sa.sa_mask);
if (sigaction(SIG, &sa, NULL) == \-1)
- errExit("sigaction");
+ err(EXIT_FAILURE, "sigaction");
\&
/* Block timer signal temporarily. */
\&
@@ -429,7 +427,7 @@ main(int argc, char *argv[])
sigemptyset(&mask);
sigaddset(&mask, SIG);
if (sigprocmask(SIG_SETMASK, &mask, NULL) == \-1)
- errExit("sigprocmask");
+ err(EXIT_FAILURE, "sigprocmask");
\&
/* Create the timer. */
\&
@@ -437,7 +435,7 @@ main(int argc, char *argv[])
sev.sigev_signo = SIG;
sev.sigev_value.sival_ptr = &timerid;
if (timer_create(CLOCKID, &sev, &timerid) == \-1)
- errExit("timer_create");
+ err(EXIT_FAILURE, "timer_create");
\&
printf("timer ID is %#jx\[rs]n", (uintmax_t) timerid);
\&
@@ -450,7 +448,7 @@ main(int argc, char *argv[])
its.it_interval.tv_nsec = its.it_value.tv_nsec;
\&
if (timer_settime(timerid, 0, &its, NULL) == \-1)
- errExit("timer_settime");
+ err(EXIT_FAILURE, "timer_settime");
\&
/* Sleep for a while; meanwhile, the timer may expire
multiple times. */
@@ -463,7 +461,7 @@ main(int argc, char *argv[])
\&
printf("Unblocking signal %d\[rs]n", SIG);
if (sigprocmask(SIG_UNBLOCK, &mask, NULL) == \-1)
- errExit("sigprocmask");
+ err(EXIT_FAILURE, "sigprocmask");
\&
exit(EXIT_SUCCESS);
}