Open System Services System Calls Reference Manual (G06.25+, H06.03+)

tdm_spawnp(2) OSS System Calls Reference Manual
When a program is executed as a result of a tdm_spawnp() call, it is entered as a function call:
int main(
int argc,
char argv[],
char envp);
Here, the argc parameter is the argument count, the argv[]parameter is an array of character
pointers to the arguments themselves, and the envp parameter is a pointer to a character array
listing the environment variables. The argv[]array is terminated by a null pointer. The null
pointer is not counted in argc.
The arguments specied by a program using the tdm_spawnp() function are passed on to the
new process image in the corresponding arguments to the
main() function.
Use From the Guardian Environment
If called from a Guardian process, the actions of this function are undened, and errno is set to
[ENOTOSS].
Identifying the Process Image File
The tdm_spawnp() function uses the le parameter to identify the process image le. If the
pathname pointed to by the le parameter starts with a slash ( / ) character, it is the absolute path-
name. If the pathname does not start with a slash but contains a slash, the pathname is resolved
relative to the current working directory. Otherwise, the pathname does not contain a slash; the
system searches the directories listed in the PATH environment variable for the le and prexes
the directory in which the le is found.
Passing the Arguments
The argv[]parameter is an array of character pointers to null-terminated strings. The last
member of this array is a null pointer. These strings constitute the argument list available to the
new process image. The value in argv[0] should point to a lename that is associated with the
process being started by the tdm_spawnp() function.
Specifying the Environment
The envp[]parameter is an array of character pointers to null-terminated strings. These strings
constitute the environment for the new process image. The environment array is terminated with
a null pointer.
The number of bytes available for the new processs combined argument and environment lists
has a system-imposed limit. This limit, which includes the pointers and the null terminators on
the strings, is available by calling the sysconf(_SC_ARG_MAX) function.
Executing a Binary File
If the le specied as the new process image le is a binary executable le, the tdm_spawnp()
function loads the le directly.
Executing a Text File
If the le specied as the new process image le is not a binary executable le, the
tdm_spawnp() function examines the le to determine whether it is an executable text le. It
checks for a header line in this format:
#! interpreter_name [optional_string]
The #! notation identies the le as an executable text le. The new process image lename is
constructed from the process image lename in the interpreter_name string, treating it like the
le parameter. The Guardian input and output structures pointed to by the pe_parms and
pr_results parameters apply to the command interpreter as they would to any process le.
The arguments passed to the new process are modied as listed:
858 Hewlett-Packard Company 527186-003