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) 1998, 2010, Oracle and/or its affiliates. All rights reserved. 2N/A * This is a utility routine to allow wrapper programs to simply 2N/A * implement the isalist exec algorithms. See PSARC/1997/220. 2N/A * Extract the isalist(5) for userland from the kernel. 2N/A * Then either a malloc or a realloc failed. 2N/A * Allocate a full pathname buffer. The sum of the lengths of the 2N/A * 'path' and isalist strings is guaranteed to be big enough. 2N/A * Break the exec name into directory and file name components. 2N/A * For each name in the isa list, look for an executable file 2N/A * with the given file name in the corresponding subdirectory. 2N/A * If it's there, exec it. If it's not there, or the exec 2N/A * fails, then run the next version .. 2N/A * File exists and is open for O_EXEC. Attempt 2N/A * to execute the file from the subdirectory, 2N/A * using the user-supplied argv and envp. 2N/A * Retain the current name of the process 2N/A * (so shell scripts retain their own names 2N/A * and don't become, for example, "ksh93"). 2N/A * If we failed to exec because of a temporary 2N/A * resource shortage, it's better to let our 2N/A * caller handle it (free memory, sleep for a while, 2N/A * or whatever before retrying) rather than drive 2N/A * on to run the "less capable" version.