{{Short description|C header file}} {{Lowercase title}} '''<code><process.h></code>''' is the 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 most of the functions are defined by either 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.<ref>"Copyright 1985–1989, Microsoft Corporation", in QuickC version 2.00 process.h file</ref> An early reference to the file was in a post on the net.micro.pc usenet on Oct-26-1986.<ref name="msft process.h">[http://groups-beta.google.com/group/net.micro.pc/browse_frm/thread/b85ef1946a4915e6/1154bb52be4d5854?lnk=st&q=%22process%5C.h%22&rnum=23#1154bb52be4d5854 Is my floppy diskette formated?]{{Dead link|date=November 2024 |bot=InternetArchiveBot |fix-attempted=yes }}, groups-beta.google.com</ref> 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. Borland provided the header in their Turbo C compiler version 2.01. The C Ware-Personal C compiler version 1.2c (June 1989) had only the ANSI headers.

== Functions == {| class="wikitable" |- ! Name||Description||Notes |- | <code>execl, execle, execlp, execlpe</code>||load and execute a new child process by placing it in memory previously occupied by the parent process. Parameters are passed individually.||DOS, Win, OS/2, POSIX |- | <code>execv, execve, execvp, execvpe</code>||load 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 |- | <code>spawnl, spawnle, spawnlp, spawnlpe</code>||load and execute a new child process. Parameters are passed individually.||DOS, Win, OS/2 |- | <code>spawnv, spawnve, spawnvp, spawnvpe</code>||load and execute a new child process. Parameters are passed as an array of pointers.||DOS, Win, OS/2 |- | <code>beginthread, beginthreadNT</code>||creates a new thread of execution within the current process.||Win, OS/2 |- | <code>endthread</code>||terminates a thread created by <code>beginthread</code>.||Win, OS/2 |- | <code>getpid</code>||returns the process identifier.||DOS, Win, OS/2 |- | <code>cexit</code>||restore interrupt vectors altered by the startup code.||DOS, Win, OS/2 |- |}

== Constants == {| class="wikitable" |- ! Name||Description||Notes||OS |- | <code>_P_WAIT</code>||Suspends parent process until the child process has finished executing.||synchronous spawn.||MS-DOS, Win32, OS/2 |- | <code>_P_NOWAIT, _P_NOWAITO</code>||Continues to execute calling process concurrently with new process.||asynchronous spawn.||Win32, OS/2 |- | <code>_P_OVERLAY</code>||Overlays parent process with child, which destroys the parent.||has the same effect as the <code>exec*</code> functions.||MS-DOS, Win32, OS/2 |- | <code>_P_DETACH</code>||The child is run in background without access to the console or keyboard.||Calls to <code>_cwait</code> upon the new process will fail. Asynchronous spawn.||Win32, OS/2 |- | <code>_WAIT_CHILD</code>||used as <code>cwait</code> action.||Obsolete on Win32.||MS-DOS, OS/2 |- | <code>_WAIT_GRANDCHILD</code>||used as <code>cwait</code> action.||Obsolete on Win32.||MS-DOS, OS/2 |}

== Implementations == Given the fact there is no standard on which to base the implementation, the functions declared by process.h differ, depending on the compiler in use. Below is a list of compilers which provide process.h.

* DJGPP<ref>[http://www.delorie.com/djgpp/ Delorie.com]</ref><ref name="djgpp process.h">[http://www.delorie.com/djgpp/doc/incs/process.h DJGPP process.h], delorie.com</ref> * OpenWatcom,<ref>[http://www.openwatcom.org/index.php/Main_Page Openwatcom.org] {{webarchive|url=https://web.archive.org/web/20150317091931/http://www.openwatcom.org/index.php/Main_Page |date=2015-03-17 }}</ref><ref name="watcom clib">[http://www.openwatcom.org/ftp/manuals/clib.pdf OpenWatcom clib] {{Webarchive|url=https://web.archive.org/web/20061011042009/http://www.openwatcom.org/ftp/manuals/clib.pdf |date=2006-10-11 }}, openwatcom.org</ref> * Digital Mars<ref>[http://www.digitalmars.com/ DigitalMars.com]</ref><ref name="mars process.h">[http://www.digitalmars.com/rtl/process.html Digital Mars process.h], digitalmars.com</ref> * MinGW<ref>[http://www.mingw.org/ MinGW.org]</ref> * Microsoft Visual C++<ref>{{Cite web |url=http://msdn.microsoft.com/vstudio/express/visualc/default.aspx |title=MSDN.Microsoft.com |access-date=2007-01-15 |archive-url=https://web.archive.org/web/20070707082306/http://msdn.microsoft.com/vstudio/express/visualc/default.aspx |archive-date=2007-07-07 |url-status=dead }}</ref> * Borland Turbo C, 2.0 and later<ref>{{Cite web |url=http://www.borland.com/ |title=Borland.com |access-date=2007-01-15 |archive-url=https://web.archive.org/web/20121105211827/http://www.borland.com/ |archive-date=2012-11-05 |url-status=dead }}</ref><ref name="turboc 2.0">[https://archive.today/20110710191522/http://dn.codegear.com/article/20841Turbo C version 2.01], dn.codegear.com</ref> * Lcc32<ref>[http://www.cs.virginia.edu/~lcc-win32/ CS.Virginia.edu]</ref> * QNX Neutrino QCC 6.x<ref>[http://www.qnx.com/products/neutrino_rtos/ QNX.com]</ref>

== Differences == Another aspect that might vary is the combined length of exec* and spawn* parameters. * Delorie DJGPP: does not have such a limit.<ref name="djgpp spawn">[http://www.delorie.com/djgpp/doc/libc/libc_736.html DJGPP spawn*], delorie.com</ref> * 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.<ref name="msdn">[http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vccore98/HTML/_crt_system.2c_._wsystem.asp Microsoft MSDN], msdn.microsoft.com</ref>

== References == {{Reflist}}

== External links == * [http://www.digitalmars.com/rtl/process.html#_exec Digital Mars _exec reference]

Category:Process.h Category:C (programming language) headers