projects
/
musl
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
report that posix_spawn is supported in unistd.h and sysconf
[musl]
/
src
/
process
/
fork.c
diff --git
a/src/process/fork.c
b/src/process/fork.c
index
012b7ca
..
fb8a430
100644
(file)
--- a/
src/process/fork.c
+++ b/
src/process/fork.c
@@
-1,19
+1,27
@@
#include <unistd.h>
#include <unistd.h>
+#include <string.h>
#include "syscall.h"
#include "libc.h"
#include "pthread_impl.h"
#include "syscall.h"
#include "libc.h"
#include "pthread_impl.h"
+static void dummy(int x)
+{
+}
+
+weak_alias(dummy, __fork_handler);
+
pid_t fork(void)
{
pid_t ret;
pid_t fork(void)
{
pid_t ret;
-
if (libc.fork_handler) libc.
fork_handler(-1);
+
__
fork_handler(-1);
ret = syscall(SYS_fork);
ret = syscall(SYS_fork);
- if (libc.
lock
&& !ret) {
+ if (libc.
main_thread
&& !ret) {
pthread_t self = __pthread_self();
pthread_t self = __pthread_self();
- self->pid = syscall(SYS_getpid);
-
self->tid = syscall(SYS_gettid
);
+ self->
tid = self->
pid = syscall(SYS_getpid);
+
memset(&self->robust_list, 0, sizeof self->robust_list
);
libc.threads_minus_1 = 0;
libc.threads_minus_1 = 0;
+ libc.main_thread = self;
}
}
-
if (libc.fork_handler) libc.
fork_handler(!ret);
+
__
fork_handler(!ret);
return ret;
}
return ret;
}