]>
Commit | Line | Data |
---|---|---|
dff8da6b | 1 | /* Copyright (C) 2003-2024 Free Software Foundation, Inc. |
c76d1ff5 RM |
2 | This file is part of the GNU C Library. |
3 | ||
4 | The GNU C Library is free software; you can redistribute it and/or | |
5 | modify it under the terms of the GNU Lesser General Public | |
6 | License as published by the Free Software Foundation; either | |
7 | version 2.1 of the License, or (at your option) any later version. | |
8 | ||
9 | The GNU C Library is distributed in the hope that it will be useful, | |
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
12 | Lesser General Public License for more details. | |
13 | ||
14 | You should have received a copy of the GNU Lesser General Public | |
15 | License along with the GNU C Library; if not, see | |
5a82c748 | 16 | <https://www.gnu.org/licenses/>. */ |
c76d1ff5 | 17 | |
714da1d4 | 18 | #include <errno.h> |
c76d1ff5 | 19 | #include <pthreadP.h> |
714da1d4 FW |
20 | #include <sysdep.h> |
21 | #include <sys/types.h> | |
22 | #include <shlib-compat.h> | |
23 | ||
c76d1ff5 RM |
24 | |
25 | int | |
714da1d4 FW |
26 | __pthread_setaffinity_new (pthread_t th, size_t cpusetsize, |
27 | const cpu_set_t *cpuset) | |
c76d1ff5 RM |
28 | { |
29 | const struct pthread *pd = (const struct pthread *) th; | |
714da1d4 FW |
30 | int res; |
31 | ||
32 | res = INTERNAL_SYSCALL_CALL (sched_setaffinity, pd->tid, cpusetsize, | |
33 | cpuset); | |
34 | ||
35 | return (INTERNAL_SYSCALL_ERROR_P (res) | |
36 | ? INTERNAL_SYSCALL_ERRNO (res) | |
37 | : 0); | |
38 | } | |
7b300ec7 FW |
39 | versioned_symbol (libc, __pthread_setaffinity_new, |
40 | pthread_setaffinity_np, GLIBC_2_34); | |
c76d1ff5 | 41 | |
7b300ec7 FW |
42 | #if OTHER_SHLIB_COMPAT (libpthread, GLIBC_2_3_4, GLIBC_2_34) |
43 | compat_symbol (libpthread, __pthread_setaffinity_new, | |
44 | pthread_setaffinity_np, GLIBC_2_3_4); | |
45 | #endif | |
c76d1ff5 | 46 | |
7b300ec7 | 47 | #if OTHER_SHLIB_COMPAT (libpthread, GLIBC_2_3_3, GLIBC_2_3_4) |
714da1d4 FW |
48 | int |
49 | __pthread_setaffinity_old (pthread_t th, cpu_set_t *cpuset) | |
50 | { | |
51 | /* The old interface by default assumed a 1024 processor bitmap. */ | |
52 | return __pthread_setaffinity_new (th, 128, cpuset); | |
c76d1ff5 | 53 | } |
714da1d4 FW |
54 | compat_symbol (libpthread, __pthread_setaffinity_old, pthread_setaffinity_np, |
55 | GLIBC_2_3_3); | |
56 | #endif |