]>
Commit | Line | Data |
---|---|---|
95e114a0 | 1 | /* Restartable Sequences internal API. Linux implementation. |
dff8da6b | 2 | Copyright (C) 2021-2024 Free Software Foundation, Inc. |
95e114a0 FW |
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 | |
16 | <https://www.gnu.org/licenses/>. */ | |
17 | ||
18 | #ifndef RSEQ_INTERNAL_H | |
19 | #define RSEQ_INTERNAL_H | |
20 | ||
21 | #include <sysdep.h> | |
22 | #include <errno.h> | |
23 | #include <kernel-features.h> | |
e3e58982 | 24 | #include <stdbool.h> |
95e114a0 FW |
25 | #include <stdio.h> |
26 | #include <sys/rseq.h> | |
27 | ||
28 | #ifdef RSEQ_SIG | |
c901c3e7 | 29 | static inline bool |
e3e58982 | 30 | rseq_register_current_thread (struct pthread *self, bool do_rseq) |
95e114a0 | 31 | { |
e3e58982 FW |
32 | if (do_rseq) |
33 | { | |
34 | int ret = INTERNAL_SYSCALL_CALL (rseq, &self->rseq_area, | |
35 | sizeof (self->rseq_area), | |
36 | 0, RSEQ_SIG); | |
37 | if (!INTERNAL_SYSCALL_ERROR_P (ret)) | |
c901c3e7 | 38 | return true; |
e3e58982 FW |
39 | } |
40 | THREAD_SETMEM (self, rseq_area.cpu_id, RSEQ_CPU_ID_REGISTRATION_FAILED); | |
c901c3e7 | 41 | return false; |
95e114a0 FW |
42 | } |
43 | #else /* RSEQ_SIG */ | |
c901c3e7 | 44 | static inline bool |
e3e58982 | 45 | rseq_register_current_thread (struct pthread *self, bool do_rseq) |
95e114a0 FW |
46 | { |
47 | THREAD_SETMEM (self, rseq_area.cpu_id, RSEQ_CPU_ID_REGISTRATION_FAILED); | |
c901c3e7 | 48 | return false; |
95e114a0 FW |
49 | } |
50 | #endif /* RSEQ_SIG */ | |
51 | ||
52 | #endif /* rseq-internal.h */ |