Print this page
XXXX introduce drv_sectohz


 583         }
 584 
 585 
 586         /*
 587          * If we're still booting and init(1) isn't set up yet, simply halt.
 588          */
 589         mutex_enter(&pidlock);
 590         initpp = prfind(P_INITPID);
 591         mutex_exit(&pidlock);
 592         if (initpp == NULL) {
 593                 extern void halt(char *);
 594                 halt("Power off the System");   /* just in case */
 595         }
 596 
 597         /*
 598          * else, graceful shutdown with inittab and all getting involved
 599          */
 600         psignal(initpp, SIGPWR);
 601 
 602         (void) timeout(xen_dirty_shutdown, arg,
 603             SHUTDOWN_TIMEOUT_SECS * drv_usectohz(MICROSEC));
 604 }
 605 
 606 /*ARGSUSED*/
 607 static void
 608 xen_shutdown_handler(struct xenbus_watch *watch, const char **vec,
 609         unsigned int len)
 610 {
 611         char *str;
 612         xenbus_transaction_t xbt;
 613         int err, shutdown_code = SHUTDOWN_INVALID;
 614         unsigned int slen;
 615 
 616 again:
 617         err = xenbus_transaction_start(&xbt);
 618         if (err)
 619                 return;
 620         if (xenbus_read(xbt, "control", "shutdown", (void *)&str, &slen)) {
 621                 (void) xenbus_transaction_end(xbt, 1);
 622                 return;
 623         }




 583         }
 584 
 585 
 586         /*
 587          * If we're still booting and init(1) isn't set up yet, simply halt.
 588          */
 589         mutex_enter(&pidlock);
 590         initpp = prfind(P_INITPID);
 591         mutex_exit(&pidlock);
 592         if (initpp == NULL) {
 593                 extern void halt(char *);
 594                 halt("Power off the System");   /* just in case */
 595         }
 596 
 597         /*
 598          * else, graceful shutdown with inittab and all getting involved
 599          */
 600         psignal(initpp, SIGPWR);
 601 
 602         (void) timeout(xen_dirty_shutdown, arg,
 603             drv_sectohz(SHUTDOWN_TIMEOUT_SECS));
 604 }
 605 
 606 /*ARGSUSED*/
 607 static void
 608 xen_shutdown_handler(struct xenbus_watch *watch, const char **vec,
 609         unsigned int len)
 610 {
 611         char *str;
 612         xenbus_transaction_t xbt;
 613         int err, shutdown_code = SHUTDOWN_INVALID;
 614         unsigned int slen;
 615 
 616 again:
 617         err = xenbus_transaction_start(&xbt);
 618         if (err)
 619                 return;
 620         if (xenbus_read(xbt, "control", "shutdown", (void *)&str, &slen)) {
 621                 (void) xenbus_transaction_end(xbt, 1);
 622                 return;
 623         }