Blame sysdeps/nptl/fork.h

Packit Service 82fcde
/* Copyright (C) 2002-2018 Free Software Foundation, Inc.
Packit Service 82fcde
   This file is part of the GNU C Library.
Packit Service 82fcde
   Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
Packit Service 82fcde
Packit Service 82fcde
   The GNU C Library is free software; you can redistribute it and/or
Packit Service 82fcde
   modify it under the terms of the GNU Lesser General Public
Packit Service 82fcde
   License as published by the Free Software Foundation; either
Packit Service 82fcde
   version 2.1 of the License, or (at your option) any later version.
Packit Service 82fcde
Packit Service 82fcde
   The GNU C Library is distributed in the hope that it will be useful,
Packit Service 82fcde
   but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit Service 82fcde
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Packit Service 82fcde
   Lesser General Public License for more details.
Packit Service 82fcde
Packit Service 82fcde
   You should have received a copy of the GNU Lesser General Public
Packit Service 82fcde
   License along with the GNU C Library; if not, see
Packit Service 82fcde
   <http://www.gnu.org/licenses/>.  */
Packit Service 82fcde
Packit Service 82fcde
#include <lowlevellock.h>
Packit Service 82fcde
Packit Service 82fcde
/* The fork generation counter, defined in libpthread.  */
Packit Service 82fcde
extern unsigned long int __fork_generation attribute_hidden;
Packit Service 82fcde
Packit Service 82fcde
/* Pointer to the fork generation counter in the thread library.  */
Packit Service 82fcde
extern unsigned long int *__fork_generation_pointer attribute_hidden;
Packit Service 82fcde
Packit Service 82fcde
/* Elements of the fork handler lists.  */
Packit Service 82fcde
struct fork_handler
Packit Service 82fcde
{
Packit Service 82fcde
  void (*prepare_handler) (void);
Packit Service 82fcde
  void (*parent_handler) (void);
Packit Service 82fcde
  void (*child_handler) (void);
Packit Service 82fcde
  void *dso_handle;
Packit Service 82fcde
};
Packit Service 82fcde
Packit Service 82fcde
/* Function to call to unregister fork handlers.  */
Packit Service 82fcde
extern void __unregister_atfork (void *dso_handle) attribute_hidden;
Packit Service 82fcde
#define UNREGISTER_ATFORK(dso_handle) __unregister_atfork (dso_handle)
Packit Service 82fcde
Packit Service 82fcde
enum __run_fork_handler_type
Packit Service 82fcde
{
Packit Service 82fcde
  atfork_run_prepare,
Packit Service 82fcde
  atfork_run_child,
Packit Service 82fcde
  atfork_run_parent
Packit Service 82fcde
};
Packit Service 82fcde
Packit Service 82fcde
/* Run the atfork handlers and lock/unlock the internal lock depending
Packit Service 82fcde
   of the WHO argument:
Packit Service 82fcde
Packit Service 82fcde
   - atfork_run_prepare: run all the PREPARE_HANDLER in reverse order of
Packit Service 82fcde
			 insertion and locks the internal lock.
Packit Service 82fcde
   - atfork_run_child: run all the CHILD_HANDLER and unlocks the internal
Packit Service 82fcde
		       lock.
Packit Service 82fcde
   - atfork_run_parent: run all the PARENT_HANDLER and unlocks the internal
Packit Service 1c5418
			lock.  */
Packit Service 1c5418
extern void __run_fork_handlers (enum __run_fork_handler_type who)
Packit Service 1c5418
  attribute_hidden;
Packit Service 82fcde
Packit Service 82fcde
/* C library side function to register new fork handlers.  */
Packit Service 82fcde
extern int __register_atfork (void (*__prepare) (void),
Packit Service 82fcde
			      void (*__parent) (void),
Packit Service 82fcde
			      void (*__child) (void),
Packit Service 82fcde
			      void *dso_handle);
Packit Service 82fcde
libc_hidden_proto (__register_atfork)