Open System Services System Calls Reference Manual (G06.29+, H06.08+, J06.03+)

tdm_execve(2) OSS System Calls Reference Manual
Executing a Binary File
If the file specified as the new process image file is a binary executable file, the tdm_execve()
function loads the file directly.
Executing a Text File
If the file specified as the new process image file is not a binary executable file, the
tdm_execve() function examines the file to determine whether it is an executable text file. It
checks for a header line in this format:
#! interpreter_name [optional_string]
The #! notation identifies the file as an executable text file. The new process image filename is
constructed from the process image filename in the interpreter_name string, treating it like the
path 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 file.
The arguments passed to the new process are modified as listed:
argv[0] is set to the name of the command interpreter.
If the optional_string portion is present, argv[1] is set to optional_string.
The next element of argv[]is set to the original value of path.
The remaining elements of argv[]are set to the original elements of argv[], starting with
argv[1]. The original argv[0] is discarded.
The S_ISUID and S_ISGID mode bits of an executable text file are honored. Those bits are
ignored for the interpreter_name command interpreter.
When the File Is Invalid
If the process image file is not a valid executable object, or if the text file does not contain the
header line, the tdm_execve() function returns and sets errno to [ENOEXEC].
Open Files
File descriptors open in the calling process image remain open in the new process image, except
for those:
Whose close-on-exec flag FD_CLOEXEC is set (see the fcntl(2) reference page)
Opened using a Guardian function or procedure call
For a G-series TNS process image or an accelerated process image only, if the process file seg-
ment (PFS) of the new process image is smaller than the process file segment of the calling pro-
cess image and if the calling process image has a large number of file descriptors open, the sys-
tem might not be able to propagate all the open file descriptors to the new process image. When
this situation occurs, the function call fails, and errno is set to the value of [EMFILE].
For those file descriptors that remain open, all attributes of the open file descriptor, including file
locks, remain unchanged. All directory streams are closed.
Open Pipes and FIFOs
A pipe or FIFO associated with an open file descriptor in the calling process remains connected
in the new process. If the new process runs in a different processor than the calling process, the
processor that runs the new process must also be running an OSS pipe server process.
If no OSS pipe server process is running in the new processor, the new process cannot use the
pipe or FIFO; calls specifying the file descriptor for the pipe or FIFO fail with errno set to
[EWRONGID]. The new process can only close the invalid file descriptor.
84 Hewlett-Packard Company 527186-023