aboutsummaryrefslogtreecommitdiffstats
path: root/man2/sched_setaffinity.2
diff options
context:
space:
mode:
authorAlejandro Colomar <alx@kernel.org>2023-05-03 00:48:14 +0200
committerAlejandro Colomar <alx@kernel.org>2023-05-03 00:48:22 +0200
commitfe5dba139dc089eae4061fdc17f087e71f48b198 (patch)
tree54af56b1b0138bde9a21e99372ab68ce4d64564a /man2/sched_setaffinity.2
parent5a0d9ed151e6449d978fabdd654cacc17b20a235 (diff)
downloadman-pages-fe5dba139dc089eae4061fdc17f087e71f48b198.tar.gz
man*/, man.ignore.grep: srcfix; warn about blank lines
- Use the dummy character to avoid warnings in examples. - Re-enable the warning. Suggested-by: "G. Branden Robinson" <g.branden.robinson@gmail.com> Signed-off-by: Alejandro Colomar <alx@kernel.org>
Diffstat (limited to 'man2/sched_setaffinity.2')
-rw-r--r--man2/sched_setaffinity.226
1 files changed, 13 insertions, 13 deletions
diff --git a/man2/sched_setaffinity.2 b/man2/sched_setaffinity.2
index 01e4a4f9e5..958d14cd2a 100644
--- a/man2/sched_setaffinity.2
+++ b/man2/sched_setaffinity.2
@@ -351,50 +351,50 @@ sys 12.07
#include <stdlib.h>
#include <sys/wait.h>
#include <unistd.h>
-
+\&
int
main(int argc, char *argv[])
{
int parentCPU, childCPU;
cpu_set_t set;
unsigned int nloops;
-
+\&
if (argc != 4) {
fprintf(stderr, "Usage: %s parent\-cpu child\-cpu num\-loops\en",
argv[0]);
exit(EXIT_FAILURE);
}
-
+\&
parentCPU = atoi(argv[1]);
childCPU = atoi(argv[2]);
nloops = atoi(argv[3]);
-
+\&
CPU_ZERO(&set);
-
+\&
switch (fork()) {
case \-1: /* Error */
err(EXIT_FAILURE, "fork");
-
+\&
case 0: /* Child */
CPU_SET(childCPU, &set);
-
+\&
if (sched_setaffinity(getpid(), sizeof(set), &set) == \-1)
err(EXIT_FAILURE, "sched_setaffinity");
-
+\&
for (unsigned int j = 0; j < nloops; j++)
getppid();
-
+\&
exit(EXIT_SUCCESS);
-
+\&
default: /* Parent */
CPU_SET(parentCPU, &set);
-
+\&
if (sched_setaffinity(getpid(), sizeof(set), &set) == \-1)
err(EXIT_FAILURE, "sched_setaffinity");
-
+\&
for (unsigned int j = 0; j < nloops; j++)
getppid();
-
+\&
wait(NULL); /* Wait for child to terminate */
exit(EXIT_SUCCESS);
}