FreeCalypso > hg > freecalypso-tools
annotate libpwon/forkoff.c @ 573:b22cc34b6fc9
loadtools/Makefile: removed provisions for special GTA02 AP build
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Sun, 02 Feb 2020 19:24:18 +0000 |
parents | 41b3e010808d |
children | cef70d53fc5e |
rev | line source |
---|---|
571
41b3e010808d
libpwon started, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1 #include <sys/types.h> |
41b3e010808d
libpwon started, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
2 #include <stdio.h> |
41b3e010808d
libpwon started, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
3 #include <stdlib.h> |
41b3e010808d
libpwon started, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
4 #include <unistd.h> |
41b3e010808d
libpwon started, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
5 |
41b3e010808d
libpwon started, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
6 extern char bootctrl_pwon_cmd[]; |
41b3e010808d
libpwon started, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
7 |
41b3e010808d
libpwon started, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
8 static char shell_pathname[] = "/bin/sh"; |
41b3e010808d
libpwon started, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
9 |
41b3e010808d
libpwon started, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
10 void |
41b3e010808d
libpwon started, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
11 fork_exec_pwon_cmd() |
41b3e010808d
libpwon started, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
12 { |
41b3e010808d
libpwon started, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
13 int i; |
41b3e010808d
libpwon started, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
14 |
41b3e010808d
libpwon started, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
15 i = vfork(); |
41b3e010808d
libpwon started, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
16 if (i < 0) { |
41b3e010808d
libpwon started, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
17 perror("vfork"); |
41b3e010808d
libpwon started, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
18 exit(1); |
41b3e010808d
libpwon started, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
19 } |
41b3e010808d
libpwon started, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
20 if (i) |
41b3e010808d
libpwon started, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
21 return; |
41b3e010808d
libpwon started, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
22 execl(shell_pathname, "sh", "-c", bootctrl_pwon_cmd, (char *) 0); |
41b3e010808d
libpwon started, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
23 perror(shell_pathname); |
41b3e010808d
libpwon started, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
24 _exit(1); |
41b3e010808d
libpwon started, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
25 } |