783 break;
784 }
785
786 /*
787 * If we're still booting and init(1) isn't set up yet, simply halt.
788 */
789 mutex_enter(&pidlock);
790 initpp = prfind(P_INITPID);
791 mutex_exit(&pidlock);
792 if (initpp == NULL) {
793 extern void halt(char *);
794 halt("Power off the System"); /* just in case */
795 }
796
797 /*
798 * else, graceful shutdown with inittab and all getting involved
799 */
800 psignal(initpp, SIGPWR);
801
802 (void) timeout(xen_dirty_shutdown, arg,
803 SHUTDOWN_TIMEOUT_SECS * drv_usectohz(MICROSEC));
804 }
805
806 /*ARGSUSED*/
807 static void
808 xen_shutdown_handler(struct xenbus_watch *watch, const char **vec,
809 unsigned int len)
810 {
811 char *str;
812 xenbus_transaction_t xbt;
813 int err, shutdown_code = SHUTDOWN_INVALID;
814 unsigned int slen;
815
816 again:
817 err = xenbus_transaction_start(&xbt);
818 if (err)
819 return;
820 if (xenbus_read(xbt, "control", "shutdown", (void *)&str, &slen)) {
821 (void) xenbus_transaction_end(xbt, 1);
822 return;
823 }
|
783 break;
784 }
785
786 /*
787 * If we're still booting and init(1) isn't set up yet, simply halt.
788 */
789 mutex_enter(&pidlock);
790 initpp = prfind(P_INITPID);
791 mutex_exit(&pidlock);
792 if (initpp == NULL) {
793 extern void halt(char *);
794 halt("Power off the System"); /* just in case */
795 }
796
797 /*
798 * else, graceful shutdown with inittab and all getting involved
799 */
800 psignal(initpp, SIGPWR);
801
802 (void) timeout(xen_dirty_shutdown, arg,
803 drv_sectohz(SHUTDOWN_TIMEOUT_SECS));
804 }
805
806 /*ARGSUSED*/
807 static void
808 xen_shutdown_handler(struct xenbus_watch *watch, const char **vec,
809 unsigned int len)
810 {
811 char *str;
812 xenbus_transaction_t xbt;
813 int err, shutdown_code = SHUTDOWN_INVALID;
814 unsigned int slen;
815
816 again:
817 err = xenbus_transaction_start(&xbt);
818 if (err)
819 return;
820 if (xenbus_read(xbt, "control", "shutdown", (void *)&str, &slen)) {
821 (void) xenbus_transaction_end(xbt, 1);
822 return;
823 }
|