| 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 | #if defined(HAVE_SCHED_SETAFFINITY) || defined(HAVE_CPU_SET_T) \ |
| 27 | || defined(HAVE_CPU_ZERO) || defined(HAVE_CPU_SET) |
| 28 | # include <sched.h> |
| 29 | #endif |
| 30 | |
| 31 | #ifndef HAVE_CPU_SET_T |
| 32 | typedef unsigned long cpu_set_t; |
| 33 | #endif |
| 34 | |
| 35 | #ifndef HAVE_CPU_ZERO |
| 36 | # define CPU_ZERO(cpuset) do { *(cpuset) = 0; } while(0) |
| 37 | #endif |
| 38 | |
| 39 | #ifndef HAVE_CPU_SET |
| 40 | # define CPU_SET(cpu, cpuset) do { *(cpuset) |= (1UL << (cpu)); } while(0) |
| 41 | #endif |
| 42 | |
| 43 | #endif /* _URCU_TESTS_CPUSET_H */ |