File init.c changed (mode: 100644) (index e37d414..8651c40) |
... |
... |
static i sysstart_clone(void) |
35 |
35 |
l r; |
l r; |
36 |
36 |
ul mask; |
ul mask; |
37 |
37 |
|
|
38 |
|
OUT(PRE "clone and execve /sbin/sysstart...\n"); |
|
|
38 |
|
OUT(PRE "clone and execve /bin/sysstart...\n"); |
39 |
39 |
r=clone(SIGCHLD); |
r=clone(SIGCHLD); |
40 |
40 |
if(ISERR(r)){ |
if(ISERR(r)){ |
41 |
|
OUT("ERROR(%ld):unable to clone sysinit for /sbin/sysstart\n",r); |
|
|
41 |
|
OUT("ERROR(%ld):unable to clone sysinit for /bin/sysstart\n",r); |
42 |
42 |
exit_group(-1); |
exit_group(-1); |
43 |
43 |
} |
} |
44 |
44 |
|
|
|
... |
... |
static i sysstart_clone(void) |
47 |
47 |
mask=(~0); |
mask=(~0); |
48 |
48 |
r=rt_sigprocmask(SIG_UNBLOCK,&mask,sizeof(mask)); |
r=rt_sigprocmask(SIG_UNBLOCK,&mask,sizeof(mask)); |
49 |
49 |
if(ISERR(r)){ |
if(ISERR(r)){ |
50 |
|
OUT("ERROR(%ld):unable to unblock all signals for /sbin/sysstart\n",r); |
|
|
50 |
|
OUT("ERROR(%ld):unable to unblock all signals for /bin/sysstart\n",r); |
51 |
51 |
exit_group(-1); |
exit_group(-1); |
52 |
52 |
} |
} |
53 |
53 |
|
|
54 |
|
r=execve("/sbin/sysstart",0); |
|
55 |
|
if(ISERR(r)) {OUT("ERROR(%ld):unable to execve /sbin/sysstart\n",r);} |
|
|
54 |
|
r=execve("/bin/sysstart",0); |
|
55 |
|
if(ISERR(r)) {OUT("ERROR(%ld):unable to execve /bin/sysstart\n",r);} |
56 |
56 |
exit_group(-1); |
exit_group(-1); |
57 |
57 |
#ifdef __GNUC__ |
#ifdef __GNUC__ |
58 |
58 |
return 0;/*unreachable not detected at the end of function*/ |
return 0;/*unreachable not detected at the end of function*/ |
|
... |
... |
static i getty_spawn(void *tty) |
64 |
64 |
{ |
{ |
65 |
65 |
l r; |
l r; |
66 |
66 |
ul mask; |
ul mask; |
67 |
|
void *argv[]={"/sbin/agetty",tty,0};/*0 for envp is not "portable"*/ |
|
|
67 |
|
void *argv[]={"/bin/agetty",tty,0};/*0 for envp is not "portable"*/ |
68 |
68 |
|
|
69 |
69 |
OUT(PRE "getty %s...\n",tty); |
OUT(PRE "getty %s...\n",tty); |
70 |
70 |
|
|
|
... |
... |
static i getty_spawn(void *tty) |
89 |
89 |
exit_group(-1); |
exit_group(-1); |
90 |
90 |
} |
} |
91 |
91 |
|
|
92 |
|
r=execve("/sbin/agetty",argv); |
|
93 |
|
if(ISERR(r)) {OUT("ERROR(%ld):unable to run /sbin/agetty(%s)\n",r,tty);} |
|
|
92 |
|
r=execve("/bin/agetty",argv); |
|
93 |
|
if(ISERR(r)) {OUT("ERROR(%ld):unable to run /bin/agetty(%s)\n",r,tty);} |
94 |
94 |
exit_group(-1); |
exit_group(-1); |
95 |
95 |
#ifdef __GNUC__ |
#ifdef __GNUC__ |
96 |
96 |
return 0;/*unreachable not detected at the end of function*/ |
return 0;/*unreachable not detected at the end of function*/ |
|
... |
... |
static void sysstart(void) |
103 |
103 |
i pid=sysstart_clone(); |
i pid=sysstart_clone(); |
104 |
104 |
l r=waitid(P_PID,pid,0,WEXITED); |
l r=waitid(P_PID,pid,0,WEXITED); |
105 |
105 |
if(ISERR(r)){ |
if(ISERR(r)){ |
106 |
|
OUT("ERROR(%ld):unable to wait for /sbin/sysstart to exit\n",r); |
|
|
106 |
|
OUT("ERROR(%ld):unable to wait for /bin/sysstart to exit\n",r); |
107 |
107 |
exit_group(-1); |
exit_group(-1); |
108 |
108 |
} |
} |
109 |
109 |
} |
} |
|
... |
... |
static void main_loop(void) |
131 |
131 |
struct siginfo siginfo; |
struct siginfo siginfo; |
132 |
132 |
l r=waitid(P_ALL,0,&siginfo,WEXITED); |
l r=waitid(P_ALL,0,&siginfo,WEXITED); |
133 |
133 |
if(ISERR(r)){ |
if(ISERR(r)){ |
134 |
|
OUT("ERROR(%ld):unable to wait on /sbin/agetty clone and orphan process terminations\n",r); |
|
|
134 |
|
OUT("ERROR(%ld):unable to wait on /bin/agetty clone and orphan process terminations\n",r); |
135 |
135 |
exit_group(-1); |
exit_group(-1); |
136 |
136 |
} |
} |
137 |
137 |
if(siginfo.fields.sigchld.pid==tty1) tty1=getty_spawn("tty1"); |
if(siginfo.fields.sigchld.pid==tty1) tty1=getty_spawn("tty1"); |