equal
deleted
inserted
replaced
1 /* |
1 /* |
2 * CDDL HEADER START |
2 * CDDL HEADER START |
3 * |
3 * |
4 * The contents of this file are subject to the terms of the |
4 * The contents of this file are subject to the terms of the |
5 * Common Development and Distribution License, Version 1.0 only |
5 * Common Development and Distribution License (the "License"). |
6 * (the "License"). You may not use this file except in compliance |
6 * You may not use this file except in compliance with the License. |
7 * with the License. |
|
8 * |
7 * |
9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE |
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE |
10 * or http://www.opensolaris.org/os/licensing. |
9 * or http://www.opensolaris.org/os/licensing. |
11 * See the License for the specific language governing permissions |
10 * See the License for the specific language governing permissions |
12 * and limitations under the License. |
11 * and limitations under the License. |
17 * fields enclosed by brackets "[]" replaced with your own identifying |
16 * fields enclosed by brackets "[]" replaced with your own identifying |
18 * information: Portions Copyright [yyyy] [name of copyright owner] |
17 * information: Portions Copyright [yyyy] [name of copyright owner] |
19 * |
18 * |
20 * CDDL HEADER END |
19 * CDDL HEADER END |
21 */ |
20 */ |
|
21 |
22 /* |
22 /* |
23 * Copyright 2005 Sun Microsystems, Inc. All rights reserved. |
23 * Copyright 2006 Sun Microsystems, Inc. All rights reserved. |
24 * Use is subject to license terms. |
24 * Use is subject to license terms. |
25 */ |
25 */ |
26 |
26 |
27 #pragma ident "%Z%%M% %I% %E% SMI" |
27 #pragma ident "%Z%%M% %I% %E% SMI" |
28 |
28 |
679 rval = zone_bootup(zlogp, zargp->bootbuf); |
679 rval = zone_bootup(zlogp, zargp->bootbuf); |
680 audit_put_record(zlogp, uc, rval, "boot"); |
680 audit_put_record(zlogp, uc, rval, "boot"); |
681 if (rval != 0) { |
681 if (rval != 0) { |
682 bringup_failure_recovery = B_TRUE; |
682 bringup_failure_recovery = B_TRUE; |
683 (void) zone_halt(zlogp, B_FALSE); |
683 (void) zone_halt(zlogp, B_FALSE); |
|
684 eventstream_write(Z_EVT_ZONE_BOOTFAILED); |
684 } |
685 } |
685 break; |
686 break; |
686 case Z_HALT: |
687 case Z_HALT: |
687 if (kernelcall) /* Invalid; can't happen */ |
688 if (kernelcall) /* Invalid; can't happen */ |
688 abort(); |
689 abort(); |
714 break; |
715 break; |
715 case Z_MOUNT: |
716 case Z_MOUNT: |
716 if (kernelcall) /* Invalid; can't happen */ |
717 if (kernelcall) /* Invalid; can't happen */ |
717 abort(); |
718 abort(); |
718 rval = zone_ready(zlogp, B_TRUE); |
719 rval = zone_ready(zlogp, B_TRUE); |
719 if (rval == 0) |
720 if (rval == 0) { |
|
721 eventstream_write(Z_EVT_ZONE_READIED); |
720 rval = zone_mount_early(zlogp, zone_id); |
722 rval = zone_mount_early(zlogp, zone_id); |
|
723 } |
|
724 |
721 /* |
725 /* |
722 * Ordinarily, /dev/fd would be mounted inside the zone |
726 * Ordinarily, /dev/fd would be mounted inside the zone |
723 * by svc:/system/filesystem/usr:default, but since |
727 * by svc:/system/filesystem/usr:default, but since |
724 * we're not booting the zone, we need to do this |
728 * we're not booting the zone, we need to do this |
725 * manually. |
729 * manually. |
754 rval = zone_bootup(zlogp, zargp->bootbuf); |
758 rval = zone_bootup(zlogp, zargp->bootbuf); |
755 audit_put_record(zlogp, uc, rval, "boot"); |
759 audit_put_record(zlogp, uc, rval, "boot"); |
756 if (rval != 0) { |
760 if (rval != 0) { |
757 bringup_failure_recovery = B_TRUE; |
761 bringup_failure_recovery = B_TRUE; |
758 (void) zone_halt(zlogp, B_FALSE); |
762 (void) zone_halt(zlogp, B_FALSE); |
|
763 eventstream_write(Z_EVT_ZONE_BOOTFAILED); |
759 } |
764 } |
760 break; |
765 break; |
761 case Z_HALT: |
766 case Z_HALT: |
762 if (kernelcall) /* Invalid; can't happen */ |
767 if (kernelcall) /* Invalid; can't happen */ |
763 abort(); |
768 abort(); |
783 switch (cmd) { |
788 switch (cmd) { |
784 case Z_UNMOUNT: |
789 case Z_UNMOUNT: |
785 if (kernelcall) /* Invalid; can't happen */ |
790 if (kernelcall) /* Invalid; can't happen */ |
786 abort(); |
791 abort(); |
787 rval = zone_halt(zlogp, B_TRUE); |
792 rval = zone_halt(zlogp, B_TRUE); |
788 if (rval == 0) |
793 if (rval == 0) { |
|
794 eventstream_write(Z_EVT_ZONE_HALTED); |
789 (void) sema_post(&scratch_sem); |
795 (void) sema_post(&scratch_sem); |
|
796 } |
790 break; |
797 break; |
791 default: |
798 default: |
792 if (kernelcall) /* Invalid; can't happen */ |
799 if (kernelcall) /* Invalid; can't happen */ |
793 abort(); |
800 abort(); |
794 zerror(zlogp, B_FALSE, "%s operation is invalid " |
801 zerror(zlogp, B_FALSE, "%s operation is invalid " |
806 case Z_READY: |
813 case Z_READY: |
807 if ((rval = zone_halt(zlogp, B_FALSE)) != 0) |
814 if ((rval = zone_halt(zlogp, B_FALSE)) != 0) |
808 break; |
815 break; |
809 if ((rval = zone_ready(zlogp, B_FALSE)) == 0) |
816 if ((rval = zone_ready(zlogp, B_FALSE)) == 0) |
810 eventstream_write(Z_EVT_ZONE_READIED); |
817 eventstream_write(Z_EVT_ZONE_READIED); |
|
818 else |
|
819 eventstream_write(Z_EVT_ZONE_HALTED); |
811 break; |
820 break; |
812 case Z_BOOT: |
821 case Z_BOOT: |
813 /* |
822 /* |
814 * We could have two clients racing to boot this |
823 * We could have two clients racing to boot this |
815 * zone; the second client loses, but his request |
824 * zone; the second client loses, but his request |
824 break; |
833 break; |
825 eventstream_write(Z_EVT_ZONE_HALTED); |
834 eventstream_write(Z_EVT_ZONE_HALTED); |
826 break; |
835 break; |
827 case Z_REBOOT: |
836 case Z_REBOOT: |
828 eventstream_write(Z_EVT_ZONE_REBOOTING); |
837 eventstream_write(Z_EVT_ZONE_REBOOTING); |
829 if ((rval = zone_halt(zlogp, B_FALSE)) != 0) |
838 if ((rval = zone_halt(zlogp, B_FALSE)) != 0) { |
|
839 eventstream_write(Z_EVT_ZONE_BOOTFAILED); |
830 break; |
840 break; |
831 if ((rval = zone_ready(zlogp, B_FALSE)) == 0) { |
841 } |
832 rval = zone_bootup(zlogp, ""); |
842 if ((rval = zone_ready(zlogp, B_FALSE)) != 0) { |
833 audit_put_record(zlogp, uc, rval, "reboot"); |
843 eventstream_write(Z_EVT_ZONE_BOOTFAILED); |
834 if (rval != 0) |
844 break; |
835 (void) zone_halt(zlogp, B_FALSE); |
845 } |
|
846 rval = zone_bootup(zlogp, ""); |
|
847 audit_put_record(zlogp, uc, rval, "reboot"); |
|
848 if (rval != 0) { |
|
849 (void) zone_halt(zlogp, B_FALSE); |
|
850 eventstream_write(Z_EVT_ZONE_BOOTFAILED); |
836 } |
851 } |
837 break; |
852 break; |
838 case Z_NOTE_UNINSTALLING: |
853 case Z_NOTE_UNINSTALLING: |
839 case Z_MOUNT: |
854 case Z_MOUNT: |
840 case Z_UNMOUNT: |
855 case Z_UNMOUNT: |