extern char **environ;
int execl(const char *path, const char *arg0, ..., const char *argn, (char *)0);
int execle(const char *path, const char *arg0, ..., const char *argn, (char *)0, char *const envp);
int execlp(const char *file, const char *arg0, ..., const char *argn, (char *)0);
int execlpe(const char *file, const char *arg0, ..., const char *argn, (char *)0, char *const envp);
int execv(const char *path, char *const argv);
int execve(const char *path, char *const argv, char *const envp);
int execvp(const char *file, char *const argv);
int execvpe(const char *file, char *const argv, char *const envp);
An interpreter script begins with a line of the form:
#! pathname [arg]
where pathname is the
path of the interpreter, and arg is an optional argument.
When an interpreter script is executed, the system executes the
The path name specified in the interpreter file is passed as
argv to the interpreter. If arg
was specified in the interpreter file, it is passed as argv
to the interpreter. The remaining arguments to the interpreter
are the arguments passed to the
When a C-language program is executed as a result of this call, it is entered as a C-language function as follows:
int main(int argc, char *argv);
where argc is the argument count and argv is an array of pointers to the arguments themselves. In addition, the global variable environ is initialized to point to an array of pointers to the environment strings. The argv and environ arrays are each terminated by a NULL pointer. The NULL pointer terminating the argv array is not counted in argc.
Conforming multi-threaded applications do not use the environ variable to access or modify any environment variable while any other thread is concurrently modifying any environment variable. A call to any function dependent on any environment variable is considered a use of environ.
The arguments specified by a program with an
The number of bytes available for combined argument and environment lists of the new process is specified by ARG_MAX. String terminators and alignment bytes are included in this total.
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. For those file descriptors that remain open, all attributes of the open file description, including file locks, remain unchanged.
Directory streams open in the calling process image are closed in the new process image.
For the new process, the equivalent of:
is executed at startup.
Signals set to the default action (SIG_DFL) in the calling process image are set to the default action in the new process image. Signals set to be ignored (SIG_IGN) by the calling process image are set to be ignored by the new process image. Signals set to be caught in the calling process image are set to the default action in the new process image.
No functions registered by
No shared memory or memory mapped segments attached to the calling process image are attached to the new process image.
At a minimum, the new process also inherits the following attributes from the calling process image:
- Process ID (see PORTING ISSUES)
- Parent process ID
- Process group ID
- Session membership
- Real user ID
- Real group ID
- Time left until an alarm clock signal
- Current working directory
- File mode creation mask
- Process signal mask
- Pending signals
- Process execution times, as returned by
- Semaphore adjustment values
- Controlling terminal.
- Interval timers
- nice value
A call to an
Specifies the path name of the new process image file.
Is used to construct a path name that identifies the new process image file. If it contains a slash character, the argument is used as the path name for this file. Otherwise, the path prefix for this file is obtained by a search of the directories in the environment variable PATH. If PATH is not set, the current directory is searched.
- arg0, ..., argn
Point to null-terminated character strings. These strings constitute the argument list for the new process image. The list is terminated by a NULL pointer. The argument arg0 should point to a file name that is associated with the process being started by the
Is the argument list for the new process image. This should contain an array of pointers to character strings, and the array should be terminated by a NULL pointer. The value in argv should point to a file name that is associated with the process being started by the
Specifies the environment for the new process image. This should contain an array of pointers to character strings, and the array should be terminated by a NULL pointer.
If successful, the
The number of bytes used by the new process image's argument list and environment list is greater than ARG_MAX bytes.
Search permission is denied for a directory listed in the new process image file's path prefix, or the new process image file denies execution permission, or the new process image file is not a regular file.
The length of path or file (or an element of $PATH prefixed to file) exceeds PATH_MAX, or a path name component is longer than NAME_MAX.
A component of path or file does not name an existing file, or path or file is an empty string.
The new process image file has the appropriate access permissions, but is not in the proper format.
The new process image requires more memory than is allowed by the hardware or system-imposed memory management constraints.
A component of the new process image file's path prefix is not a directory.
exec()function was called from a non-NuTCRACKER Platform process, other than from the child of a vfork()operation.
The NuTCRACKER Platform uses the Win32
You may not call an
The Windows file systems do not support set-user-ID and set-group-ID bits for files. Hence there is no support for automatically setting effective user and/or group IDs at process execution time.
If the process being executed is not a NuTCRACKER Platform process, only the standard file descriptors (0, 1, 2 - stdin, stdout, stderr) are available to the new process. However, if that process then invokes a NuTCRACKER Platform process, all inherited file descriptors are available to the grandchild NuTCRACKER Platform process.
You must ensure that any path name arguments you pass to non-NuTCRACKER Platform applications are in Win32 format, as only NuTCRACKER Platform applications recognize the NuTCRACKER Platform format. Refer to Path Names in the Windows Concepts chapter of the PTC MKS Toolkit UNIX to Windows Porting Guide for more information.
Priorities are inherited by new threads in the same way as on UNIX systems. Even the first thread created by a native Win32 process inherits priority in this manner. However, further creation of threads not under control of the NuTCRACKER Platform might revert to THREAD_PRIORITY_NORMAL.
PTC MKS Toolkit for Professional Developers
PTC MKS Toolkit for Enterprise Developers
PTC MKS Toolkit for Enterprise Developers 64-Bit Edition
_NutForkExecl(), _NutForkExecle(), _NutForkExeclp(), _NutForkExeclpe(), _NutForkExecv(), _NutForkExecve(), _NutForkExecvp(), _NutForkExecvpe(), _NutQueryPid(), alarm(), atexit(), chmod(), exit(), fcntl(), fork(), getenv(), getitimer(), getpid(), mmap(), pthread_create(), putenv(), semop(), setlocale(), setpriority(), shmat(), sigaction(), sigpending(), sigprocmask(), times(), umask(), vfork()
PTC MKS Toolkit 10.0 Documentation Build 6.