include/elf.h: sync with GNU C library
[uclibc-ng.git] / libpthread / linuxthreads_db / td_thr_event_enable.c
blobd55a2ce7508cc74c2529cf2aefe288ca903b4e25
1 /* Enable event process-wide.
2 Copyright (C) 1999, 2001, 2002 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
4 Contributed by Ulrich Drepper <drepper@cygnus.com>, 1999.
6 The GNU C Library is free software; you can redistribute it and/or
7 modify it under the terms of the GNU Lesser General Public
8 License as published by the Free Software Foundation; either
9 version 2.1 of the License, or (at your option) any later version.
11 The GNU C Library is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 Lesser General Public License for more details.
16 You should have received a copy of the GNU Lesser General Public
17 License along with the GNU C Library; if not, see
18 <http://www.gnu.org/licenses/>. */
20 #include <stddef.h>
22 #include "thread_dbP.h"
25 td_err_e
26 td_thr_event_enable(const td_thrhandle_t *th, int onoff)
28 LOG ("td_thr_event_enable");
30 /* Write the new value into the thread data structure. */
31 if (th->th_unique == NULL)
33 psaddr_t addr;
35 if (td_lookup (th->th_ta_p->ph, LINUXTHREADS_INITIAL_REPORT_EVENTS,
36 &addr) != PS_OK)
37 /* Cannot read the symbol. This should not happen. */
38 return TD_ERR;
40 if (ps_pdwrite (th->th_ta_p->ph, addr, &onoff, sizeof (int)) != PS_OK)
41 return TD_ERR;
43 return TD_OK;
46 if (ps_pdwrite (th->th_ta_p->ph,
47 ((char *) th->th_unique
48 + offsetof (struct _pthread_descr_struct,
49 p_report_events)),
50 &onoff, sizeof (int)) != PS_OK)
51 return TD_ERR; /* XXX Other error value? */
53 return TD_OK;