diff options
author | Jeremy Katz <katzj@redhat.com> | 2003-03-25 01:14:46 +0000 |
---|---|---|
committer | Jeremy Katz <katzj@redhat.com> | 2003-03-25 01:14:46 +0000 |
commit | 47bbb72b52d97651d3c3551674eda1efbd9702e6 (patch) | |
tree | 3a378e1156e7e8ca24e750cd7387e34625db05c6 | |
parent | 54a78378183a4c2a934c45e375a6433d5a4bf8f5 (diff) | |
download | anaconda-47bbb72b52d97651d3c3551674eda1efbd9702e6.tar.gz anaconda-47bbb72b52d97651d3c3551674eda1efbd9702e6.tar.xz anaconda-47bbb72b52d97651d3c3551674eda1efbd9702e6.zip |
* redirect all output to /dev/console
* halt the system on s390 instead of sitting in a while loop
* add a -r to reboot (not that it does anything other than just reboot back
into the install on s390 right now, but you could change that with hcp
probably)
-rw-r--r-- | loader2/shutdown.c | 36 |
1 files changed, 31 insertions, 5 deletions
diff --git a/loader2/shutdown.c b/loader2/shutdown.c index d15cfcb0f..33dab7bad 100644 --- a/loader2/shutdown.c +++ b/loader2/shutdown.c @@ -14,9 +14,11 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ +#include <fcntl.h> #include <signal.h> #include <stdio.h> #include <stdlib.h> +#include <string.h> #include <sys/reboot.h> #include <sys/types.h> #include <unistd.h> @@ -59,15 +61,15 @@ void shutDown(int noKill, int doReboot) { #if USE_MINILIBC reboot(0xfee1dead, 672274793, 0x1234567); #else -# ifdef __alpha__ - reboot(RB_HALT_SYSTEM); -# else reboot(RB_AUTOBOOT); -# endif #endif } else { printf("you may safely reboot your system\n"); +#if !defined(__s390__) && !defined(__s390x__) while (1); +#else + reboot(RB_HALT_SYSTEM); +#endif } exit(0); @@ -77,6 +79,30 @@ void shutDown(int noKill, int doReboot) { #ifdef AS_SHUTDOWN int main(int argc, char ** argv) { - shutDown(0, 0); + int fd; + int doReboot = 0; + int i = 1; + + while (i < argc) { + if (!strncmp("-r", argv[i], 2)) + doReboot = 1; + i++; + } + + /* ignore some signals so we don't kill ourself */ + signal(SIGINT, SIG_IGN); + signal(SIGTSTP, SIG_IGN); + + /* now change to / */ + chdir("/"); + + /* redirect output to the real console */ + fd = open("/dev/console", O_RDWR); + dup2(fd, 0); + dup2(fd, 1); + dup2(fd, 2); + close(fd); + + shutDown(0, doReboot); } #endif |