<process.h> is a C header file that contains function declarations and macros used for working with threads and processes. Most C compilers targeting DOS, Windows 3.1x, Win32, OS/2, Novell NetWare, or DOS extenders supply this header and the associated library functions in their C library. Neither the header file nor most of its functions are defined by the ANSI/ISO C standard or by POSIX.
History
Microsoft's version of the file dates back to at least 1985, according to its copyright statement. An early reference to the file appeared in a post on the net.micro.pc Usenet group on October 26, 1986, using the Microsoft C compiler version 3.0. The Lattice C compiler version 3.30 (August 1988) did not include such a header file, though it offered similar functions. Borland provided the header in Turbo C version 2.01. The C Ware-Personal C compiler version 1.2c (June 1989) included only the ANSI headers.
Functions
| Name | Description | Notes |
|---|---|---|
execl, execle, execlp, execlpe |
Load and execute a new child process, placing it in memory previously occupied by the parent process. Parameters passed individually. | DOS, Win, OS/2, POSIX |
execv, execve, execvp, execvpe |
Load and execute a new child process, placing it in memory previously occupied by the parent process. Parameters passed as an array of pointers. | DOS, Win, OS/2, POSIX |
spawnl, spawnle, spawnlp, spawnlpe |
Load and execute a new child process. Parameters passed individually. | DOS, Win, OS/2 |
spawnv, spawnve, spawnvp, spawnvpe |
Load and execute a new child process. Parameters passed as an array of pointers. | DOS, Win, OS/2 |
beginthread, beginthreadNT |
Creates a new thread of execution within the current process. | Win, OS/2 |
endthread |
Terminates a thread created by beginthread. |
Win, OS/2 |
getpid |
Returns the process identifier. | DOS, Win, OS/2 |
cexit |
Restores interrupt vectors altered by the startup code. | DOS, Win, OS/2 |
Constants
| Name | Description | Notes | OS |
|---|---|---|---|
_P_WAIT |
Suspends parent process until the child process has finished executing. | Synchronous spawn. | MS-DOS, Win32, OS/2 |
_P_NOWAIT, _P_NOWAITO |
Continues executing calling process concurrently with the new process. | Asynchronous spawn. | Win32, OS/2 |
_P_OVERLAY |
Overlays parent process with child, destroying the parent. | Same effect as exec* functions. |
MS-DOS, Win32, OS/2 |
_P_DETACH |
Runs the child in background without access to the console or keyboard. | Calls to _cwait on the new process will fail. Asynchronous spawn. |
Win32, OS/2 |
_WAIT_CHILD |
Used as cwait action. |
Obsolete on Win32. | MS-DOS, OS/2 |
_WAIT_GRANDCHILD |
Used as cwait action. |
Obsolete on Win32. | MS-DOS, OS/2 |
Implementations
Because the header is not defined by any formal standard, the specific functions declared by process.h vary depending on the compiler. Compilers known to provide process.h include:
- DJGPP
- OpenWatcom
- Digital Mars
- MinGW
- Microsoft Visual C++
- Borland Turbo C (version 2.0 and later)
- Lcc32
- QNX Neutrino QCC 6.x
Differences
The combined length of exec* and spawn* parameters may also vary:
- Delorie DJGPP: No length limit.
- Digital Mars: Maximum of 128 bytes.
- Microsoft cl: Maximum of 1024 bytes for the argument list of the new process.