Module Name:    src
Committed By:   riastradh
Date:           Tue Feb 25 10:15:42 UTC 2025

Modified Files:
        src/lib/libpthread: affinity.3

Log Message:
libpthread/affinity.3: Fix error reporting in example.

pthread_setaffinity_np does not set errno, so err(...) is wrong.
Instead, it returns the error number, which requires either
errc(..., error, ...)  or  errno = error; err(...).


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/lib/libpthread/affinity.3

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/libpthread/affinity.3
diff -u src/lib/libpthread/affinity.3:1.9 src/lib/libpthread/affinity.3:1.10
--- src/lib/libpthread/affinity.3:1.9	Fri Feb 21 15:25:37 2025
+++ src/lib/libpthread/affinity.3	Tue Feb 25 10:15:41 2025
@@ -1,4 +1,4 @@
-.\"	$NetBSD: affinity.3,v 1.9 2025/02/21 15:25:37 wiz Exp $
+.\"	$NetBSD: affinity.3,v 1.10 2025/02/25 10:15:41 riastradh Exp $
 .\"
 .\" Copyright (c) 2008 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -107,7 +107,7 @@ thread to the CPU whose ID is 0:
 	pth = pthread_self();
 	error = pthread_setaffinity_np(pth, cpuset_size(cset), cset);
 	if (error) {
-		err(EXIT_FAILURE, "pthread_setaffinity_np failed");
+		errc(EXIT_FAILURE, error, "pthread_setaffinity_np failed");
 	}
 	cpuset_destroy(cset);
 .Ed

Reply via email to