diff options
author | Eric Andersen <andersen@codepoet.org> | 2001-10-28 05:12:20 +0000 |
---|---|---|
committer | Eric Andersen <andersen@codepoet.org> | 2001-10-28 05:12:20 +0000 |
commit | 72f9a4277fe5ad7c6c6b9a9810d469cc7fcc3c71 (patch) | |
tree | 5dbf1995f603a95960c0ef94558954091ce7beef | |
parent | 9af363fe20002c7390966d4b71fcdee27b3686ba (diff) | |
download | busybox-w32-72f9a4277fe5ad7c6c6b9a9810d469cc7fcc3c71.tar.gz busybox-w32-72f9a4277fe5ad7c6c6b9a9810d469cc7fcc3c71.tar.bz2 busybox-w32-72f9a4277fe5ad7c6c6b9a9810d469cc7fcc3c71.zip |
Add in some (theoretical) uClinux support. Some init cleanups
-rw-r--r-- | init/init.c | 97 | ||||
-rw-r--r-- | networking/ifconfig.c | 4 | ||||
-rw-r--r-- | shell/ash.c | 6 | ||||
-rw-r--r-- | shell/hush.c | 11 | ||||
-rw-r--r-- | shell/lash.c | 7 | ||||
-rw-r--r-- | sysklogd/klogd.c | 4 | ||||
-rw-r--r-- | sysklogd/syslogd.c | 4 |
7 files changed, 82 insertions, 51 deletions
diff --git a/init/init.c b/init/init.c index b6eaa46ea..1a5056c8c 100644 --- a/init/init.c +++ b/init/init.c | |||
@@ -75,6 +75,12 @@ struct serial_struct { | |||
75 | }; | 75 | }; |
76 | 76 | ||
77 | 77 | ||
78 | #if (__GNU_LIBRARY__ > 5) || defined(__dietlibc__) | ||
79 | #include <sys/reboot.h> | ||
80 | #define init_reboot(magic) reboot(magic) | ||
81 | #else | ||
82 | #define init_reboot(magic) reboot(0xfee1dead, 672274793, magic) | ||
83 | #endif | ||
78 | 84 | ||
79 | #ifndef RB_HALT_SYSTEM | 85 | #ifndef RB_HALT_SYSTEM |
80 | static const int RB_HALT_SYSTEM = 0xcdef0123; | 86 | static const int RB_HALT_SYSTEM = 0xcdef0123; |
@@ -84,13 +90,6 @@ static const int RB_DISABLE_CAD = 0; | |||
84 | static const int RB_AUTOBOOT = 0x01234567; | 90 | static const int RB_AUTOBOOT = 0x01234567; |
85 | #endif | 91 | #endif |
86 | 92 | ||
87 | #if (__GNU_LIBRARY__ > 5) || defined(__dietlibc__) | ||
88 | #include <sys/reboot.h> | ||
89 | #define init_reboot(magic) reboot(magic) | ||
90 | #else | ||
91 | #define init_reboot(magic) reboot(0xfee1dead, 672274793, magic) | ||
92 | #endif | ||
93 | |||
94 | #ifndef _PATH_STDPATH | 93 | #ifndef _PATH_STDPATH |
95 | #define _PATH_STDPATH "/usr/bin:/bin:/usr/sbin:/sbin" | 94 | #define _PATH_STDPATH "/usr/bin:/bin:/usr/sbin:/sbin" |
96 | #endif | 95 | #endif |
@@ -218,7 +217,7 @@ static void message(int device, char *fmt, ...) | |||
218 | device = CONSOLE; | 217 | device = CONSOLE; |
219 | } else if ((log_fd = device_open(log, O_RDWR|O_NDELAY)) < 0) { | 218 | } else if ((log_fd = device_open(log, O_RDWR|O_NDELAY)) < 0) { |
220 | log_fd = -2; | 219 | log_fd = -2; |
221 | fprintf(stderr, "Bummer, can't write to log on %s!\r\n", log); | 220 | fprintf(stderr, "Bummer, can't write to log on %s!\n", log); |
222 | log = NULL; | 221 | log = NULL; |
223 | device = CONSOLE; | 222 | device = CONSOLE; |
224 | } | 223 | } |
@@ -382,7 +381,7 @@ static void console_init(void) | |||
382 | if (strcmp( termType, "TERM=linux" ) == 0) | 381 | if (strcmp( termType, "TERM=linux" ) == 0) |
383 | safe_strncpy(termType, "TERM=vt102", sizeof(termType)); | 382 | safe_strncpy(termType, "TERM=vt102", sizeof(termType)); |
384 | message(LOG | CONSOLE, | 383 | message(LOG | CONSOLE, |
385 | "serial console detected. Disabling virtual terminals.\r\n"); | 384 | "serial console detected. Disabling virtual terminals.\n"); |
386 | } | 385 | } |
387 | close(fd); | 386 | close(fd); |
388 | } | 387 | } |
@@ -395,7 +394,7 @@ static void fixup_argv(int argc, char **argv, char *new_argv0) | |||
395 | /* Fix up argv[0] to be certain we claim to be init */ | 394 | /* Fix up argv[0] to be certain we claim to be init */ |
396 | len = strlen(argv[0]); | 395 | len = strlen(argv[0]); |
397 | memset(argv[0], 0, len); | 396 | memset(argv[0], 0, len); |
398 | strncpy(argv[0], new_argv0, len); | 397 | safe_strncpy(argv[0], new_argv0, len + 1); |
399 | 398 | ||
400 | /* Wipe argv[1]-argv[N] so they don't clutter the ps listing */ | 399 | /* Wipe argv[1]-argv[N] so they don't clutter the ps listing */ |
401 | len = 1; | 400 | len = 1; |
@@ -425,7 +424,7 @@ static pid_t run(char *command, char *terminal, int get_enter) | |||
425 | char *environment[MAXENV+1] = { | 424 | char *environment[MAXENV+1] = { |
426 | termType, | 425 | termType, |
427 | "HOME=/", | 426 | "HOME=/", |
428 | "PATH=/usr/bin:/bin:/usr/sbin:/sbin", | 427 | "PATH=" _PATH_STDPATH, |
429 | "SHELL=" SHELL, | 428 | "SHELL=" SHELL, |
430 | "USER=root", | 429 | "USER=root", |
431 | NULL | 430 | NULL |
@@ -444,7 +443,12 @@ static pid_t run(char *command, char *terminal, int get_enter) | |||
444 | } | 443 | } |
445 | } | 444 | } |
446 | 445 | ||
447 | if ((pid = fork()) == 0) { | 446 | #if !defined(__UCLIBC__) || defined(__UCLIBC_HAS_MMU__) |
447 | if ((pid = fork()) == 0) | ||
448 | #else | ||
449 | if ((pid = vfork()) == 0) | ||
450 | #endif | ||
451 | { | ||
448 | /* Clean up */ | 452 | /* Clean up */ |
449 | ioctl(0, TIOCNOTTY, 0); | 453 | ioctl(0, TIOCNOTTY, 0); |
450 | close(0); | 454 | close(0); |
@@ -465,7 +469,7 @@ static pid_t run(char *command, char *terminal, int get_enter) | |||
465 | terminal); | 469 | terminal); |
466 | exit(1); | 470 | exit(1); |
467 | } | 471 | } |
468 | message(LOG | CONSOLE, "Bummer, can't open %s\r\n", terminal); | 472 | message(LOG | CONSOLE, "Bummer, can't open %s\n", terminal); |
469 | exit(1); | 473 | exit(1); |
470 | } | 474 | } |
471 | dup2(fd, 0); | 475 | dup2(fd, 0); |
@@ -480,13 +484,16 @@ static pid_t run(char *command, char *terminal, int get_enter) | |||
480 | cmd[0] = SHELL; | 484 | cmd[0] = SHELL; |
481 | cmd[1] = "-c"; | 485 | cmd[1] = "-c"; |
482 | strcpy(buf, "exec "); | 486 | strcpy(buf, "exec "); |
483 | strncat(buf, command, sizeof(buf) - strlen(buf) - 1); | 487 | safe_strncpy(buf + sizeof("exec "), command, |
488 | sizeof(buf) - sizeof("exec ")); | ||
484 | cmd[2] = buf; | 489 | cmd[2] = buf; |
485 | cmd[3] = NULL; | 490 | cmd[3] = NULL; |
486 | } else { | 491 | } else { |
487 | /* Convert command (char*) into cmd (char**, one word per string) */ | 492 | /* Convert command (char*) into cmd (char**, one word per string) */ |
488 | for (tmpCmd = command, i = 0; | 493 | safe_strncpy(buf, command, sizeof(buf)); |
489 | (tmpCmd = strsep(&command, " \t")) != NULL;) { | 494 | s = buf; |
495 | for (tmpCmd = buf, i = 0; | ||
496 | (tmpCmd = strsep(&s, " \t")) != NULL;) { | ||
490 | if (*tmpCmd != '\0') { | 497 | if (*tmpCmd != '\0') { |
491 | cmd[i] = tmpCmd; | 498 | cmd[i] = tmpCmd; |
492 | tmpCmd++; | 499 | tmpCmd++; |
@@ -533,7 +540,7 @@ static pid_t run(char *command, char *terminal, int get_enter) | |||
533 | * specifies. | 540 | * specifies. |
534 | */ | 541 | */ |
535 | #ifdef DEBUG_INIT | 542 | #ifdef DEBUG_INIT |
536 | message(LOG, "Waiting for enter to start '%s' (pid %d, console %s)\r\n", | 543 | message(LOG, "Waiting for enter to start '%s' (pid %d, console %s)\n", |
537 | cmd[0], getpid(), terminal); | 544 | cmd[0], getpid(), terminal); |
538 | #endif | 545 | #endif |
539 | write(fileno(stdout), press_enter, sizeof(press_enter) - 1); | 546 | write(fileno(stdout), press_enter, sizeof(press_enter) - 1); |
@@ -542,7 +549,7 @@ static pid_t run(char *command, char *terminal, int get_enter) | |||
542 | 549 | ||
543 | #ifdef DEBUG_INIT | 550 | #ifdef DEBUG_INIT |
544 | /* Log the process name and args */ | 551 | /* Log the process name and args */ |
545 | message(LOG, "Starting pid %d, console %s: '%s'\r\n", | 552 | message(LOG, "Starting pid %d, console %s: '%s'\n", |
546 | getpid(), terminal, command); | 553 | getpid(), terminal, command); |
547 | #endif | 554 | #endif |
548 | 555 | ||
@@ -592,6 +599,7 @@ static void check_memory(void) | |||
592 | if (check_free_memory() > 1000) | 599 | if (check_free_memory() > 1000) |
593 | return; | 600 | return; |
594 | 601 | ||
602 | #if !defined(__UCLIBC__) || defined(__UCLIBC_HAS_MMU__) | ||
595 | if (stat("/etc/fstab", &statBuf) == 0) { | 603 | if (stat("/etc/fstab", &statBuf) == 0) { |
596 | /* swapon -a requires /proc typically */ | 604 | /* swapon -a requires /proc typically */ |
597 | waitfor("mount proc /proc -t proc", console, FALSE); | 605 | waitfor("mount proc /proc -t proc", console, FALSE); |
@@ -602,10 +610,11 @@ static void check_memory(void) | |||
602 | } else | 610 | } else |
603 | goto goodnight; | 611 | goto goodnight; |
604 | return; | 612 | return; |
613 | #endif | ||
605 | 614 | ||
606 | goodnight: | 615 | goodnight: |
607 | message(CONSOLE, | 616 | message(CONSOLE, |
608 | "Sorry, your computer does not have enough memory.\r\n"); | 617 | "Sorry, your computer does not have enough memory.\n"); |
609 | loop_forever(); | 618 | loop_forever(); |
610 | } | 619 | } |
611 | 620 | ||
@@ -627,22 +636,29 @@ static void run_actions(initActionEnum action) | |||
627 | static void shutdown_system(void) | 636 | static void shutdown_system(void) |
628 | { | 637 | { |
629 | 638 | ||
630 | /* first disable our SIGHUP signal */ | 639 | /* first disable all our signals */ |
631 | signal(SIGHUP, SIG_DFL); | 640 | sigemptyset(&block_signals); |
641 | sigaddset(&block_signals, SIGHUP); | ||
642 | sigaddset(&block_signals, SIGCHLD); | ||
643 | sigaddset(&block_signals, SIGUSR1); | ||
644 | sigaddset(&block_signals, SIGUSR2); | ||
645 | sigaddset(&block_signals, SIGINT); | ||
646 | sigaddset(&block_signals, SIGTERM); | ||
647 | sigprocmask(SIG_BLOCK, &block_signals, NULL); | ||
632 | 648 | ||
633 | /* Allow Ctrl-Alt-Del to reboot system. */ | 649 | /* Allow Ctrl-Alt-Del to reboot system. */ |
634 | init_reboot(RB_ENABLE_CAD); | 650 | init_reboot(RB_ENABLE_CAD); |
635 | 651 | ||
636 | message(CONSOLE|LOG, "\r\nThe system is going down NOW !!\r\n"); | 652 | message(CONSOLE|LOG, "\nThe system is going down NOW !!\n"); |
637 | sync(); | 653 | sync(); |
638 | 654 | ||
639 | /* Send signals to every process _except_ pid 1 */ | 655 | /* Send signals to every process _except_ pid 1 */ |
640 | message(CONSOLE|LOG, "Sending SIGTERM to all processes.\r\n"); | 656 | message(CONSOLE|LOG, "Sending SIGTERM to all processes.\n"); |
641 | kill(-1, SIGTERM); | 657 | kill(-1, SIGTERM); |
642 | sleep(1); | 658 | sleep(1); |
643 | sync(); | 659 | sync(); |
644 | 660 | ||
645 | message(CONSOLE|LOG, "Sending SIGKILL to all processes.\r\n"); | 661 | message(CONSOLE|LOG, "Sending SIGKILL to all processes.\n"); |
646 | kill(-1, SIGKILL); | 662 | kill(-1, SIGKILL); |
647 | sleep(1); | 663 | sleep(1); |
648 | 664 | ||
@@ -661,7 +677,7 @@ static void halt_signal(int sig) | |||
661 | { | 677 | { |
662 | shutdown_system(); | 678 | shutdown_system(); |
663 | message(CONSOLE|LOG, | 679 | message(CONSOLE|LOG, |
664 | "The system is halted. Press %s or turn off power\r\n", | 680 | "The system is halted. Press %s or turn off power\n", |
665 | (secondConsole == NULL) /* serial console */ | 681 | (secondConsole == NULL) /* serial console */ |
666 | ? "Reset" : "CTRL-ALT-DEL"); | 682 | ? "Reset" : "CTRL-ALT-DEL"); |
667 | sync(); | 683 | sync(); |
@@ -680,7 +696,7 @@ static void halt_signal(int sig) | |||
680 | static void reboot_signal(int sig) | 696 | static void reboot_signal(int sig) |
681 | { | 697 | { |
682 | shutdown_system(); | 698 | shutdown_system(); |
683 | message(CONSOLE|LOG, "Please stand by while rebooting the system.\r\n"); | 699 | message(CONSOLE|LOG, "Please stand by while rebooting the system.\n"); |
684 | sync(); | 700 | sync(); |
685 | 701 | ||
686 | /* allow time for last message to reach serial console */ | 702 | /* allow time for last message to reach serial console */ |
@@ -701,9 +717,7 @@ static void ctrlaltdel_signal(int sig) | |||
701 | static void new_initAction(initActionEnum action, char *process, char *cons) | 717 | static void new_initAction(initActionEnum action, char *process, char *cons) |
702 | { | 718 | { |
703 | initAction *newAction; | 719 | initAction *newAction; |
704 | #ifdef CONFIG_FEATURE_INIT_NORMAL_ORDER | ||
705 | initAction *a; | 720 | initAction *a; |
706 | #endif | ||
707 | 721 | ||
708 | if (*cons == '\0') | 722 | if (*cons == '\0') |
709 | cons = console; | 723 | cons = console; |
@@ -723,20 +737,15 @@ static void new_initAction(initActionEnum action, char *process, char *cons) | |||
723 | message(LOG | CONSOLE, "Memory allocation failure\n"); | 737 | message(LOG | CONSOLE, "Memory allocation failure\n"); |
724 | loop_forever(); | 738 | loop_forever(); |
725 | } | 739 | } |
726 | #ifdef CONFIG_FEATURE_INIT_NORMAL_ORDER | ||
727 | for (a = initActionList; a && a->nextPtr; a = a->nextPtr) ; | 740 | for (a = initActionList; a && a->nextPtr; a = a->nextPtr) ; |
728 | if (a) { | 741 | if (a) { |
729 | a->nextPtr = newAction; | 742 | a->nextPtr = newAction; |
730 | } else { | 743 | } else { |
731 | initActionList = newAction; | 744 | initActionList = newAction; |
732 | } | 745 | } |
733 | #else | 746 | safe_strncpy(newAction->process, process, 255); |
734 | newAction->nextPtr = initActionList; | ||
735 | initActionList = newAction; | ||
736 | #endif | ||
737 | strncpy(newAction->process, process, 255); | ||
738 | newAction->action = action; | 747 | newAction->action = action; |
739 | strncpy(newAction->console, cons, 255); | 748 | safe_strncpy(newAction->console, cons, 255); |
740 | newAction->pid = 0; | 749 | newAction->pid = 0; |
741 | // message(LOG|CONSOLE, "process='%s' action='%d' console='%s'\n", | 750 | // message(LOG|CONSOLE, "process='%s' action='%d' console='%s'\n", |
742 | // newAction->process, newAction->action, newAction->console); | 751 | // newAction->process, newAction->action, newAction->console); |
@@ -782,16 +791,11 @@ static void parse_inittab(void) | |||
782 | #endif | 791 | #endif |
783 | /* Reboot on Ctrl-Alt-Del */ | 792 | /* Reboot on Ctrl-Alt-Del */ |
784 | new_initAction(CTRLALTDEL, "/sbin/reboot", console); | 793 | new_initAction(CTRLALTDEL, "/sbin/reboot", console); |
785 | #ifdef CONFIG_FEATURE_INIT_NORMAL_ORDER | ||
786 | /* Umount all filesystems on halt/reboot */ | 794 | /* Umount all filesystems on halt/reboot */ |
787 | new_initAction(SHUTDOWN, "/bin/umount -a -r", console); | 795 | new_initAction(SHUTDOWN, "/bin/umount -a -r", console); |
796 | #if !defined(__UCLIBC__) || defined(__UCLIBC_HAS_MMU__) | ||
788 | /* Swapoff on halt/reboot */ | 797 | /* Swapoff on halt/reboot */ |
789 | new_initAction(SHUTDOWN, "/sbin/swapoff -a", console); | 798 | new_initAction(SHUTDOWN, "/sbin/swapoff -a", console); |
790 | #else | ||
791 | /* Swapoff on halt/reboot */ | ||
792 | new_initAction(SHUTDOWN, "/sbin/swapoff -a", console); | ||
793 | /* Umount all filesystems on halt/reboot */ | ||
794 | new_initAction(SHUTDOWN, "/bin/umount -a -r", console); | ||
795 | #endif | 799 | #endif |
796 | /* Askfirst shell on tty1 */ | 800 | /* Askfirst shell on tty1 */ |
797 | new_initAction(ASKFIRST, LOGIN_SHELL, console); | 801 | new_initAction(ASKFIRST, LOGIN_SHELL, console); |
@@ -916,13 +920,14 @@ extern int init_main(int argc, char **argv) | |||
916 | /* Figure out what kernel this is running */ | 920 | /* Figure out what kernel this is running */ |
917 | kernelVersion = get_kernel_revision(); | 921 | kernelVersion = get_kernel_revision(); |
918 | 922 | ||
919 | /* Figure out where the default console should be */ | ||
920 | console_init(); | ||
921 | |||
922 | /* Close whatever files are open, and reset the console. */ | 923 | /* Close whatever files are open, and reset the console. */ |
923 | close(0); | 924 | close(0); |
924 | close(1); | 925 | close(1); |
925 | close(2); | 926 | close(2); |
927 | |||
928 | /* Figure out where the default console should be */ | ||
929 | console_init(); | ||
930 | |||
926 | set_term(0); | 931 | set_term(0); |
927 | chdir("/"); | 932 | chdir("/"); |
928 | setsid(); | 933 | setsid(); |
@@ -937,14 +942,14 @@ extern int init_main(int argc, char **argv) | |||
937 | CONSOLE| | 942 | CONSOLE| |
938 | #endif | 943 | #endif |
939 | LOG, | 944 | LOG, |
940 | "init started: %s\r\n", full_version); | 945 | "init started: %s\n", full_version); |
941 | #else | 946 | #else |
942 | message( | 947 | message( |
943 | #if ! defined CONFIG_FEATURE_EXTRA_QUIET | 948 | #if ! defined CONFIG_FEATURE_EXTRA_QUIET |
944 | CONSOLE| | 949 | CONSOLE| |
945 | #endif | 950 | #endif |
946 | LOG, | 951 | LOG, |
947 | "init(%d) started: %s\r\n", getpid(), full_version); | 952 | "init(%d) started: %s\n", getpid(), full_version); |
948 | #endif | 953 | #endif |
949 | 954 | ||
950 | 955 | ||
diff --git a/networking/ifconfig.c b/networking/ifconfig.c index 3beecaf3d..295c89c5e 100644 --- a/networking/ifconfig.c +++ b/networking/ifconfig.c | |||
@@ -15,7 +15,7 @@ | |||
15 | * Foundation; either version 2 of the License, or (at | 15 | * Foundation; either version 2 of the License, or (at |
16 | * your option) any later version. | 16 | * your option) any later version. |
17 | * | 17 | * |
18 | * $Id: ifconfig.c,v 1.13 2001/10/24 04:59:56 andersen Exp $ | 18 | * $Id: ifconfig.c,v 1.14 2001/10/28 05:12:18 andersen Exp $ |
19 | * | 19 | * |
20 | */ | 20 | */ |
21 | 21 | ||
@@ -135,7 +135,7 @@ | |||
135 | #define ARG_MTU (A_ARG_REQ /*| A_CAST_INT*/) | 135 | #define ARG_MTU (A_ARG_REQ /*| A_CAST_INT*/) |
136 | #define ARG_TXQUEUELEN (A_ARG_REQ /*| A_CAST_INT*/) | 136 | #define ARG_TXQUEUELEN (A_ARG_REQ /*| A_CAST_INT*/) |
137 | #define ARG_MEM_START (A_ARG_REQ | A_MAP_ULONG) | 137 | #define ARG_MEM_START (A_ARG_REQ | A_MAP_ULONG) |
138 | #define ARG_IO_ADDR (A_ARG_REQ | A_MAP_USHORT) | 138 | #define ARG_IO_ADDR (A_ARG_REQ | A_MAP_ULONG) |
139 | #define ARG_IRQ (A_ARG_REQ | A_MAP_UCHAR) | 139 | #define ARG_IRQ (A_ARG_REQ | A_MAP_UCHAR) |
140 | #define ARG_DSTADDR (A_ARG_REQ | A_CAST_HOST_COPY_RESOLVE) | 140 | #define ARG_DSTADDR (A_ARG_REQ | A_CAST_HOST_COPY_RESOLVE) |
141 | #define ARG_NETMASK (A_ARG_REQ | A_CAST_HOST_COPY_RESOLVE | A_NETMASK) | 141 | #define ARG_NETMASK (A_ARG_REQ | A_CAST_HOST_COPY_RESOLVE | A_NETMASK) |
diff --git a/shell/ash.c b/shell/ash.c index ffafcfeb4..0c893998d 100644 --- a/shell/ash.c +++ b/shell/ash.c | |||
@@ -6756,7 +6756,11 @@ forkshell(struct job *jp, const union node *n, int mode) | |||
6756 | TRACE(("forkshell(%%%d, 0x%lx, %d) called\n", jp - jobtab, (long)n, | 6756 | TRACE(("forkshell(%%%d, 0x%lx, %d) called\n", jp - jobtab, (long)n, |
6757 | mode)); | 6757 | mode)); |
6758 | INTOFF; | 6758 | INTOFF; |
6759 | #if !defined(__UCLIBC__) || defined(__UCLIBC_HAS_MMU__) | ||
6759 | pid = fork(); | 6760 | pid = fork(); |
6761 | #else | ||
6762 | pid = vfork(); | ||
6763 | #endif | ||
6760 | if (pid == -1) { | 6764 | if (pid == -1) { |
6761 | TRACE(("Fork failed, errno=%d\n", errno)); | 6765 | TRACE(("Fork failed, errno=%d\n", errno)); |
6762 | INTON; | 6766 | INTON; |
@@ -12627,7 +12631,7 @@ findvar(struct var **vpp, const char *name) | |||
12627 | /* | 12631 | /* |
12628 | * Copyright (c) 1999 Herbert Xu <herbert@debian.org> | 12632 | * Copyright (c) 1999 Herbert Xu <herbert@debian.org> |
12629 | * This file contains code for the times builtin. | 12633 | * This file contains code for the times builtin. |
12630 | * $Id: ash.c,v 1.31 2001/10/24 17:19:35 andersen Exp $ | 12634 | * $Id: ash.c,v 1.32 2001/10/28 05:12:18 andersen Exp $ |
12631 | */ | 12635 | */ |
12632 | static int timescmd (int argc, char **argv) | 12636 | static int timescmd (int argc, char **argv) |
12633 | { | 12637 | { |
diff --git a/shell/hush.c b/shell/hush.c index d37842b79..195013869 100644 --- a/shell/hush.c +++ b/shell/hush.c | |||
@@ -1403,7 +1403,12 @@ static int run_pipe_real(struct pipe *pi) | |||
1403 | } | 1403 | } |
1404 | 1404 | ||
1405 | /* XXX test for failed fork()? */ | 1405 | /* XXX test for failed fork()? */ |
1406 | if (!(child->pid = fork())) { | 1406 | #if !defined(__UCLIBC__) || defined(__UCLIBC_HAS_MMU__) |
1407 | if (!(child->pid = fork())) | ||
1408 | #else | ||
1409 | if (!(child->pid = vfork())) | ||
1410 | #endif | ||
1411 | { | ||
1407 | /* Set the handling for job control signals back to the default. */ | 1412 | /* Set the handling for job control signals back to the default. */ |
1408 | signal(SIGINT, SIG_DFL); | 1413 | signal(SIGINT, SIG_DFL); |
1409 | signal(SIGQUIT, SIG_DFL); | 1414 | signal(SIGQUIT, SIG_DFL); |
@@ -2118,7 +2123,11 @@ FILE *generate_stream_from_list(struct pipe *head) | |||
2118 | #if 1 | 2123 | #if 1 |
2119 | int pid, channel[2]; | 2124 | int pid, channel[2]; |
2120 | if (pipe(channel)<0) perror_msg_and_die("pipe"); | 2125 | if (pipe(channel)<0) perror_msg_and_die("pipe"); |
2126 | #if !defined(__UCLIBC__) || defined(__UCLIBC_HAS_MMU__) | ||
2121 | pid=fork(); | 2127 | pid=fork(); |
2128 | #else | ||
2129 | pid=vfork(); | ||
2130 | #endif | ||
2122 | if (pid<0) { | 2131 | if (pid<0) { |
2123 | perror_msg_and_die("fork"); | 2132 | perror_msg_and_die("fork"); |
2124 | } else if (pid==0) { | 2133 | } else if (pid==0) { |
diff --git a/shell/lash.c b/shell/lash.c index 004d9495a..5b9d0a6b3 100644 --- a/shell/lash.c +++ b/shell/lash.c | |||
@@ -1347,7 +1347,12 @@ static int run_command(struct job *newjob, int inbg, int outpipe[2]) | |||
1347 | } | 1347 | } |
1348 | } | 1348 | } |
1349 | 1349 | ||
1350 | if (!(child->pid = fork())) { | 1350 | #if !defined(__UCLIBC__) || defined(__UCLIBC_HAS_MMU__) |
1351 | if (!(child->pid = fork())) | ||
1352 | #else | ||
1353 | if (!(child->pid = vfork())) | ||
1354 | #endif | ||
1355 | { | ||
1351 | /* Set the handling for job control signals back to the default. */ | 1356 | /* Set the handling for job control signals back to the default. */ |
1352 | signal(SIGINT, SIG_DFL); | 1357 | signal(SIGINT, SIG_DFL); |
1353 | signal(SIGQUIT, SIG_DFL); | 1358 | signal(SIGQUIT, SIG_DFL); |
diff --git a/sysklogd/klogd.c b/sysklogd/klogd.c index 33bc783fe..52a815d56 100644 --- a/sysklogd/klogd.c +++ b/sysklogd/klogd.c | |||
@@ -136,8 +136,12 @@ extern int klogd_main(int argc, char **argv) | |||
136 | } | 136 | } |
137 | 137 | ||
138 | if (doFork == TRUE) { | 138 | if (doFork == TRUE) { |
139 | #if !defined(__UCLIBC__) || defined(__UCLIBC_HAS_MMU__) | ||
139 | if (daemon(0, 1) < 0) | 140 | if (daemon(0, 1) < 0) |
140 | perror_msg_and_die("daemon"); | 141 | perror_msg_and_die("daemon"); |
142 | #else | ||
143 | error_msg_and_die("daemon not supported"); | ||
144 | #endif | ||
141 | } | 145 | } |
142 | doKlogd(); | 146 | doKlogd(); |
143 | 147 | ||
diff --git a/sysklogd/syslogd.c b/sysklogd/syslogd.c index 236f1190d..84414439e 100644 --- a/sysklogd/syslogd.c +++ b/sysklogd/syslogd.c | |||
@@ -630,8 +630,12 @@ extern int syslogd_main(int argc, char **argv) | |||
630 | umask(0); | 630 | umask(0); |
631 | 631 | ||
632 | if (doFork == TRUE) { | 632 | if (doFork == TRUE) { |
633 | #if !defined(__UCLIBC__) || defined(__UCLIBC_HAS_MMU__) | ||
633 | if (daemon(0, 1) < 0) | 634 | if (daemon(0, 1) < 0) |
634 | perror_msg_and_die("daemon"); | 635 | perror_msg_and_die("daemon"); |
636 | #else | ||
637 | error_msg_and_die("daemon not supported"); | ||
638 | #endif | ||
635 | } | 639 | } |
636 | doSyslogd(); | 640 | doSyslogd(); |
637 | 641 | ||