diff options
Diffstat (limited to 'init.c')
-rw-r--r-- | init.c | 17 |
1 files changed, 9 insertions, 8 deletions
@@ -40,6 +40,7 @@ | |||
40 | #include <sys/reboot.h> | 40 | #include <sys/reboot.h> |
41 | #include <sys/kdaemon.h> | 41 | #include <sys/kdaemon.h> |
42 | #include <sys/sysmacros.h> | 42 | #include <sys/sysmacros.h> |
43 | #include <asm/types.h> | ||
43 | #include <linux/serial.h> /* for serial_struct */ | 44 | #include <linux/serial.h> /* for serial_struct */ |
44 | #include <sys/vt.h> /* for vt_stat */ | 45 | #include <sys/vt.h> /* for vt_stat */ |
45 | #include <sys/ioctl.h> | 46 | #include <sys/ioctl.h> |
@@ -123,7 +124,7 @@ int device_open(char *device, int mode) | |||
123 | 124 | ||
124 | /* Retry up to 5 times */ | 125 | /* Retry up to 5 times */ |
125 | for (f = 0; f < 5; f++) | 126 | for (f = 0; f < 5; f++) |
126 | if ((fd = open(device, m)) >= 0) | 127 | if ((fd = open(device, m, 0600)) >= 0) |
127 | break; | 128 | break; |
128 | if (fd < 0) | 129 | if (fd < 0) |
129 | return fd; | 130 | return fd; |
@@ -470,19 +471,19 @@ static void shutdown_system(void) | |||
470 | sync(); | 471 | sync(); |
471 | 472 | ||
472 | /* Send signals to every process _except_ pid 1 */ | 473 | /* Send signals to every process _except_ pid 1 */ |
473 | message(CONSOLE, "Sending SIGHUP to all processes.\r\n"); | 474 | message(CONSOLE, "Sending SIGTERM to all processes.\r\n"); |
474 | kill(-1, SIGHUP); | 475 | kill(-1, SIGTERM); |
475 | sleep(2); | 476 | sleep(5); |
476 | sync(); | 477 | sync(); |
477 | 478 | ||
478 | message(CONSOLE, "Sending SIGKILL to all processes.\r\n"); | 479 | message(CONSOLE, "Sending SIGKILL to all processes.\r\n"); |
479 | kill(-1, SIGKILL); | 480 | kill(-1, SIGKILL); |
480 | sleep(1); | 481 | sleep(5); |
481 | 482 | ||
482 | message(CONSOLE, "Disabling swap.\r\n"); | 483 | message(CONSOLE, "Disabling swap.\r\n"); |
483 | waitfor( "swapoff -a", console, FALSE); | 484 | waitfor( "swapoff -a", console, FALSE); |
484 | message(CONSOLE, "Unmounting filesystems.\r\n"); | 485 | message(CONSOLE, "Unmounting filesystems.\r\n"); |
485 | waitfor("umount -a", console, FALSE); | 486 | waitfor("umount -a -r", console, FALSE); |
486 | sync(); | 487 | sync(); |
487 | if (kernelVersion > 0 && kernelVersion <= 2 * 65536 + 2 * 256 + 11) { | 488 | if (kernelVersion > 0 && kernelVersion <= 2 * 65536 + 2 * 256 + 11) { |
488 | /* bdflush, kupdate not needed for kernels >2.2.11 */ | 489 | /* bdflush, kupdate not needed for kernels >2.2.11 */ |
@@ -500,7 +501,7 @@ static void halt_signal(int sig) | |||
500 | sync(); | 501 | sync(); |
501 | 502 | ||
502 | /* allow time for last message to reach serial console */ | 503 | /* allow time for last message to reach serial console */ |
503 | sleep(2); | 504 | sleep(5); |
504 | 505 | ||
505 | #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,2,0) | 506 | #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,2,0) |
506 | if (sig == SIGUSR2) | 507 | if (sig == SIGUSR2) |