summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
e1e98d8)
the _Fork interface is defined for future issue of POSIX as the
outcome of Austin Group issue 62, which drops the AS-safety
requirement for fork, and provides an AS-safe replacement that does
not run the registered atfork handlers.
int pause(void);
pid_t fork(void);
int pause(void);
pid_t fork(void);
int execve(const char *, char *const [], char *const []);
int execv(const char *, char *const []);
int execle(const char *, const char *, ...);
int execve(const char *, char *const [], char *const []);
int execv(const char *, char *const []);
int execle(const char *, const char *, ...);
#include <signal.h>
#include "syscall.h"
#include "libc.h"
#include "lock.h"
#include "pthread_impl.h"
#include <signal.h>
#include "syscall.h"
#include "libc.h"
#include "lock.h"
#include "pthread_impl.h"
-static void dummy(int x)
-{
-}
-
-weak_alias(dummy, __fork_handler);
+static void dummy(int x) { }
weak_alias(dummy, __aio_atfork);
weak_alias(dummy, __aio_atfork);
{
pid_t ret;
sigset_t set;
{
pid_t ret;
sigset_t set;
__block_all_sigs(&set);
__aio_atfork(-1);
LOCK(__abort_lock);
__block_all_sigs(&set);
__aio_atfork(-1);
LOCK(__abort_lock);
UNLOCK(__abort_lock);
__aio_atfork(!ret);
__restore_sigs(&set);
UNLOCK(__abort_lock);
__aio_atfork(!ret);
__restore_sigs(&set);
return __syscall_ret(ret);
}
return __syscall_ret(ret);
}
--- /dev/null
+#include <unistd.h>
+#include "libc.h"
+
+static void dummy(int x) { }
+weak_alias(dummy, __fork_handler);
+
+pid_t fork(void)
+{
+ __fork_handler(-1);
+ pid_t ret = _Fork();
+ __fork_handler(!ret);
+ return ret;
+}