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) 2010, Oracle and/or its affiliates. All rights reserved. 2N/A * This program aids the Solaris 10 patch tools (specifically 2N/A * Whenever the patch tools replace a critical system component (e.g., 2N/A * move the new component to where the old component was, and establish 2N/A * an overlay mount of the old component on top of the new component. 2N/A * The patch tools do this with a shell script; consequently, the three 2N/A * operations occur in three processes. 2N/A * This doesn't work inside Solaris 10 Containers (S10Cs). Suppose the 2N/A * libc.so.1 to a temporary location. But when they try to move the new 2N/A * libc.so.1, they fork a mv(1) process, which loads the solaris10 brand's 2N/A * emulation library. The emulation library will try to load the zone's 2N/A * libc.so.1, but the library no longer exists; consequently, the emulation 2N/A * library aborts and the zone's users won't be able to start any processes. 2N/A * This program solves the problem by combining the move and mount operations 2N/A * into a single process. The emulation library will already have loaded 2N/A * libc.so.1 for the process by the time the process starts to replace 2N/A * This program takes six parameters that correspond to six variables within 2N/A * argv[1] - dstActual (the path to the file that will be replaced) 2N/A * argv[2] - tmp_file (the temporary location to which the file will be 2N/A * argv[3] - tmpDst (the path to the replacement file) 2N/A * argv[4] - tmpFile (the path to a temporary copy of the running system's 2N/A * version of the file being replaced; the source [special] of 2N/A * the overlay mount) 2N/A * argv[5] - cksumTmpDst (checksum of the file represented by tmpDst) 2N/A * argv[6] - cksumTmpFile (checksum of the file represented by tmpFile) 2N/A * NOTE: This program will only establish an overlay mount if argv[4] or argv[5] 2N/A * is emtpy or if argv[4] and argv[5] differ. 2N/A * This program returns zero when it succeeds. Non-negative values indicate 2N/A * Check the number of arguments that were passed to s10_replacefile. 2N/A "tmpFile cksumTmpDst cksumTmpFile\n",
argv[0]);
2N/A * Move the destination file (dstActual) out of the way and move the 2N/A * new file (tmpDst) into its place. 2N/A * NOTE: s10_replacefile won't print error messages here because 2N/A * the Solaris 10 patch tools will. 2N/A * If there was a lofs mount on dstActual (which we just moved), then 2N/A * s10_replacefile should reestablish the lofs mount. A lofs mount 2N/A * existed if tmpFile exists. 2N/A * Create a lofs overlay mount only if the checksums of the 2N/A * old file at dstActual and the new file at dstActual differ. 2N/A * Although the patch tools will print error 2N/A * messages, the tools won't know that 2N/A * s10_replacefile failed to establish an 2N/A * overlay mount. Printing an error message 2N/A * here clarifies the problem for the user. 2N/A "overlay mount %s onto %s\n",
argv[
4],
2N/A * dstActual does not need an overlay mount. Delete