From 3c570c9cd2f4adc954a98c73e2e500fd0de05f25 Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Tue, 16 Aug 2011 06:41:06 -0400 Subject: [PATCH] api: make api_gcc.h a superset of the other headers After this patch the only differences are: - for_each_tid is now defined in api_x86.h - HAVE_CPU_SET_T and HAVE_SCHED_SETAFFINITY are now defined in api_ppc.h Signed-off-by: Mathieu Desnoyers --- tests/api_gcc.h | 11 +++++++++-- tests/api_ppc.h | 2 -- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/tests/api_gcc.h b/tests/api_gcc.h index 93b7244..9874334 100644 --- a/tests/api_gcc.h +++ b/tests/api_gcc.h @@ -27,6 +27,8 @@ * to redistribute under later versions of GPL might not be available. */ +#include + #ifndef __always_inline #define __always_inline inline #endif @@ -162,8 +164,8 @@ typedef pthread_t thread_id_t; #define NR_THREADS 128 -#define __THREAD_ID_MAP_EMPTY 0 -#define __THREAD_ID_MAP_WAITING 1 +#define __THREAD_ID_MAP_EMPTY ((thread_id_t) 0) +#define __THREAD_ID_MAP_WAITING ((thread_id_t) 1) thread_id_t __thread_id_map[NR_THREADS]; spinlock_t __thread_id_map_mutex; @@ -175,6 +177,11 @@ spinlock_t __thread_id_map_mutex; if ((__thread_id_map[t] != __THREAD_ID_MAP_EMPTY) && \ (__thread_id_map[t] != __THREAD_ID_MAP_WAITING)) +#define for_each_tid(t, tid) \ + for (t = 0; t < NR_THREADS; t++) \ + if ((((tid) = __thread_id_map[t]) != __THREAD_ID_MAP_EMPTY) && \ + ((tid) != __THREAD_ID_MAP_WAITING)) + pthread_key_t thread_id_key; static int __smp_thread_id(void) diff --git a/tests/api_ppc.h b/tests/api_ppc.h index cd3f2f3..255cb89 100644 --- a/tests/api_ppc.h +++ b/tests/api_ppc.h @@ -74,8 +74,6 @@ * Machine parameters. */ -#define CONFIG_PPC64 - #define ____cacheline_internodealigned_in_smp \ __attribute__((__aligned__(CAA_CACHE_LINE_SIZE))) -- 2.34.1