chiark / gitweb /
eglibc (2.11.3-4+deb6u3) squeeze-lts; urgency=medium
[eglibc.git] / linuxthreads / sysdeps / unix / sysv / linux / fork.h
1 /* Copyright (C) 2002 Free Software Foundation, Inc.
2    This file is part of the GNU C Library.
3    Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
4
5    The GNU C Library is free software; you can redistribute it and/or
6    modify it under the terms of the GNU Lesser General Public
7    License as published by the Free Software Foundation; either
8    version 2.1 of the License, or (at your option) any later version.
9
10    The GNU C Library is distributed in the hope that it will be useful,
11    but WITHOUT ANY WARRANTY; without even the implied warranty of
12    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13    Lesser General Public License for more details.
14
15    You should have received a copy of the GNU Lesser General Public
16    License along with the GNU C Library; if not, write to the Free
17    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
18    02111-1307 USA.  */
19
20 #include <list.h>
21 #include <bits/libc-lock.h>
22 #include <sysdep.h>
23
24 struct fork_block
25 {
26   /* Lock to protect handling of fork handlers.  */
27   __libc_lock_define (, lock);
28
29   /* Lists of registered fork handlers.  */
30   list_t prepare_list;
31   list_t parent_list;
32   list_t child_list;
33 };
34
35 extern struct fork_block __fork_block attribute_hidden;
36
37 /* Elements of the fork handler lists.  */
38 struct fork_handler
39 {
40   list_t list;
41   void (*handler) (void);
42   void *dso_handle;
43 };
44
45
46 /* Function to call to unregister fork handlers.  */
47 extern void __unregister_atfork (void *dso_handle) attribute_hidden;
48 #define UNREGISTER_ATFORK(dso_handle) __unregister_atfork (dso_handle)
49
50
51 /* C library side function to register new fork handlers.  */
52 extern int __register_atfork (void (*__prepare) (void),
53                               void (*__parent) (void),
54                               void (*__child) (void),
55                               void *dso_handle);
56 libc_hidden_proto (__register_atfork)
57
58 #ifndef ARCH_FORK
59 # define ARCH_FORK() INLINE_SYSCALL (fork, 0)
60 #endif