NAME
fork, wait, waitpid - basic process management
SYNOPSIS
@load "fork" pid = fork() ret = waitpid(pid) ret = wait();
DESCRIPTION
The fork extension adds three functions, as follows. fork() This function creates a new process. The return value is the zero in the child and the process-id number of the child in the parent, or -1 upon error. In the latter case, ERRNO indicates the problem. In the child, PROCINFO["pid"] and PROCINFO["ppid"] are updated to reflect the correct values. waitpid() This function takes a numeric argument, which is the process-id to wait for. The return value is that of the waitpid(2) system call. wait() This function waits for the first child to die. The return value is that of the wait(2) system call.
BUGS
There is no corresponding exec() function. The interfaces could be enhanced to provide more facilities, including pulling out the various bits of the return status.
EXAMPLE
@load "fork" ... if ((pid = fork()) == 0) print "hello from the child" else print "hello from the parent"
SEE ALSO
GAWK: Effective AWK Programming, filefuncs(3am), fnmatch(3am), inplace(3am), ordchr(3am), readdir(3am), readfile(3am), revoutput(3am), rwarray(3am), time(3am). fork(2), wait(2), waitpid(2).
AUTHOR
Arnold Robbins, arnold@skeeve.com.
COPYING PERMISSIONS
Copyright 2012, 2013, Free Software Foundation, Inc. Permission is granted to make and distribute verbatim copies of this manual page provided the copyright notice and this permission notice are preserved on all copies. Permission is granted to copy and distribute modified versions of this manual page under the conditions for verbatim copying, provided that the entire resulting derived work is distributed under the terms of a permission notice identical to this one. Permission is granted to copy and distribute translations of this manual page into another language, under the above conditions for modified versions, except that this permission notice may be stated in a translation approved by the Foundation.
More Linux Commands
manpages/systemd-fsck@.service.8.html
systemd-fsck .service(8) File system checker logic..........
systemd-fsck@.service is a service responsible for file system checks. It is instantiated for each device that requires a file system check. systemd-fsck-root.s
manpages/uuencode.5.html
uuencode(5) - format of an encoded uuencode file (Man Page)
Files output by uuencode(1) consist of a header line, followed by a number of body lines, and a trailer line. The uudecode(1) command will ignore any lines prec
manpages/smyrna.1.html
smyrna(1) - interactive graph viewer - Linux manual page....
smyrna is a viewer for graphs in the DOT format. It is especially designed to handle large graphs, and allows flat and topological fisheye views. It is assumed
manpages/fts_open.3.html
fts_open(3) - traverse a file hierarchy - Linux manual page
The fts functions are provided for traversing file hierarchies. A simple overview is that the fts_open() function returns a handle on a file hierarchy, which is
manpages/Tcl_WriteChars.3.html
Tcl_WriteChars(3) - buffered I/O facilities using channels
The Tcl channel mechanism provides a device-independent and platform-independent mechanism for performing buffered input and output operations on a variety of f
manpages/XkbNoteNameChanges.3.html
XkbNoteNameChanges(3) - Note the changed names in a changes
When your application receives a XkbNamesNotify event, you can note the changed names in a changes structure using XkbNoteNameChanges. The wanted parameter is t
manpages/xfsinfo.1.html
xfsinfo(1) - X font server information utility (Man Page)...
Xfsinfo is a utility for displaying information about an X font server. It is used to examine the capabilities of a server, the predefined values for various pa
manpages/nocbreak.3ncurses.html
nocbreak(3ncurses) - curses input options - Linux man page
Normally, the tty driver buffers typed characters until a newline or carriage return is typed. The cbreak routine disables line buffering and erase/kill charact
manpages/registerrpc.3.html
registerrpc(3) - library routines for remote procedure calls
These routines allow C programs to make procedure calls on other machines across the network. First, the client calls a procedure to send a data packet to the s
manpages/XCompositeUnredirectWindow.3.html
XCompositeUnredirectWindow(3) - X Composite Extension librar
The composite extension provides several related mechanisms: Per-hierarchy storage The rendering of an entire hierarchy of windows is redirected to off-screen s
manpages/gvfs-cat.1.html
gvfs-cat(1) Concatenate files (Commands - Linux man page)...
gvfs-cat concatenates the given files and prints them to the standard output. gvfs-cat works just like the traditional cat utility, but using gvfs locations ins
manpages/access.5.html
access(5) - Postfix SMTP server access table (Man Page).....
This document describes access control on remote SMTP client information: host names, network addresses, and envelope sender or recipient addresses; it is imple
