linux: Make fdopendir fail with O_PATH (BZ 30373)
[glibc.git] / sysdeps / nptl / timer_routines.h
blob47b0c17d854c568f8759b848baa6fc46b906e73a
1 /* Helper code for POSIX timer implementation on NPTL.
2 Copyright (C) 2000-2023 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
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.
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.
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/>. */
19 #ifndef _TIMER_ROUTINES_H
20 #define _TIMER_ROUTINES_H 1
22 #include <internaltypes.h>
23 #include <string.h>
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
31 thread_attr_compare (const pthread_attr_t *left, const pthread_attr_t *right)
33 struct pthread_attr *ileft = (struct pthread_attr *) left;
34 struct pthread_attr *iright = (struct pthread_attr *) right;
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)));
50 #endif /* timer_routines.h */