sparc64: Remove unwind information from signal return stubs [BZ#31244]
[glibc.git] / sysdeps / unix / sysv / linux / rseq-internal.h
blob48eebc1e168fad1efd9879d7fead40d512ee4554
1 /* Restartable Sequences internal API. Linux implementation.
2 Copyright (C) 2021-2024 Free Software Foundation, Inc.
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.
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.
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/>. */
18 #ifndef RSEQ_INTERNAL_H
19 #define RSEQ_INTERNAL_H
21 #include <sysdep.h>
22 #include <errno.h>
23 #include <kernel-features.h>
24 #include <stdbool.h>
25 #include <stdio.h>
26 #include <sys/rseq.h>
28 #ifdef RSEQ_SIG
29 static inline bool
30 rseq_register_current_thread (struct pthread *self, bool do_rseq)
32 if (do_rseq)
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))
38 return true;
40 THREAD_SETMEM (self, rseq_area.cpu_id, RSEQ_CPU_ID_REGISTRATION_FAILED);
41 return false;
43 #else /* RSEQ_SIG */
44 static inline bool
45 rseq_register_current_thread (struct pthread *self, bool do_rseq)
47 THREAD_SETMEM (self, rseq_area.cpu_id, RSEQ_CPU_ID_REGISTRATION_FAILED);
48 return false;
50 #endif /* RSEQ_SIG */
52 #endif /* rseq-internal.h */