Logo
Explore Help
Sign In
fluencelabs/musl
1
0
Fork 0
You've already forked musl
mirror of https://github.com/fluencelabs/musl synced 2025-06-07 12:01:35 +00:00
Code Issues Projects Releases Wiki Activity
musl/src/process/fork.c

13 lines
230 B
C
Raw Normal View History

initial check-in, version 0.5.0
2011-02-12 00:22:29 -05:00
#include <unistd.h>
#include "syscall.h"
add pthread_atfork interface note that this presently does not handle consistency of the libc's own global state during forking. as per POSIX 2008, if the parent process was threaded, the child process may only call async-signal-safe functions until one of the exec-family functions is called, so the current behavior is believed to be conformant even if non-ideal. it may be improved at some later time.
2011-02-18 19:52:42 -05:00
#include "libc.h"
initial check-in, version 0.5.0
2011-02-12 00:22:29 -05:00
pid_t fork(void)
{
add pthread_atfork interface note that this presently does not handle consistency of the libc's own global state during forking. as per POSIX 2008, if the parent process was threaded, the child process may only call async-signal-safe functions until one of the exec-family functions is called, so the current behavior is believed to be conformant even if non-ideal. it may be improved at some later time.
2011-02-18 19:52:42 -05:00
pid_t ret;
if (libc.fork_handler) libc.fork_handler(-1);
ret = syscall0(__NR_fork);
if (libc.fork_handler) libc.fork_handler(!ret);
return ret;
initial check-in, version 0.5.0
2011-02-12 00:22:29 -05:00
}
Reference in New Issue Copy Permalink
Powered by Gitea Version: 1.23.8 Page: 42ms Template: 2ms
English
Bahasa Indonesia Deutsch English Español Français Gaeilge Italiano Latviešu Magyar nyelv Nederlands Polski Português de Portugal Português do Brasil Suomi Svenska Türkçe Čeština Ελληνικά Български Русский Українська فارسی മലയാളം 日本語 简体中文 繁體中文(台灣) 繁體中文(香港) 한국어
Licenses API