LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH] perf tools: Fix pthread_attr_setaffinity_np build error
@ 2015-02-24 10:46 Adrian Hunter
  2015-02-24 13:32 ` Josh Boyer
  2015-03-01 16:50 ` [tip:perf/urgent] " tip-bot for Adrian Hunter
  0 siblings, 2 replies; 9+ messages in thread
From: Adrian Hunter @ 2015-02-24 10:46 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo; +Cc: linux-kernel, Jiri Olsa

Feature detection for pthread_attr_setaffinity_np was failing,
producing this error:

In file included from bench/futex-hash.c:17:0:
bench/futex.h:73:19: error: conflicting types for ‘pthread_attr_setaffinity_np’
 static inline int pthread_attr_setaffinity_np(pthread_attr_t *attr,
                   ^
In file included from bench/futex.h:72:0,
                 from bench/futex-hash.c:17:
/usr/include/pthread.h:407:12: note: previous declaration of ‘pthread_attr_setaffinity_np’ was here
 extern int pthread_attr_setaffinity_np (pthread_attr_t *__attr,
            ^
make[3]: *** [bench/futex-hash.o] Error 1
make[2]: *** [bench] Error 2
make[2]: *** Waiting for unfinished jobs....

This was because compiling test-pthread-attr-setaffinity-np.c
failed due to the function arguments:

test-pthread-attr-setaffinity-np.c: In function ‘main’:
test-pthread-attr-setaffinity-np.c:11:2: warning: null argument where non-null required (argument 3) [-Wnonnull]
  ret = pthread_attr_setaffinity_np(&thread_attr, 0, NULL);
  ^
So fix the arguments.

Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
---
 tools/perf/config/feature-checks/test-pthread-attr-setaffinity-np.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/tools/perf/config/feature-checks/test-pthread-attr-setaffinity-np.c b/tools/perf/config/feature-checks/test-pthread-attr-setaffinity-np.c
index 0a0d3ec..2b81b72 100644
--- a/tools/perf/config/feature-checks/test-pthread-attr-setaffinity-np.c
+++ b/tools/perf/config/feature-checks/test-pthread-attr-setaffinity-np.c
@@ -5,10 +5,11 @@ int main(void)
 {
 	int ret = 0;
 	pthread_attr_t thread_attr;
+	cpu_set_t cs;
 
 	pthread_attr_init(&thread_attr);
 	/* don't care abt exact args, just the API itself in libpthread */
-	ret = pthread_attr_setaffinity_np(&thread_attr, 0, NULL);
+	ret = pthread_attr_setaffinity_np(&thread_attr, sizeof(cs), &cs);
 
 	return ret;
 }
-- 
1.9.1


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2015-03-03  6:26 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-02-24 10:46 [PATCH] perf tools: Fix pthread_attr_setaffinity_np build error Adrian Hunter
2015-02-24 13:32 ` Josh Boyer
2015-02-24 13:52   ` Adrian Hunter
2015-02-24 14:31     ` Josh Boyer
2015-02-25  6:50       ` Adrian Hunter
2015-03-01 16:50 ` [tip:perf/urgent] " tip-bot for Adrian Hunter
2015-03-01 16:52   ` Ingo Molnar
2015-03-02  7:59     ` [PATCH] perf tools: Initialize cpu set in pthread_attr_setaffinity_np feature test Adrian Hunter
2015-03-03  6:26       ` [tip:perf/core] " tip-bot for Adrian Hunter

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).