1 /* Helper code for POSIX timer implementation on NPTL. 2 Copyright (C) 2000-2022 Free Software Foundation, Inc. 3 This file is part of the GNU C Library. 4 5 The GNU C Library is free software; you can redistribute it and/or 6 modify it under the terms of the GNU Lesser General Public License as 7 published by the Free Software Foundation; either version 2.1 of the 8 License, or (at your option) any later version. 9 10 The GNU C Library is distributed in the hope that it will be useful, 11 but WITHOUT ANY WARRANTY; without even the implied warranty of 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 Lesser General Public License for more details. 14 15 You should have received a copy of the GNU Lesser General Public 16 License along with the GNU C Library; see the file COPYING.LIB. If 17 not, see <https://www.gnu.org/licenses/>. */ 18 19 #ifndef _TIMER_ROUTINES_H 20 #define _TIMER_ROUTINES_H 1 21 22 #include <internaltypes.h> 23 #include <string.h> 24 25 /* Compare two pthread_attr_t thread attributes for exact equality. 26 Returns 1 if they are equal, otherwise zero if they are not equal 27 or contain illegal values. This version is NPTL-specific for 28 performance reason. One could use the access functions to get the 29 values of all the fields of the attribute structure. */ 30 static inline int thread_attr_compare(const pthread_attr_t * left,const pthread_attr_t * right)31thread_attr_compare (const pthread_attr_t *left, const pthread_attr_t *right) 32 { 33 struct pthread_attr *ileft = (struct pthread_attr *) left; 34 struct pthread_attr *iright = (struct pthread_attr *) right; 35 36 return (ileft->flags == iright->flags 37 && ileft->schedpolicy == iright->schedpolicy 38 && (ileft->schedparam.sched_priority 39 == iright->schedparam.sched_priority) 40 && ileft->guardsize == iright->guardsize 41 && ileft->stackaddr == iright->stackaddr 42 && ileft->stacksize == iright->stacksize 43 && ((ileft->cpuset == NULL && iright->cpuset == NULL) 44 || (ileft->cpuset != NULL && iright->cpuset != NULL 45 && ileft->cpusetsize == iright->cpusetsize 46 && memcmp (ileft->cpuset, iright->cpuset, 47 ileft->cpusetsize) == 0))); 48 } 49 50 #endif /* timer_routines.h */ 51