X-Git-Url: https://git.liburcu.org/?p=urcu.git;a=blobdiff_plain;f=tests%2Fapi.h;h=dced0d8d204e15b84252f1f374f7b5027d12490b;hp=49c96f7d969eb4fa01bb35b7efc0c50266e88d79;hb=8ff97cc3836c6a2739b62af0a859511c9c284e4f;hpb=8c4f4949473b6a74419e323c55cae2a8a33d58c0 diff --git a/tests/api.h b/tests/api.h index 49c96f7..dced0d8 100644 --- a/tests/api.h +++ b/tests/api.h @@ -1,7 +1,7 @@ - #ifndef _INCLUDE_API_H #define _INCLUDE_API_H +#define _GNU_SOURCE #include "../config.h" /* @@ -19,7 +19,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * Copyright (c) 2006 Paul E. McKenney, IBM. * @@ -27,10 +27,9 @@ * to redistribute under later versions of GPL might not be available. */ +#include #include - -#define BUILD_BUG_ON(condition) ((void)sizeof(char[1 - 2*!!(condition)])) -#define BUILD_BUG_ON_ZERO(e) (sizeof(char[1 - 2 * !!(e)]) - 1) +#include "cpuset.h" /* * Machine parameters. @@ -56,7 +55,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * Copyright (c) 2006 Paul E. McKenney, IBM. */ @@ -66,9 +65,7 @@ #include #include #include -#define __USE_GNU #include -#include #include /* #include "atomic.h" */ @@ -154,13 +151,14 @@ static int __smp_thread_id(void) } spin_lock(&__thread_id_map_mutex); for (i = 0; i < NR_THREADS; i++) { - if (__thread_id_map[i] == tid) + if (__thread_id_map[i] == tid) { spin_unlock(&__thread_id_map_mutex); return i; + } } spin_unlock(&__thread_id_map_mutex); - fprintf(stderr, "smp_thread_id: Rogue thread, id: %d(%#x)\n", - (int)tid, (int)tid); + fprintf(stderr, "smp_thread_id: Rogue thread, id: %lu(%#lx)\n", + (unsigned long) tid, (unsigned long) tid); exit(-1); } @@ -209,8 +207,8 @@ static void *wait_thread(thread_id_t tid) break; } if (i >= NR_THREADS){ - fprintf(stderr, "wait_thread: bad tid = %d(%#x)\n", - (int)tid, (int)tid); + fprintf(stderr, "wait_thread: bad tid = %lu(%#lx)\n", + (unsigned long)tid, (unsigned long)tid); exit(-1); } if (pthread_join(tid, &vp) != 0) { @@ -234,12 +232,6 @@ static void wait_all_threads(void) } } -#ifndef HAVE_CPU_SET_T -typedef unsigned long cpu_set_t; -# define CPU_ZERO(cpuset) do { *(cpuset) = 0; } while(0) -# define CPU_SET(cpu, cpuset) do { *(cpuset) |= (1UL << (cpu)); } while(0) -#endif - static void run_on(int cpu) { #if HAVE_SCHED_SETAFFINITY