]> git.ipfire.org Git - thirdparty/glibc.git/blame - nptl_db/td_thr_event_enable.c
test-container: Fix "unused code" warnings on HURD
[thirdparty/glibc.git] / nptl_db / td_thr_event_enable.c
CommitLineData
76a50749 1/* Enable event process-wide.
581c785b 2 Copyright (C) 1999-2022 Free Software Foundation, Inc.
76a50749 3 This file is part of the GNU C Library.
76a50749
UD
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
7 License as published by the Free Software Foundation; either
8 version 2.1 of the 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
59ba27a6 16 License along with the GNU C Library; if not, see
5a82c748 17 <https://www.gnu.org/licenses/>. */
76a50749 18
76a50749
UD
19#include "thread_dbP.h"
20
21
22td_err_e
9dd346ff 23td_thr_event_enable (const td_thrhandle_t *th, int onoff)
76a50749
UD
24{
25 LOG ("td_thr_event_enable");
26
7d9d8bd1
RM
27 if (th->th_unique != 0)
28 {
29 /* Write the new value into the thread data structure. */
30 td_err_e err = DB_PUT_FIELD (th->th_ta_p, th->th_unique, pthread,
31 report_events, 0,
32 (psaddr_t) 0 + (onoff != 0));
33 if (err != TD_OK)
34 return err;
35
36 /* Just in case we are in the window between initializing __stack_user
37 and copying from __nptl_initial_report_events, we set it too.
38 It doesn't hurt to do this for non-initial threads, since it
39 won't be consulted again anyway. It would take another fetch
40 to get the tid and determine this isn't the initial thread,
41 so just do it always. */
42 }
43
44 /* We are faking it for the initial thread before its thread
45 descriptor is set up. */
46 return DB_PUT_VALUE (th->th_ta_p, __nptl_initial_report_events, 0,
7f08f55a 47 (psaddr_t) 0 + (onoff != 0));
76a50749 48}