|
|
1.1 root 1:
2:
3: execution Technical Information execution
4:
5:
6:
7:
8: Program execution under COHERENT is governed by the various forms
9: of the COHERENT system call exec. This call allows a process to
10: execute another executable file (load module, as described in
11: l.out.h). The code, data and stack of file replace those of the
12: requesting process. The new stack contains the command arguments
13: and its environment, in the format given below. Execution starts
14: at the entry point of file.
15:
16: During a successful exec, the system deactivates profiling, and
17: resets any caught signals to SIG_DFL.
18:
19: Every process has a real-user id, an effective-user id, a real-
20: group id, and an effective-group id, as described in getuid. For
21: most load modules, exec does not change any of these. However,
22: if the file is marked with the set user id or set group id bit
23: (see stat), exec sets the effective-user id (effective-group id)
24: of the process to the user id (group id) of the file owner. In
25: effect, this changes the file access privilege level from that of
26: the real id to that of the effective id. The owner of file
27: should be careful to limit its abilities, to avoid compromising
28: file security.
29:
30: exec initializes the new stack of the process to contain a list
31: of strings which are command arguments. execl, execle, and ex-
32: eclp specify arguments individually, as a NULL-terminated list of
33: arg parameters. execv, execve, and execvp specify arguments as a
34: single NULL-terminated array argv of parameters.
35:
36: The main routine of a C program is invoked in the following way:
37:
38:
39: main(argc, argv, envp)
40: int argc;
41: char *argv[], *envp[];
42:
43:
44: argc is the number of command arguments passed through exec, and
45: argv is an array of the actual argument strings. envp is an ar-
46: ray of strings that comprise the process environment. By conven-
47: tion, these strings are of the form variable=value, as described
48: in the Lexicon entry environ. Typically, each variable is an ex-
49: ported shell variable with the given value.
50:
51: execl and execv simply pass the old environment, referenced by
52: the external pointer environ. execle and execve pass a new en-
53: vironment env explicitly. execlp and execvp search for file in
54: each of the directories indicated by the shell variable $PATH, in
55: the same way that the shell searches for a command. These calls
56: will execute a shell command file.
57:
58: ***** Files *****
59:
60: /bbiinn/sshh -- To execute command files
61:
62:
63:
64: COHERENT Lexicon Page 1
65:
66:
67:
68:
69: execution Technical Information execution
70:
71:
72:
73: ***** See Also *****
74:
75: environ, execl(), execle(), execlp(), execv(), execve(), ex-
76: ecvp(), fork(), ioctl(), signal(), stat(), technical information
77:
78: ***** Diagnostics *****
79:
80: None of the exec routines returns if successful. Each returns -1
81: for errors, such as if file is nonexistent, not accessible with
82: execute permission, has a bad format, or is too large to fit in
83: memory.
84:
85:
86:
87:
88:
89:
90:
91:
92:
93:
94:
95:
96:
97:
98:
99:
100:
101:
102:
103:
104:
105:
106:
107:
108:
109:
110:
111:
112:
113:
114:
115:
116:
117:
118:
119:
120:
121:
122:
123:
124:
125:
126:
127:
128:
129:
130: COHERENT Lexicon Page 2
131:
132:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.