Back to index

glibc  2.9
pthread_atfork.c
Go to the documentation of this file.
00001 /* Copyright (C) 2002 Free Software Foundation, Inc.
00002    This file is part of the GNU C Library.
00003    Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
00004 
00005    The GNU C Library is free software; you can redistribute it and/or
00006    modify it under the terms of the GNU Lesser General Public
00007    License as published by the Free Software Foundation; either
00008    version 2.1 of the License, or (at your option) any later version.
00009 
00010    In addition to the permissions in the GNU Lesser General Public
00011    License, the Free Software Foundation gives you unlimited
00012    permission to link the compiled version of this file with other
00013    programs, and to distribute those programs without any restriction
00014    coming from the use of this file. (The GNU Lesser General Public
00015    License restrictions do apply in other respects; for example, they
00016    cover modification of the file, and distribution when not linked
00017    into another program.)
00018 
00019    Note that people who make modified versions of this file are not
00020    obligated to grant this special exception for their modified
00021    versions; it is their choice whether to do so. The GNU Lesser
00022    General Public License gives permission to release a modified
00023    version without this exception; this exception also makes it
00024    possible to release a modified version which carries forward this
00025    exception.
00026 
00027    The GNU C Library is distributed in the hope that it will be useful,
00028    but WITHOUT ANY WARRANTY; without even the implied warranty of
00029    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00030    Lesser General Public License for more details.
00031 
00032    You should have received a copy of the GNU Lesser General Public
00033    License along with the GNU C Library; if not, write to the Free
00034    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
00035    02111-1307 USA.  */
00036 
00037 #include "internals.h"
00038 #include <fork.h>
00039 
00040 /* This is defined by newer gcc version unique for each module.  */
00041 extern void *__dso_handle __attribute__ ((__weak__));
00042 
00043 
00044 /* Hide the symbol so that no definition but the one locally in the
00045    executable or DSO is used.  */
00046 int
00047 #ifndef __pthread_atfork
00048 /* Don't mark the compatibility function as hidden.  */
00049 attribute_hidden
00050 #endif
00051 __pthread_atfork (prepare, parent, child)
00052      void (*prepare) (void);
00053      void (*parent) (void);
00054      void (*child) (void);
00055 {
00056   return __register_atfork (prepare, parent, child,
00057                          &__dso_handle == NULL ? NULL : __dso_handle);
00058 }
00059 #ifndef __pthread_atfork
00060 extern int pthread_atfork (void (*prepare) (void), void (*parent) (void),
00061                         void (*child) (void)) attribute_hidden;
00062 strong_alias (__pthread_atfork, pthread_atfork)
00063 #endif