aboutsummaryrefslogtreecommitdiffstats
path: root/man/man3/pthread_sigmask.3
diff options
context:
space:
mode:
authorAlejandro Colomar <alx@kernel.org>2025-08-19 17:48:50 +0200
committerAlejandro Colomar <alx@kernel.org>2025-08-20 18:14:03 +0200
commit0e7a39804a3c017a209117fc2243c6cbb543dede (patch)
tree91e0b287d8b826d668c3d8118347f07cc8b8964a /man/man3/pthread_sigmask.3
parente2d3f14fe40ad90a1fedf0fcd27e6cc896c49a7a (diff)
downloadman-pages-0e7a39804a3c.tar.gz
man/: EXAMPLES: Use err(3) and errc(3bsd) instead of similar macros
These functions are quite portable. And if one doesn't have them for some reason (but libbsd has been ported to many systems), one can write them easily as macros, anyway. Signed-off-by: Alejandro Colomar <alx@kernel.org>
Diffstat (limited to 'man/man3/pthread_sigmask.3')
-rw-r--r--man/man3/pthread_sigmask.310
1 files changed, 4 insertions, 6 deletions
diff --git a/man/man3/pthread_sigmask.3 b/man/man3/pthread_sigmask.3
index 2175e3a97d..bf9ad38008 100644
--- a/man/man3/pthread_sigmask.3
+++ b/man/man3/pthread_sigmask.3
@@ -95,6 +95,7 @@ Signal handling thread got signal 10
\&
.\" SRC BEGIN (pthread_sigmask.c)
.EX
+#include <err.h>
#include <errno.h>
#include <pthread.h>
#include <signal.h>
@@ -104,9 +105,6 @@ Signal handling thread got signal 10
\&
/* Simple error handling functions */
\&
-#define handle_error_en(en, msg) \[rs]
- do { errno = en; perror(msg); exit(EXIT_FAILURE); } while (0)
-\&
static void *
sig_thread(void *arg)
{
@@ -116,7 +114,7 @@ sig_thread(void *arg)
for (;;) {
s = sigwait(set, &sig);
if (s != 0)
- handle_error_en(s, "sigwait");
+ errc(EXIT_FAILURE, s, "sigwait");
printf("Signal handling thread got signal %d\[rs]n", sig);
}
}
@@ -136,11 +134,11 @@ main(void)
sigaddset(&set, SIGUSR1);
s = pthread_sigmask(SIG_BLOCK, &set, NULL);
if (s != 0)
- handle_error_en(s, "pthread_sigmask");
+ errc(EXIT_FAILURE, s, "pthread_sigmask");
\&
s = pthread_create(&thread, NULL, &sig_thread, &set);
if (s != 0)
- handle_error_en(s, "pthread_create");
+ errc(EXIT_FAILURE, s, "pthread_create");
\&
/* Main thread carries on to create other threads and/or do
other work. */