Mercurial > hg > toybox
comparison toys/oneit.c @ 237:7cb15eae1664
Zap toylist.h, moving contents of global structures into DEFINE_GLOBALS()
macros in each C file, and making generated/globals.h from that. Rename
"toy" to "this" along the way to avoid toy/toys confusion.
author | Rob Landley <rob@landley.net> |
---|---|
date | Sun, 20 Jan 2008 17:25:44 -0600 |
parents | 163498bf547b |
children | 93223118c813 |
comparison
equal
deleted
inserted
replaced
236:6b292ee780ab | 237:7cb15eae1664 |
---|---|
27 */ | 27 */ |
28 | 28 |
29 #include "toys.h" | 29 #include "toys.h" |
30 #include <sys/reboot.h> | 30 #include <sys/reboot.h> |
31 | 31 |
32 DEFINE_GLOBALS( | |
33 char *console; | |
34 ) | |
35 | |
36 #define TT this.oneit | |
37 | |
32 // The minimum amount of work necessary to get ctrl-c and such to work is: | 38 // The minimum amount of work necessary to get ctrl-c and such to work is: |
33 // | 39 // |
34 // - Fork a child (PID 1 is special: can't exit, has various signals blocked). | 40 // - Fork a child (PID 1 is special: can't exit, has various signals blocked). |
35 // - Do a setsid() (so we have our own session). | 41 // - Do a setsid() (so we have our own session). |
36 // - In the child, attach stdio to /dev/tty0 (/dev/console is special) | 42 // - In the child, attach stdio to /dev/tty0 (/dev/console is special) |
37 // - Exec the rest of the command line. | 43 // - Exec the rest of the command line. |
38 // | 44 // |
39 // PID 1 then reaps zombies until the child process it spawned exits, at which | 45 // PID 1 then reaps zombies until the child process it spawned exits, at which |
40 // point it calls sync() and reboot(). I could stick a kill -1 in there. | 46 // point it calls sync() and reboot(). I could stick a kill -1 in there. |
41 | 47 |
42 #define TT toy.oneit | |
43 | 48 |
44 void oneit_main(void) | 49 void oneit_main(void) |
45 { | 50 { |
46 int i; | 51 int i; |
47 pid_t pid; | 52 pid_t pid; |