1*10052SGangadhar.M@Sun.COM /* 2*10052SGangadhar.M@Sun.COM * CDDL HEADER START 3*10052SGangadhar.M@Sun.COM * 4*10052SGangadhar.M@Sun.COM * The contents of this file are subject to the terms of the 5*10052SGangadhar.M@Sun.COM * Common Development and Distribution License (the "License"). 6*10052SGangadhar.M@Sun.COM * You may not use this file except in compliance with the License. 7*10052SGangadhar.M@Sun.COM * 8*10052SGangadhar.M@Sun.COM * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9*10052SGangadhar.M@Sun.COM * or http://www.opensolaris.org/os/licensing. 10*10052SGangadhar.M@Sun.COM * See the License for the specific language governing permissions 11*10052SGangadhar.M@Sun.COM * and limitations under the License. 12*10052SGangadhar.M@Sun.COM * 13*10052SGangadhar.M@Sun.COM * When distributing Covered Code, include this CDDL HEADER in each 14*10052SGangadhar.M@Sun.COM * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15*10052SGangadhar.M@Sun.COM * If applicable, add the following below this CDDL HEADER, with the 16*10052SGangadhar.M@Sun.COM * fields enclosed by brackets "[]" replaced with your own identifying 17*10052SGangadhar.M@Sun.COM * information: Portions Copyright [yyyy] [name of copyright owner] 18*10052SGangadhar.M@Sun.COM * 19*10052SGangadhar.M@Sun.COM * CDDL HEADER END 20*10052SGangadhar.M@Sun.COM */ 21*10052SGangadhar.M@Sun.COM /* 22*10052SGangadhar.M@Sun.COM * Copyright 2009 Sun Microsystems, Inc. All rights reserved. 23*10052SGangadhar.M@Sun.COM * Use is subject to license terms. 24*10052SGangadhar.M@Sun.COM */ 25*10052SGangadhar.M@Sun.COM 26*10052SGangadhar.M@Sun.COM #include <sys/types.h> 27*10052SGangadhar.M@Sun.COM #include <libscf.h> 28*10052SGangadhar.M@Sun.COM #include <sys/uadmin.h> 29*10052SGangadhar.M@Sun.COM #include <unistd.h> 30*10052SGangadhar.M@Sun.COM #include <stdlib.h> 31*10052SGangadhar.M@Sun.COM #include <zone.h> 32*10052SGangadhar.M@Sun.COM 33*10052SGangadhar.M@Sun.COM int 34*10052SGangadhar.M@Sun.COM uadmin(int cmd, int fcn, uintptr_t mdep) 35*10052SGangadhar.M@Sun.COM { 36*10052SGangadhar.M@Sun.COM extern int __uadmin(int cmd, int fcn, uintptr_t mdep); 37*10052SGangadhar.M@Sun.COM scf_simple_prop_t *prop = NULL; 38*10052SGangadhar.M@Sun.COM uint8_t *ret_val = NULL; 39*10052SGangadhar.M@Sun.COM boolean_t update_flag = B_FALSE; 40*10052SGangadhar.M@Sun.COM char *fmri = "svc:/system/boot-config:default"; 41*10052SGangadhar.M@Sun.COM 42*10052SGangadhar.M@Sun.COM if (geteuid() == 0 && getzoneid() == GLOBAL_ZONEID && 43*10052SGangadhar.M@Sun.COM (cmd == A_SHUTDOWN || cmd == A_REBOOT)) { 44*10052SGangadhar.M@Sun.COM prop = scf_simple_prop_get(NULL, fmri, "config", 45*10052SGangadhar.M@Sun.COM "uadmin_boot_archive_sync"); 46*10052SGangadhar.M@Sun.COM if (prop) { 47*10052SGangadhar.M@Sun.COM if ((ret_val = scf_simple_prop_next_boolean(prop)) != 48*10052SGangadhar.M@Sun.COM NULL) 49*10052SGangadhar.M@Sun.COM update_flag = (*ret_val == 0) ? B_FALSE : 50*10052SGangadhar.M@Sun.COM B_TRUE; 51*10052SGangadhar.M@Sun.COM scf_simple_prop_free(prop); 52*10052SGangadhar.M@Sun.COM } 53*10052SGangadhar.M@Sun.COM 54*10052SGangadhar.M@Sun.COM if (update_flag == B_TRUE) 55*10052SGangadhar.M@Sun.COM (void) system("/sbin/bootadm update-archive"); 56*10052SGangadhar.M@Sun.COM } 57*10052SGangadhar.M@Sun.COM 58*10052SGangadhar.M@Sun.COM return (__uadmin(cmd, fcn, mdep)); 59*10052SGangadhar.M@Sun.COM } 60