mirror of
https://sourceware.org/git/glibc.git
synced 2024-12-31 23:11:09 +00:00
2b47727c68
Both htl and nptl uses a different data structure to implement atfork
handlers. The nptl one was refactored by 27761a1042
to use a dynarray
which simplifies the code.
This patch moves the nptl one to be the generic implementation and
replace Hurd linked one. Different than previous NPTL, Hurd also uses
a global lock, so performance should be similar.
Checked on x86_64-linux-gnu, i686-linux-gnu, and with a build for
i686-gnu.
43 lines
1.5 KiB
C
43 lines
1.5 KiB
C
/* Register fork handlers. Generic version.
|
|
Copyright (C) 2002-2021 Free Software Foundation, Inc.
|
|
This file is part of the GNU C Library.
|
|
|
|
The GNU C Library is free software; you can redistribute it and/or
|
|
modify it under the terms of the GNU Lesser General Public
|
|
License as published by the Free Software Foundation; either
|
|
version 2.1 of the License, or (at your option) any later version.
|
|
|
|
The GNU C Library is distributed in the hope that it will be useful,
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
Lesser General Public License for more details.
|
|
|
|
You should have received a copy of the GNU Lesser General Public
|
|
License along with the GNU C Library; if not, see
|
|
<https://www.gnu.org/licenses/>. */
|
|
|
|
#include <pthread.h>
|
|
#include <pt-internal.h>
|
|
#include <fork.h>
|
|
#include <dso_handle.h>
|
|
#include <register-atfork.h>
|
|
|
|
/* Hide the symbol so that no definition but the one locally in the
|
|
executable or DSO is used. */
|
|
int
|
|
#ifndef __pthread_atfork
|
|
/* Don't mark the compatibility function as hidden. */
|
|
attribute_hidden
|
|
#endif
|
|
__pthread_atfork (void (*prepare) (void),
|
|
void (*parent) (void),
|
|
void (*child) (void))
|
|
{
|
|
return __register_atfork (prepare, parent, child, __dso_handle);
|
|
}
|
|
#ifndef __pthread_atfork
|
|
extern int pthread_atfork (void (*prepare) (void), void (*parent) (void),
|
|
void (*child) (void)) attribute_hidden;
|
|
weak_alias (__pthread_atfork, pthread_atfork)
|
|
#endif
|