linux-rt-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: John Kacur <jkacur@redhat.com>
To: rt-users <linux-rt-users@vger.kernel.org>
Cc: Clark Williams <williams@redhat.com>, John Kacur <jkacur@redhat.com>
Subject: [PATCH 2/6] rt-tests: cyclictest: Report all errors from pthread_setaffinity_np
Date: Mon,  2 Mar 2020 16:44:26 -0500	[thread overview]
Message-ID: <20200302214430.15825-3-jkacur@redhat.com> (raw)
In-Reply-To: <20200302214430.15825-1-jkacur@redhat.com>

On error pthread_setaffinity_np returns a non-zero number.
Make sure cyclictest prints a warning in all such cases.

Signed-off-by: John Kacur <jkacur@redhat.com>
---
 src/cyclictest/cyclictest.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/cyclictest/cyclictest.c b/src/cyclictest/cyclictest.c
index c66755dd4d87..bd1fcd1092aa 100644
--- a/src/cyclictest/cyclictest.c
+++ b/src/cyclictest/cyclictest.c
@@ -650,7 +650,7 @@ static void *timerthread(void *param)
 		CPU_ZERO(&mask);
 		CPU_SET(par->cpu, &mask);
 		thread = pthread_self();
-		if (pthread_setaffinity_np(thread, sizeof(mask), &mask) == -1)
+		if (pthread_setaffinity_np(thread, sizeof(mask), &mask) != 0)
 			warn("Could not set CPU affinity to CPU #%d\n",
 			     par->cpu);
 	}
-- 
2.20.1


  parent reply	other threads:[~2020-03-02 21:44 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-02 21:44 [PATCH 0/6] Affinity devel and fixes John Kacur
2020-03-02 21:44 ` [PATCH 1/6] rt-tests: cyclictest: Set errno to 0 before call to mlock John Kacur
2020-03-02 21:44 ` John Kacur [this message]
2020-03-02 21:44 ` [PATCH 3/6] rt-tests: cyclictest: Fix parsing affinity with a space and a leading zero John Kacur
2020-03-02 21:44 ` [PATCH 4/6] rt-tests: cyclictest: Fix parsing affinity with leading exclamation mark John Kacur
2020-03-02 21:44 ` [PATCH 5/6] rt-tests: cyclictest: Only run on available cpus according to the affinity John Kacur
2020-03-02 21:44 ` [PATCH 6/6] rt-tests: cyclictest: Only run on runtime affinity and user supplied affinity John Kacur

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200302214430.15825-3-jkacur@redhat.com \
    --to=jkacur@redhat.com \
    --cc=linux-rt-users@vger.kernel.org \
    --cc=williams@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).