411 REFERENCE · Wikibooks
C programming/MS Windows reference/process.h
Reference material by Wikibooks contributors. This retains its source identity and is not 411 news reporting.
process.h is a C header file which contains function declarations and macros used in working with threads and processes. Most C compilers that target DOS, Windows 3.1x, Win32, OS/2, Novell NetWare or DOS extenders supply this header and the library functions in their C library. Neither the header file nor the functions are defined by either the ANSI C|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."Copyright 1985–1989, Microsoft Corporation", in QuickC version 2.00 process.h file An early reference to the file was in a post on the net.micro.pc usenet on Oct-26-1986.Is my floppy diskette formated?, groups-beta.google.com The compiler used was Microsoft C compiler version 3.0.
The Lattice C compiler version 3.30 (Aug-24-1988) did not have such a header file, but offered similar functions.
As of Borland, they provided it in their Turbo C compiler version 2.01.
The C Ware-Personal C compiler version 1.2c (June 1989) had only the ANSI headers.
Member functions
NameDescriptionNotes exec (operating system)|execl, execle, execlp, execlpeexecute a new child process by placing it in memory previously occupied by the parent process. Parameters are passed individually.DOS,Win,OS/2,POSIX exec (operating system)|execv, execve, execvp, execvpeload and execute a new child process by placing it in memory previously occupied by the parent process. Parameters are passed as an array of pointers.DOS,Win,OS/2,POSIX spawn (computing)|spawnl, spawnle, spawnlp, spawnlpeload and execute a new child process. Parameters are passed individually.DOS,Win,OS/2 spawn (computing)|spawnv, spawnve, spawnvp, spawnvpeload and execute a new child process. Parameters are passed as an array of pointers.DOS,Win,OS/2 beginthread|beginthread, beginthreadNTcreates a new thread of execution within the current process.Win,OS/2 endthread|endthreadterminates a thread created by beginthread.Win,OS/2 getpid|getpidreturns the process identifier.DOS,Win,OS/2 cexit|cexitrestore interrupt vectors altered by the startup code.DOS,Win,OS/2
Member constants
NameDescriptionNotesOS _P_WAITSuspends parent process until the child process has finished executing.synchronous spawn.MS-DOS,Win32,OS/2 _P_NOWAIT, _P_NOWAITOContinues to execute calling process concurrently with new process.asynchronous spawn.Win32,OS/2 _P_OVERLAYOverlays parent process with child, which destroys the parent.has the same effect as the exec* functions.MS-DOS,Win32,OS/2 _P_DETACHThe child is run in background without access to the console or keyboard.Calls to _cwait upon the new process will fail. Asynchronous spawn.Win32,OS/2 _WAIT_CHILDused as cwait action.Obsolete on Win32.MS-DOS,OS/2 _WAIT_GRANDCHILDused as cwait action.Obsolete on Win32.MS-DOS,OS/2
Implementations
Given the fact that there is no standard on which to base the implementation, the functions declared by process.h differs,
depending on which compiler you use. Below is a list of compilers which provide process.h.
DJGPPDelorie.com DJGPP process.h, delorie.com
OpenWatcom,Openwatcom.orgOpenWatcom clib, openwatcom.org
Digital MarsDigitalMars.comDigital Mars process.h, digitalmars.com
MinGWMinGW.org
Microsoft Visual C++MSDN.Microsoft.com
Borland Turbo C, 2.0 and laterBorland.comC version 2.01, dn.codegear.com
Lcc32CS.Virginia.edu
QNX Neutrino QCC 6.xQNX.com
Differences
Another aspect that might vary is the combined length of exec* and spawn* parameters.
Delorie DJGPP: does not have such a limit.DJGPP spawn*, delorie.com
Digital Mars: the maximum is 128 bytes; nothing is stated about the ending '\0' character.
Microsoft cl: the argument list for the new process must not exceed 1024 bytes.Microsoft MSDN, msdn.microsoft.com
References
External links
Digital Mars _exec reference