s10_support.c revision 2
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. */ * Check to see whether the zone has any unsupported devices * The audio framework has changed in Solaris Next as compared to * S10. Data indicates the less than 1/10 of 1 percent of zones * are using /dev/sound. Given the low usage vs. the effort to * provide emulation, /dev/sound is currently disallowed. We can * revisit this if there is enough demand. * Read an entry from a pkginfo file. Some of these lines can * either be arbitrarily long or be continued by a backslash at the end of * the line. This function coalesces lines that are longer than the read * buffer, and lines that are continued, into one buffer which is returned. * The caller must free this memory. NULL is returned when we hit EOF or * if we run out of memory (errno is set to ENOMEM). * Read the SUNWcakr pkginfo file and get the PATCHLIST for the pkg. /* remove trailing newline */ * Verify that we have the minimum KU needed, which is the s10u9 KU. * Note that KU patches are accumulative so future KUs will still deliver * If the zone was installed to bypass sanity checking for internal * testing purposes, just return success. * Convert the specified file basename into an unsigned integer. If the * basename contains characters that cannot be converted into digits or the * basename isn't NULL or newline-terminated, then this function returns * the unsigned equivalent of -1. return ((
unsigned int)-
1);
* representing the results. Associate the bitmap with the zone so that * the brand's emulation library will be able to retrieve the bitmap and * determine how the zone's process' behaviors should be emulated. * This function does not return if an error occurs. * If the Solaris 10 directory containing emulation feature files * doesn't exist in the zone, then assume that it only needs the * most basic emulation and, therefore, doesn't need a bitmap. * Iterate over the contents of the directory and determine which * features the brand should emulate for this zone. * Convert the file's name to an unsigned integer. Ignore * files whose names aren't unsigned integers. * Determine if the brand can emulate the feature specified * The zone requires emulation that the brand can't * provide. Notify the user by displaying an error "incompatible with the\ncurrent version of the " "solaris10 brand.\nPlease update your Solaris " "system to the latest release."));
* Set the feature's flag in the bitmap. * The zone's administrator might have removed a patch that delivered * an emulation feature file the last time the zone ran. If so, then * the zone's patch utilities won't delete the file until the zone's * problematic because the zone will be using system libraries whose * ioctl structures and syscall invocations will differ from those * expected by the emulation library. For example, if an administrator * removes a patch that affects the formats of MNTFS ioctls, then the * administrator's zone will use a version of libc.so.1 that issues * MNTFS ioctls that use older structure versions than the zone's * emulation library will expect. * Fortunately, the patchrm utility creates a hidden file, * this file exists in the zone and disable the emulation bits * associated with the emulation feature files that will be deleted. * NOTE: The patch tools lofs mount backup copies of critical system * libraries, such as /lib/libc.so.1, over their replacements whenever * administrators add or remove DAP patches. Consequently, there isn't * a window of vulnerability between patch addition or removal and * zone reboot. The aforementioned problem only occurs after a zone * Make sure that the file is in the directory * containing emulation feature files. If it is, * then basenamep should refer to the basename of * Convert the file's basename into a bit index in * the emulation bitmap. If the file's basename isn't * integral, then skip the file. Otherwise, clear the * corresponding bit in the bitmap. * The delete list exists but couldn't be opened. Warn the * We're done scanning files. Set the zone's emulation bitmap. "The installed version of Solaris 10 is not supported.\n" "SPARC systems require patch 142909-17\n" "x86/x64 systems require patch 142910-17"));
"usage:\t%s verify <xml file>\n" * XXX This is a temporary env variable for the initial release to * enable the use of features which are not yet tested or fully