]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
fork.h: replace with register-atfork.h
authorSamuel Thibault <samuel.thibault@ens-lyon.org>
Wed, 24 Mar 2021 20:27:34 +0000 (21:27 +0100)
committerSamuel Thibault <samuel.thibault@ens-lyon.org>
Mon, 29 Mar 2021 19:41:09 +0000 (21:41 +0200)
UNREGISTER_ATFORK is now defined for all ports in register-atfork.h, so most
previous includes of fork.h actually only need register-atfork.h now, and
cxa_finalize.c does not need an ifdef UNREGISTER_ATFORK any more.

The nptl-specific fork generation counters can then go to pthreadP.h, and
fork.h be removed.

Checked on x86_64-linux-gnu and i686-gnu.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
12 files changed:
htl/forward.c
nptl/libc_pthread_init.c
nptl/nptl-init.c
nptl/pthreadP.h
nptl/pthread_atfork.c
stdlib/cxa_finalize.c
sysdeps/generic/fork.h [deleted file]
sysdeps/htl/fork.h [deleted file]
sysdeps/htl/pt-atfork.c
sysdeps/nptl/fork.c
sysdeps/nptl/fork.h [deleted file]
sysdeps/nptl/libc-lockP.h

index 340404634987a75cd9474fc8aabc69d2889ec5d0..4e4133ac1f789022c4c09a21f4024226daf69e2f 100644 (file)
@@ -22,7 +22,6 @@
 #include <shlib-compat.h>
 #include <pthread-functions.h>
 #include <libc-lock.h>
-#include <fork.h>
 #include <pt-internal.h>
 
 /* Pointers to the libc functions.  */
index 0757f92cd2373b53261e9cddbf5e63293dd29db9..4de182b4e40fdbc24ba0a36959410cccc6509a44 100644 (file)
@@ -18,7 +18,7 @@
 
 #include <unistd.h>
 #include <list.h>
-#include <fork.h>
+#include <register-atfork.h>
 #include <dl-sysdep.h>
 #include <tls.h>
 #include <string.h>
index 865ee8db293cf36b61eea5b83bbf166188391bbb..2c7e2222d491377e0b8716916d5734ba3ba33075 100644 (file)
@@ -29,7 +29,6 @@
 #include <ldsodefs.h>
 #include <tls.h>
 #include <list.h>
-#include <fork.h>
 #include <version.h>
 #include <shlib-compat.h>
 #include <lowlevellock.h>
index c8538de44fb0a9286cd82bb0d64b9637d3541561..2653e0f1b3444d9156039d0aba2c82ae524e24a8 100644 (file)
@@ -355,6 +355,12 @@ extern void __nptl_death_event (void);
 hidden_proto (__nptl_create_event)
 hidden_proto (__nptl_death_event)
 
+/* The fork generation counter, defined in libpthread.  */
+extern unsigned long int __fork_generation attribute_hidden;
+
+/* Pointer to the fork generation counter in the thread library.  */
+extern unsigned long int *__fork_generation_pointer attribute_hidden;
+
 /* Register the generation counter in the libpthread with the libc.  */
 #ifdef TLS_MULTIPLE_THREADS_IN_TCB
 extern void __libc_pthread_init (unsigned long int *ptr,
index 097a86d059ad53e257200687a338cfa9a82e9ec8..6398688dab1156f508468522939250c1f97e0321 100644 (file)
@@ -34,7 +34,7 @@
    <https://www.gnu.org/licenses/>.  */
 
 #include "pthreadP.h"
-#include <fork.h>
+#include <register-atfork.h>
 #include <dso_handle.h>
 
 
index 7d7b09b3cc7d2b08625b94352e21aca6daad0574..75ea4022fbc6ef87e0fb14757ee5541815b812a7 100644 (file)
@@ -18,7 +18,7 @@
 #include <assert.h>
 #include <stdlib.h>
 #include "exit.h"
-#include <fork.h>
+#include <register-atfork.h>
 #include <sysdep.h>
 #include <stdint.h>
 
@@ -102,9 +102,7 @@ __cxa_finalize (void *d)
 
   /* Remove the registered fork handlers.  We do not have to
      unregister anything if the program is going to terminate anyway.  */
-#ifdef UNREGISTER_ATFORK
   if (d != NULL)
     UNREGISTER_ATFORK (d);
-#endif
   __libc_lock_unlock (__exit_funcs_lock);
 }
diff --git a/sysdeps/generic/fork.h b/sysdeps/generic/fork.h
deleted file mode 100644 (file)
index 6cc842a..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-/* Stub version of header for fork handling.  Mainly to handle pthread_atfork
-   and friends.  Outside dependencies:
-
-   UNREGISTER_ATFORK
-     If defined it must expand to a function call which takes one void*
-     parameter which is the DSO handle for the DSO which gets unloaded.
-     The function so called has to remove the atfork handlers registered
-     by this module.  */
-
-
-/* System specific fork definition.  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/>.  */
diff --git a/sysdeps/htl/fork.h b/sysdeps/htl/fork.h
deleted file mode 100644 (file)
index 9d0d1d2..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-/* Copyright (C) 2002-2021 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
-
-   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 <lowlevellock.h>
-#include <register-atfork.h>
index dbb3b8f0cc14c7d91870c24baf6c9fdfbfeda1f6..3902f40835e311219b4792094a52fce3558618e5 100644 (file)
@@ -18,7 +18,6 @@
 
 #include <pthread.h>
 #include <pt-internal.h>
-#include <fork.h>
 #include <dso_handle.h>
 #include <register-atfork.h>
 
index f78267b68c56d33ded6f62c5d4e6aa1283688b56..9737127cd686b6613c402bf850ccaacd16fdb4c4 100644 (file)
@@ -28,7 +28,7 @@
 #include <stdio-lock.h>
 #include <atomic.h>
 #include <nptl/pthreadP.h>
-#include <fork.h>
+#include <register-atfork.h>
 #include <arch-fork.h>
 #include <futex-internal.h>
 #include <malloc/malloc-internal.h>
diff --git a/sysdeps/nptl/fork.h b/sysdeps/nptl/fork.h
deleted file mode 100644 (file)
index 5246754..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-/* Copyright (C) 2002-2021 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
-
-   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 <lowlevellock.h>
-#include <register-atfork.h>
-
-/* The fork generation counter, defined in libpthread.  */
-extern unsigned long int __fork_generation attribute_hidden;
-
-/* Pointer to the fork generation counter in the thread library.  */
-extern unsigned long int *__fork_generation_pointer attribute_hidden;
index 4a0b96e6d9cd3cc6ab24e1c69ef43d063388e610..63b605dee2f3365f952d65f7d6632437e29b817e 100644 (file)
@@ -308,14 +308,6 @@ __libc_cleanup_routine (struct __pthread_cleanup_frame *f)
   __libc_ptf_call (__pthread_setspecific, (KEY, VALUE), 0)
 
 
-/* Register handlers to execute before and after `fork'.  Note that the
-   last parameter is NULL.  The handlers registered by the libc are
-   never removed so this is OK.  */
-extern int __register_atfork (void (*__prepare) (void),
-                             void (*__parent) (void),
-                             void (*__child) (void),
-                             void *__dso_handle);
-
 /* Functions that are used by this file and are internal to the GNU C
    library.  */