Print this page
graph

Split Close
Expand all
Collapse all
          --- old/usr/src/cmd/svc/startd/graph.c
          +++ new/usr/src/cmd/svc/startd/graph.c
↓ open down ↓ 3566 lines elided ↑ open up ↑
3567 3567           * kludge-- a better policy is needed.
3568 3568           *
3569 3569           * Note that fork_with_timeout will only wait out the 1 second
3570 3570           * "grace time" if pkill actually returns 0.  So if there are
3571 3571           * no matches, this will run to completion much more quickly.
3572 3572           */
3573 3573          (void) fork_with_timeout("/usr/bin/pkill -TERM -v -u 0,1,15", 1, 5);
3574 3574          (void) fork_with_timeout("/usr/bin/pkill -KILL -v -u 0,1,15", 1, 5);
3575 3575  }
3576 3576  
     3577 +static int
     3578 +exec_cmd(char * invoke, char * output)
     3579 +{
     3580 +        FILE * cmd = popen(invoke, "r");
     3581 +        if (! cmd) 
     3582 +                return 0;
     3583 +        fgets(output, 512, cmd);
     3584 +        if (! *output) {
     3585 +                pclose(cmd);
     3586 +                return 0;
     3587 +        }
     3588 +        output[strlen(output) - 2] = '\0';
     3589 +        pclose(cmd);
     3590 +        return 1;
     3591 +}
     3592 +
3577 3593  static void
3578 3594  do_uadmin(void)
3579 3595  {
3580 3596          const char * const resetting = "/etc/svc/volatile/resetting";
3581 3597          int fd;
3582 3598          struct statvfs vfs;
3583 3599          time_t now;
3584 3600          struct tm nowtm;
3585 3601          char down_buf[256], time_buf[256];
3586 3602          uintptr_t mdep;
↓ open down ↓ 46 lines elided ↑ open up ↑
3633 3649          /*
3634 3650           * Right now, fast reboot is supported only on i386.
3635 3651           * scf_is_fastboot_default() should take care of it.
3636 3652           * If somehow we got there on unsupported platform -
3637 3653           * print warning and fall back to regular reboot.
3638 3654           */
3639 3655          if (halting == AD_FASTREBOOT) {
3640 3656  #if defined(__i386)
3641 3657                  int rc;
3642 3658  
3643      -                if ((rc = grub_get_boot_args(&fbarg, NULL,
3644      -                    GRUB_ENTRY_DEFAULT)) == 0) {
     3659 +                if ((rc = exec_cmd("/sbin/grubadm --number -1 --get-opts", 
     3660 +                        fbarg.gba_bootargs)) == 0) {
3645 3661                          mdep = (uintptr_t)&fbarg.gba_bootargs;
3646 3662                  } else {
3647 3663                          /*
3648 3664                           * Failed to read GRUB menu, fall back to normal reboot
3649 3665                           */
3650 3666                          halting = AD_BOOT;
3651 3667                          uu_warn("Failed to process GRUB menu entry "
3652 3668                              "for fast reboot.\n\t%s\n"
3653 3669                              "Falling back to regular reboot.\n",
3654 3670                              grub_strerror(rc));
↓ open down ↓ 3277 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX