1 // SPDX-License-Identifier: LGPL-2.1 1 // SPDX-License-Identifier: LGPL-2.1 2 // Definitions taken from glibc for use with o 2 // Definitions taken from glibc for use with older systems, same licensing. 3 #ifndef _CPU_SET_SCHED_PERF_H 3 #ifndef _CPU_SET_SCHED_PERF_H 4 #define _CPU_SET_SCHED_PERF_H 4 #define _CPU_SET_SCHED_PERF_H 5 5 6 #include <features.h> 6 #include <features.h> 7 #include <sched.h> 7 #include <sched.h> 8 8 9 #ifndef CPU_EQUAL 9 #ifndef CPU_EQUAL 10 #ifndef __CPU_EQUAL_S 10 #ifndef __CPU_EQUAL_S 11 #if __GNUC_PREREQ (2, 91) 11 #if __GNUC_PREREQ (2, 91) 12 # define __CPU_EQUAL_S(setsize, cpusetp1, cpus 12 # define __CPU_EQUAL_S(setsize, cpusetp1, cpusetp2) \ 13 (__builtin_memcmp (cpusetp1, cpusetp2, setsi 13 (__builtin_memcmp (cpusetp1, cpusetp2, setsize) == 0) 14 #else 14 #else 15 # define __CPU_EQUAL_S(setsize, cpusetp1, cpus 15 # define __CPU_EQUAL_S(setsize, cpusetp1, cpusetp2) \ 16 (__extension__ 16 (__extension__ \ 17 ({ const __cpu_mask *__arr1 = (cpusetp1)->_ 17 ({ const __cpu_mask *__arr1 = (cpusetp1)->__bits; \ 18 const __cpu_mask *__arr2 = (cpusetp2)->_ 18 const __cpu_mask *__arr2 = (cpusetp2)->__bits; \ 19 size_t __imax = (setsize) / sizeof (__cp 19 size_t __imax = (setsize) / sizeof (__cpu_mask); \ 20 size_t __i; 20 size_t __i; \ 21 for (__i = 0; __i < __imax; ++__i) 21 for (__i = 0; __i < __imax; ++__i) \ 22 if (__arr1[__i] != __arr2[__i]) 22 if (__arr1[__i] != __arr2[__i]) \ 23 break; 23 break; \ 24 __i == __imax; })) 24 __i == __imax; })) 25 #endif 25 #endif 26 #endif // __CPU_EQUAL_S 26 #endif // __CPU_EQUAL_S 27 27 28 #define CPU_EQUAL(cpusetp1, cpusetp2) \ 28 #define CPU_EQUAL(cpusetp1, cpusetp2) \ 29 __CPU_EQUAL_S (sizeof (cpu_set_t), cpusetp1, 29 __CPU_EQUAL_S (sizeof (cpu_set_t), cpusetp1, cpusetp2) 30 #endif // CPU_EQUAL 30 #endif // CPU_EQUAL 31 31 32 #ifndef CPU_OR 32 #ifndef CPU_OR 33 #ifndef __CPU_OP_S 33 #ifndef __CPU_OP_S 34 #define __CPU_OP_S(setsize, destset, srcset1, 34 #define __CPU_OP_S(setsize, destset, srcset1, srcset2, op) \ 35 (__extension__ 35 (__extension__ \ 36 ({ cpu_set_t *__dest = (destset); 36 ({ cpu_set_t *__dest = (destset); \ 37 const __cpu_mask *__arr1 = (srcset1)->__ 37 const __cpu_mask *__arr1 = (srcset1)->__bits; \ 38 const __cpu_mask *__arr2 = (srcset2)->__ 38 const __cpu_mask *__arr2 = (srcset2)->__bits; \ 39 size_t __imax = (setsize) / sizeof (__cp 39 size_t __imax = (setsize) / sizeof (__cpu_mask); \ 40 size_t __i; 40 size_t __i; \ 41 for (__i = 0; __i < __imax; ++__i) 41 for (__i = 0; __i < __imax; ++__i) \ 42 ((__cpu_mask *) __dest->__bits)[__i] = 42 ((__cpu_mask *) __dest->__bits)[__i] = __arr1[__i] op __arr2[__i]; \ 43 __dest; })) 43 __dest; })) 44 #endif // __CPU_OP_S 44 #endif // __CPU_OP_S 45 45 46 #define CPU_OR(destset, srcset1, srcset2) \ 46 #define CPU_OR(destset, srcset1, srcset2) \ 47 __CPU_OP_S (sizeof (cpu_set_t), destset, src 47 __CPU_OP_S (sizeof (cpu_set_t), destset, srcset1, srcset2, |) 48 #endif // CPU_OR 48 #endif // CPU_OR 49 49 50 #endif // _CPU_SET_SCHED_PERF_H 50 #endif // _CPU_SET_SCHED_PERF_H 51 51
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.