Back to index

glibc  2.9
td_thr_event_enable.c
Go to the documentation of this file.
00001 /* Enable event process-wide.
00002    Copyright (C) 1999, 2001, 2002, 2003, 2007 Free Software Foundation, Inc.
00003    This file is part of the GNU C Library.
00004    Contributed by Ulrich Drepper <drepper@redhat.com>, 1999.
00005 
00006    The GNU C Library is free software; you can redistribute it and/or
00007    modify it under the terms of the GNU Lesser General Public
00008    License as published by the Free Software Foundation; either
00009    version 2.1 of the License, or (at your option) any later version.
00010 
00011    The GNU C Library is distributed in the hope that it will be useful,
00012    but WITHOUT ANY WARRANTY; without even the implied warranty of
00013    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014    Lesser General Public License for more details.
00015 
00016    You should have received a copy of the GNU Lesser General Public
00017    License along with the GNU C Library; if not, write to the Free
00018    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
00019    02111-1307 USA.  */
00020 
00021 #include "thread_dbP.h"
00022 
00023 
00024 td_err_e
00025 td_thr_event_enable (th, onoff)
00026      const td_thrhandle_t *th;
00027      int onoff;
00028 {
00029   LOG ("td_thr_event_enable");
00030 
00031   if (th->th_unique != 0)
00032     {
00033       /* Write the new value into the thread data structure.  */
00034       td_err_e err = DB_PUT_FIELD (th->th_ta_p, th->th_unique, pthread,
00035                                report_events, 0,
00036                                (psaddr_t) 0 + (onoff != 0));
00037       if (err != TD_OK)
00038        return err;
00039 
00040       /* Just in case we are in the window between initializing __stack_user
00041         and copying from __nptl_initial_report_events, we set it too.
00042         It doesn't hurt to do this for non-initial threads, since it
00043         won't be consulted again anyway.  It would take another fetch
00044         to get the tid and determine this isn't the initial thread,
00045         so just do it always.  */
00046     }
00047 
00048   /* We are faking it for the initial thread before its thread
00049      descriptor is set up.  */
00050   return DB_PUT_VALUE (th->th_ta_p, __nptl_initial_report_events, 0,
00051                      (psaddr_t) 0 + (onoff != 0));
00052 }