source: asp3_tinet_ecnl_rx/trunk/musl-1.1.18/src/process/fork.c@ 337

Last change on this file since 337 was 337, checked in by coas-nagasima, 6 years ago

ASP3版ECNLを追加

  • Property svn:eol-style set to native
  • Property svn:mime-type set to text/x-csrc;charset=UTF-8
File size: 682 bytes
Line 
1#include <unistd.h>
2#include <string.h>
3#include <signal.h>
4#include "syscall.h"
5#include "libc.h"
6#include "pthread_impl.h"
7
8#ifndef __c2__
9static void dummy(int x)
10{
11}
12
13weak_alias(dummy, __fork_handler);
14#else
15extern void __fork_handler(int x);
16#endif
17
18pid_t fork(void)
19{
20 pid_t ret;
21 sigset_t set;
22 __fork_handler(-1);
23 __block_all_sigs(&set);
24#ifdef SYS_fork
25 ret = syscall(SYS_fork);
26#else
27 ret = syscall(SYS_clone, SIGCHLD, 0);
28#endif
29 if (!ret) {
30 pthread_t self = __pthread_self();
31 self->tid = __syscall(SYS_gettid);
32 self->robust_list.off = 0;
33 self->robust_list.pending = 0;
34 libc.threads_minus_1 = 0;
35 }
36 __restore_sigs(&set);
37 __fork_handler(!ret);
38 return ret;
39}
Note: See TracBrowser for help on using the repository browser.