2N/A * The contents of this file are subject to the terms of the 2N/A * Common Development and Distribution License (the "License"). 2N/A * You may not use this file except in compliance with the License. 2N/A * See the License for the specific language governing permissions 2N/A * and limitations under the License. 2N/A * When distributing Covered Code, include this CDDL HEADER in each 2N/A * If applicable, add the following below this CDDL HEADER, with the 2N/A * fields enclosed by brackets "[]" replaced with your own identifying 2N/A * information: Portions Copyright [yyyy] [name of copyright owner] 2N/A * Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved. 2N/A * s10_support is a small cli utility used to perform some brand-specific 2N/A * tasks when verifying a zone. This utility is not intended to be called 2N/A * by users - it is intended to be invoked by the zones utilities. 2N/A * XXX This is a temporary flag for the initial release to enable the 2N/A * use of features which are not yet tested or fully implemented. 2N/A * DELETE_LIST_PATH represents the path to a solaris10-branded zone's "delete 2N/A * list", which is generated by patchrm when it needs to remove files after 2N/A * the zone reboots. See set_zone_emul_bitmap() below for additional details. 2N/A /* This needs go to stdout so the msgs show up through zoneadm. */ 2N/A * Check to see whether the zone has any unsupported devices 2N/A * The audio framework has changed in Solaris Next as compared to 2N/A * S10. Data indicates the less than 1/10 of 1 percent of zones 2N/A * are using /dev/sound. Given the low usage vs. the effort to 2N/A * provide emulation, /dev/sound is currently disallowed. We can 2N/A * revisit this if there is enough demand. 2N/A * Read an entry from a pkginfo file. Some of these lines can 2N/A * either be arbitrarily long or be continued by a backslash at the end of 2N/A * the line. This function coalesces lines that are longer than the read 2N/A * buffer, and lines that are continued, into one buffer which is returned. 2N/A * The caller must free this memory. NULL is returned when we hit EOF or 2N/A * if we run out of memory (errno is set to ENOMEM). 2N/A * Read the SUNWcakr pkginfo file and get the PATCHLIST for the pkg. 2N/A /* remove trailing newline */ 2N/A * Verify that we have the minimum KU needed, which is the s10u9 KU. 2N/A * Note that KU patches are accumulative so future KUs will still deliver 2N/A * If the zone was installed to bypass sanity checking for internal 2N/A * testing purposes, just return success. 2N/A * Convert the specified file basename into an unsigned integer. If the 2N/A * basename contains characters that cannot be converted into digits or the 2N/A * basename isn't NULL or newline-terminated, then this function returns 2N/A * the unsigned equivalent of -1. 2N/A return ((
unsigned int)-
1);
2N/A * representing the results. Associate the bitmap with the zone so that 2N/A * the brand's emulation library will be able to retrieve the bitmap and 2N/A * determine how the zone's process' behaviors should be emulated. 2N/A * This function does not return if an error occurs. 2N/A * If the Solaris 10 directory containing emulation feature files 2N/A * doesn't exist in the zone, then assume that it only needs the 2N/A * most basic emulation and, therefore, doesn't need a bitmap. 2N/A * Iterate over the contents of the directory and determine which 2N/A * features the brand should emulate for this zone. 2N/A * Convert the file's name to an unsigned integer. Ignore 2N/A * files whose names aren't unsigned integers. 2N/A * Determine if the brand can emulate the feature specified 2N/A * The zone requires emulation that the brand can't 2N/A * provide. Notify the user by displaying an error 2N/A "incompatible with the\ncurrent version of the " 2N/A "solaris10 brand.\nPlease update your Solaris " 2N/A "system to the latest release."));
2N/A * Set the feature's flag in the bitmap. 2N/A * The zone's administrator might have removed a patch that delivered 2N/A * an emulation feature file the last time the zone ran. If so, then 2N/A * the zone's patch utilities won't delete the file until the zone's 2N/A * problematic because the zone will be using system libraries whose 2N/A * ioctl structures and syscall invocations will differ from those 2N/A * expected by the emulation library. For example, if an administrator 2N/A * removes a patch that affects the formats of MNTFS ioctls, then the 2N/A * administrator's zone will use a version of libc.so.1 that issues 2N/A * MNTFS ioctls that use older structure versions than the zone's 2N/A * emulation library will expect. 2N/A * Fortunately, the patchrm utility creates a hidden file, 2N/A * this file exists in the zone and disable the emulation bits 2N/A * associated with the emulation feature files that will be deleted. 2N/A * NOTE: The patch tools lofs mount backup copies of critical system 2N/A * administrators add or remove DAP patches. Consequently, there isn't 2N/A * a window of vulnerability between patch addition or removal and 2N/A * zone reboot. The aforementioned problem only occurs after a zone 2N/A * Make sure that the file is in the directory 2N/A * containing emulation feature files. If it is, 2N/A * then basenamep should refer to the basename of 2N/A * Convert the file's basename into a bit index in 2N/A * the emulation bitmap. If the file's basename isn't 2N/A * integral, then skip the file. Otherwise, clear the 2N/A * corresponding bit in the bitmap. 2N/A * The delete list exists but couldn't be opened. Warn the 2N/A * We're done scanning files. Set the zone's emulation bitmap. 2N/A "The installed version of Solaris 10 is not supported.\n" 2N/A "SPARC systems require patch 142909-17\n" 2N/A "usage:\t%s verify <xml file>\n" 2N/A * XXX This is a temporary env variable for the initial release to 2N/A * enable the use of features which are not yet tested or fully