annotate libpwon/forkoff.c @ 571:41b3e010808d

libpwon started, compiles
author Mychaela Falconia <falcon@freecalypso.org>
date Sun, 02 Feb 2020 17:40:25 +0000
parents
children cef70d53fc5e
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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 }