Re: [PATCH rhel6-branch] Add some better printing to init for future debugging.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 04/12/2010 03:43 PM, Chris Lumens wrote:
> Hopefully, this will make it easier to tell what program is failing to start
> in the future.
> 
> Related: rhbz#579044
> ---
>  loader/init.c |   16 ++++++++++++++--
>  1 files changed, 14 insertions(+), 2 deletions(-)
> 
> diff --git a/loader/init.c b/loader/init.c
> index 1332c18..1830aa8 100644
> --- a/loader/init.c
> +++ b/loader/init.c
> @@ -558,21 +558,26 @@ int main(int argc, char **argv) {
>      printf("anaconda installer init version %s starting\n", VERSION);
>  
>      printf("mounting /proc filesystem... "); 
> +    fflush(stdout);
>      if (mount("/proc", "/proc", "proc", 0, NULL))
>          fatal_error(1);
>      printf("done\n");
>  
>      printf("creating /dev filesystem... "); 
> +    fflush(stdout);

Not that I'm against this patch, but is there a good reason not to do

setbuf(stdout, NULL);

instead of all of these fflush()es?  Are we really ever using stdout (the
stdio stream) in a way that we want to be buffered at all?

>      if (mount("/dev", "/dev", "tmpfs", 0, NULL))
>          fatal_error(1);
>      createDevices();
>      printf("done\n");
> +
>      printf("starting udev...");
> +    fflush(stdout);
>      if ((childpid = fork()) == 0) {
>          execl("/sbin/udevd", "/sbin/udevd", "--daemon", NULL);
> +        fprintf(stderr, " exec of /sbin/udevd failed.");
>          exit(1);
>      }
> -    
> +
>      /* wait at least until the udevd process that we forked exits */
>      do {
>          pid_t retpid;
> @@ -593,19 +598,22 @@ int main(int argc, char **argv) {
>              break;
>          }
>      } while (1);
> -    
> +
>      if (fork() == 0) {
>          execl("/sbin/udevadm", "udevadm", "control", "--env=ANACONDA=1", NULL);
> +        fprintf(stderr, " exec of /sbin/udevadm failed.");
>          exit(1);
>      }
>      printf("done\n");
>  
>      printf("mounting /dev/pts (unix98 pty) filesystem... "); 
> +    fflush(stdout);
>      if (mount("/dev/pts", "/dev/pts", "devpts", 0, NULL))
>          fatal_error(1);
>      printf("done\n");
>  
>      printf("mounting /sys filesystem... "); 
> +    fflush(stdout);
>      if (mount("/sys", "/sys", "sysfs", 0, NULL))
>          fatal_error(1);
>      printf("done\n");
> @@ -740,6 +748,7 @@ int main(int argc, char **argv) {
>      ret = setdomainname("", 0);
>  
>      printf("trying to remount root filesystem read write... ");
> +    fflush(stdout);
>      if (mount("/", "/", "ext2", MS_REMOUNT | MS_MGC_VAL, NULL)) {
>          fatal_error(1);
>      }
> @@ -752,6 +761,7 @@ int main(int argc, char **argv) {
>      mkdir("/tmp", 0755);
>  
>      printf("mounting /tmp as tmpfs... ");
> +    fflush(stdout);
>      if (mount("none", "/tmp", "tmpfs", 0, "size=250m"))
>          fatal_error(1);
>      printf("done\n");
> @@ -780,11 +790,13 @@ int main(int argc, char **argv) {
>      /* D-Bus */
>      if (fork() == 0) {
>          execl("/sbin/dbus-uuidgen", "/sbin/dbus-uuidgen", "--ensure", NULL);
> +        fprintf(stderr, "exec of /sbin/dbus-uuidgen failed.");
>          doExit(1);
>      }
>  
>      if (fork() == 0) {
>          execl("/sbin/dbus-daemon", "/sbin/dbus-daemon", "--system", NULL);
> +        fprintf(stderr, "exec of /sbin/dbus-daemon failed.");
>          doExit(1);
>      }
>  


-- 
        Peter

THE MAGIC WORDS ARE SQUEAMISH OSSIFRAGE

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list

[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux