Copyright 1989 AT&T Copyright (c) 1998, Sun Microsystems, Inc. All Rights Reserved
The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License.
You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License.
When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
#include <unistd.h> int isaexec(const char *path, char *const argv[], char *const envp[]);
The isaexec() function takes the path specified as path and breaks it into directory and file name components. It enquires from the running system the list of supported instruction set architectures; see isalist(7). The function traverses the list for an executable file in named subdirectories of the original directory. When such a file is located, execve() is invoked with argv[\|] and envp[\|]. See exec(2).
If no file is located, isaexec() returns ENOENT. Other return values are the same as for execve().
Example 1 Example of isaexec() function.
On a system whose isalist is
sparcv7 sparc
the program
int main(int argc, char *argv[], char *envp[]) { return (isaexec("/bin/thing", argv, envp)); }
will look first for an executable file named /bin/sparcv7/thing, then for an executable file named /bin/sparc/thing. It will invoke execve() on the first executable file it finds named thing.
On that same system, a program called /u/bin/tofu can cause either /u/bin/sparcv7/tofu or /u/bin/sparc/tofu to be invoked using the following code:
int main(int argc, char *argv[], char *envp[]) { return (isaexec(getexecname(), argv, envp)); }
See attributes(7) for descriptions of the following attributes:
ATTRIBUTE TYPE ATTRIBUTE VALUE |
MT-Level Safe |
Interface Stability Stable |
exec (2), getexecname (3C), attributes (7), isalist (7)