| 1 | #ifndef _URCU_TESTS_CPUSET_H |
| 2 | #define _URCU_TESTS_CPUSET_H |
| 3 | |
| 4 | /* |
| 5 | * cpuset.h |
| 6 | * |
| 7 | * Userspace RCU library - test cpuset header |
| 8 | * |
| 9 | * Copyright 2009-2013 - Mathieu Desnoyers <mathieu.desnoyers@efficios.com> |
| 10 | * |
| 11 | * This program is free software; you can redistribute it and/or modify |
| 12 | * it under the terms of the GNU General Public License as published by |
| 13 | * the Free Software Foundation; either version 2 of the License, or |
| 14 | * (at your option) any later version. |
| 15 | * |
| 16 | * This program is distributed in the hope that it will be useful, |
| 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 19 | * GNU General Public License for more details. |
| 20 | * |
| 21 | * You should have received a copy of the GNU General Public License along |
| 22 | * with this program; if not, write to the Free Software Foundation, Inc., |
| 23 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
| 24 | */ |
| 25 | |
| 26 | #include "config.h" |
| 27 | |
| 28 | #if defined(HAVE_SCHED_SETAFFINITY) || defined(HAVE_CPU_SET_T) \ |
| 29 | || defined(HAVE_CPU_ZERO) || defined(HAVE_CPU_SET) |
| 30 | # include <sched.h> |
| 31 | #endif |
| 32 | |
| 33 | #ifndef HAVE_CPU_SET_T |
| 34 | typedef unsigned long cpu_set_t; |
| 35 | #endif |
| 36 | |
| 37 | #ifndef HAVE_CPU_ZERO |
| 38 | # define CPU_ZERO(cpuset) do { *(cpuset) = 0; } while(0) |
| 39 | #endif |
| 40 | |
| 41 | #ifndef HAVE_CPU_SET |
| 42 | # define CPU_SET(cpu, cpuset) do { *(cpuset) |= (1UL << (cpu)); } while(0) |
| 43 | #endif |
| 44 | |
| 45 | #endif /* _URCU_TESTS_CPUSET_H */ |