COHERENT manpages
This page displays the COHERENT manpage for execution [Definition].
List of available manpages
Index
execution -- Definition Program execution under COHERENT is governed by the various forms of the COHERENT system call exec(). This call allows a process to execute another executable file (or load module). This is described in coff.h. The code, data and stack of file replace those of the requesting process. The new stack contains the command arguments and its environment, in the format given below. Execution starts at the entry point of file. During a successful call to exec(), the system deactivates profiling, and resets any caught signals to SIG_DFL. Every process has a real-user id, an effective-user id, a saved-effective user id; and a real-group id, an effective-group id, and a saved-effective group id. These identifiers are defined in the Lexicon entries for, respectively, setuid() and setgid(). For most load modules, exec() does not change any of these. However, if the file is marked with the set user id or set group id bit (see stat()), exec() sets the effective-user id (effective-group id) of the process to the user id (group id) of the file owner. In effect, this changes the file access privilege level from that of the real id to that of the effective id. The owner of file should be careful to limit its abilities, to avoid compromising file security. exec() initializes the new stack of the process to contain a list of strings, which are command arguments. execl(), execle(), execlp(), and execlpe() specify arguments individually, as a NULL-terminated list of arg parameters. execv(), execve(), execvp(), and execvpe() specify arguments as a single NULL-terminated array argv of parameters. The main() function of a C program is invoked in the following way: main(argc, argv, envp) int argc; char *argv[], *envp[]; argc is the number of command arguments passed through exec(), and argv is an array of the actual argument strings. envp is an array of strings that comprise the process environment. By convention, these strings are of the form variable=value, as described in the Lexicon entry environ. Typically, each variable is an exported shell variable with the given value. execl() and execv() simply pass the old environment, referenced by the external pointer environ. execle(), execlpe(), execve(), and execvpe() pass a new environment env explicitly. execlp(), execlpe(), execvp(), and execvpe() search for file in each of the directories indicated by the shell variable $PATH, in the same way that the shell searches for a command. These calls execute a shell command file. Note that execlpe() and execvpe() search the current PATH, not the PATH contained within the environment pointed to by env. Files /bin/sh -- To execute command files See Also environ, exec(), execl(), execle(), execlp(), execlpe(), execv(), execve(), execvp(), execvpe(), fork(), ioctl(), Programming COHERENT, signal(), stat(), xargs Diagnostics None of the exec() routines returns if successful. Each returns -1 for an error, such as if file does not exist, is not accessible with execute permission, has a bad format, or is too large to fit in memory. Notes Each exec() routine now examines the beginning of an executable file for the token #!. If found, it invokes the program named on that line and passes it the rest of the file. For example, if you wish to ensure that a given script is executed by the by the Bourne shell /bin/sh, begin the script with the line: #!/bin/sh