]> rtime.felk.cvut.cz Git - l4.git/blob - l4/pkg/uclibc/lib/contrib/uclibc/libpthread/linuxthreads_db/td_thr_event_enable.c
update
[l4.git] / l4 / pkg / uclibc / lib / contrib / uclibc / libpthread / linuxthreads_db / td_thr_event_enable.c
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.
5
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.
10
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.
15
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/>.  */
19
20 #include <stddef.h>
21
22 #include "thread_dbP.h"
23
24
25 td_err_e
26 td_thr_event_enable(const td_thrhandle_t *th, int onoff)
27 {
28   LOG ("td_thr_event_enable");
29
30   /* Write the new value into the thread data structure.  */
31   if (th->th_unique == NULL)
32     {
33       psaddr_t addr;
34
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;
39
40       if (ps_pdwrite (th->th_ta_p->ph, addr, &onoff, sizeof (int)) != PS_OK)
41         return TD_ERR;
42
43       return TD_OK;
44     }
45
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?  */
52
53   return TD_OK;
54 }