annotate libpwon/forkoff.c @ 958:ca6e969be6ee

rvinterf suite: raise MAX_PKT_FROM_TARGET to 1600
author Mychaela Falconia <falcon@freecalypso.org>
date Thu, 08 Jun 2023 02:47:48 +0000
parents ab54957dbe35
children
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>
575
cef70d53fc5e loadtools: new -P boot control mechanism implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 571
diff changeset
2 #include <signal.h>
571
41b3e010808d libpwon started, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
3 #include <stdio.h>
41b3e010808d libpwon started, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
4 #include <stdlib.h>
41b3e010808d libpwon started, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
5 #include <unistd.h>
41b3e010808d libpwon started, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
6
41b3e010808d libpwon started, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
7 extern char bootctrl_pwon_cmd[];
953
ab54957dbe35 libpwon: implement -Petmoff mode
Mychaela Falconia <falcon@freecalypso.org>
parents: 736
diff changeset
8 extern int bootctrl_duart28c_mode, bootctrl_etmoff_mode;
571
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 static char shell_pathname[] = "/bin/sh";
41b3e010808d libpwon started, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
11
41b3e010808d libpwon started, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
12 void
41b3e010808d libpwon started, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
13 fork_exec_pwon_cmd()
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 int i;
41b3e010808d libpwon started, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
16
41b3e010808d libpwon started, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
17 i = vfork();
41b3e010808d libpwon started, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
18 if (i < 0) {
41b3e010808d libpwon started, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
19 perror("vfork");
41b3e010808d libpwon started, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
20 exit(1);
41b3e010808d libpwon started, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
21 }
41b3e010808d libpwon started, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
22 if (i)
41b3e010808d libpwon started, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
23 return;
41b3e010808d libpwon started, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
24 execl(shell_pathname, "sh", "-c", bootctrl_pwon_cmd, (char *) 0);
41b3e010808d libpwon started, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
25 perror(shell_pathname);
41b3e010808d libpwon started, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
26 _exit(1);
41b3e010808d libpwon started, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
27 }
575
cef70d53fc5e loadtools: new -P boot control mechanism implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 571
diff changeset
28
cef70d53fc5e loadtools: new -P boot control mechanism implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 571
diff changeset
29 pwon_if_needed()
cef70d53fc5e loadtools: new -P boot control mechanism implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 571
diff changeset
30 {
736
7d1df6d831e4 libpwon: added -Pdtr and -Prts support for DUART28C
Mychaela Falconia <falcon@freecalypso.org>
parents: 575
diff changeset
31 if (bootctrl_duart28c_mode) {
7d1df6d831e4 libpwon: added -Pdtr and -Prts support for DUART28C
Mychaela Falconia <falcon@freecalypso.org>
parents: 575
diff changeset
32 signal(SIGCHLD, SIG_IGN);
7d1df6d831e4 libpwon: added -Pdtr and -Prts support for DUART28C
Mychaela Falconia <falcon@freecalypso.org>
parents: 575
diff changeset
33 fork_duart28c_pulse();
7d1df6d831e4 libpwon: added -Pdtr and -Prts support for DUART28C
Mychaela Falconia <falcon@freecalypso.org>
parents: 575
diff changeset
34 return(1);
7d1df6d831e4 libpwon: added -Pdtr and -Prts support for DUART28C
Mychaela Falconia <falcon@freecalypso.org>
parents: 575
diff changeset
35 }
7d1df6d831e4 libpwon: added -Pdtr and -Prts support for DUART28C
Mychaela Falconia <falcon@freecalypso.org>
parents: 575
diff changeset
36 if (bootctrl_pwon_cmd[0]) {
7d1df6d831e4 libpwon: added -Pdtr and -Prts support for DUART28C
Mychaela Falconia <falcon@freecalypso.org>
parents: 575
diff changeset
37 signal(SIGCHLD, SIG_IGN);
7d1df6d831e4 libpwon: added -Pdtr and -Prts support for DUART28C
Mychaela Falconia <falcon@freecalypso.org>
parents: 575
diff changeset
38 fork_exec_pwon_cmd();
7d1df6d831e4 libpwon: added -Pdtr and -Prts support for DUART28C
Mychaela Falconia <falcon@freecalypso.org>
parents: 575
diff changeset
39 return(1);
7d1df6d831e4 libpwon: added -Pdtr and -Prts support for DUART28C
Mychaela Falconia <falcon@freecalypso.org>
parents: 575
diff changeset
40 }
953
ab54957dbe35 libpwon: implement -Petmoff mode
Mychaela Falconia <falcon@freecalypso.org>
parents: 736
diff changeset
41 if (bootctrl_etmoff_mode) {
ab54957dbe35 libpwon: implement -Petmoff mode
Mychaela Falconia <falcon@freecalypso.org>
parents: 736
diff changeset
42 bootctrl_do_etmoff();
ab54957dbe35 libpwon: implement -Petmoff mode
Mychaela Falconia <falcon@freecalypso.org>
parents: 736
diff changeset
43 return(2);
ab54957dbe35 libpwon: implement -Petmoff mode
Mychaela Falconia <falcon@freecalypso.org>
parents: 736
diff changeset
44 }
736
7d1df6d831e4 libpwon: added -Pdtr and -Prts support for DUART28C
Mychaela Falconia <falcon@freecalypso.org>
parents: 575
diff changeset
45 return(0);
575
cef70d53fc5e loadtools: new -P boot control mechanism implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 571
diff changeset
46 }