{
    "content": [
        {
            "type": "text",
            "text": "# fork (man)\n\n## NAME\n\nfork, wait, waitpid - basic process management\n\n## SYNOPSIS\n\n@load \"fork\"\npid = fork()\nret = waitpid(pid)\nret = wait();\n\n## DESCRIPTION\n\nThe fork extension adds three functions, as follows.\n\n## Sections\n\n- **NAME**\n- **SYNOPSIS**\n- **DESCRIPTION** (1 subsections)\n- **BUGS**\n- **EXAMPLE**\n- **SEE ALSO**\n- **AUTHOR**\n- **COPYING PERMISSIONS**\n\nUse structuredContent.sections for detailed options, examples, and full documentation.\n"
        }
    ],
    "structuredContent": {
        "command": "fork",
        "section": "",
        "mode": "man",
        "summary": "fork, wait, waitpid - basic process management",
        "synopsis": "@load \"fork\"\npid = fork()\nret = waitpid(pid)\nret = wait();",
        "tldr_summary": null,
        "tldr_examples": [],
        "tldr_source": null,
        "flags": [],
        "examples": [
            "@load \"fork\"",
            "...",
            "if ((pid = fork()) == 0)",
            "print \"hello from the child\"",
            "else",
            "print \"hello from the parent\""
        ],
        "see_also": [
            {
                "name": "filefuncs",
                "section": "3am",
                "url": "https://www.chedong.com/phpMan.php/man/filefuncs/3am/json"
            },
            {
                "name": "fnmatch",
                "section": "3am",
                "url": "https://www.chedong.com/phpMan.php/man/fnmatch/3am/json"
            },
            {
                "name": "inplace",
                "section": "3am",
                "url": "https://www.chedong.com/phpMan.php/man/inplace/3am/json"
            },
            {
                "name": "ordchr",
                "section": "3am",
                "url": "https://www.chedong.com/phpMan.php/man/ordchr/3am/json"
            },
            {
                "name": "readdir",
                "section": "3am",
                "url": "https://www.chedong.com/phpMan.php/man/readdir/3am/json"
            },
            {
                "name": "readfile",
                "section": "3am",
                "url": "https://www.chedong.com/phpMan.php/man/readfile/3am/json"
            },
            {
                "name": "revoutput",
                "section": "3am",
                "url": "https://www.chedong.com/phpMan.php/man/revoutput/3am/json"
            },
            {
                "name": "rwarray",
                "section": "3am",
                "url": "https://www.chedong.com/phpMan.php/man/rwarray/3am/json"
            },
            {
                "name": "time",
                "section": "3am",
                "url": "https://www.chedong.com/phpMan.php/man/time/3am/json"
            },
            {
                "name": "wait",
                "section": "2",
                "url": "https://www.chedong.com/phpMan.php/man/wait/2/json"
            },
            {
                "name": "waitpid",
                "section": "2",
                "url": "https://www.chedong.com/phpMan.php/man/waitpid/2/json"
            }
        ],
        "section_outline": [
            {
                "name": "NAME",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "SYNOPSIS",
                "lines": 8,
                "subsections": []
            },
            {
                "name": "DESCRIPTION",
                "lines": 7,
                "subsections": [
                    {
                        "name": "waitpid()",
                        "lines": 6
                    }
                ]
            },
            {
                "name": "BUGS",
                "lines": 5,
                "subsections": []
            },
            {
                "name": "EXAMPLE",
                "lines": 7,
                "subsections": []
            },
            {
                "name": "SEE ALSO",
                "lines": 5,
                "subsections": []
            },
            {
                "name": "AUTHOR",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "COPYING PERMISSIONS",
                "lines": 16,
                "subsections": []
            }
        ],
        "sections": {
            "NAME": {
                "content": "fork, wait, waitpid - basic process management\n",
                "subsections": []
            },
            "SYNOPSIS": {
                "content": "@load \"fork\"\n\npid = fork()\n\nret = waitpid(pid)\n\nret = wait();\n",
                "subsections": []
            },
            "DESCRIPTION": {
                "content": "The fork extension adds three functions, as follows.\n\nfork() This function creates a new process. The return value is the zero in the child and the\nprocess-id number of the child in the parent, or -1 upon error. In  the  latter  case,\nERRNO  indicates  the problem.  In the child, PROCINFO[\"pid\"] and PROCINFO[\"ppid\"] are\nupdated to reflect the correct values.\n",
                "subsections": [
                    {
                        "name": "waitpid()",
                        "content": "This function takes a numeric argument, which is the process-id to wait for.  The  re‐\nturn value is that of the waitpid(2) system call.\n\nwait() This  function  waits  for  the  first  child to die.  The return value is that of the\nwait(2) system call.\n"
                    }
                ]
            },
            "BUGS": {
                "content": "There is no corresponding exec() function.\n\nThe interfaces could be enhanced to provide more facilities, including pulling out the  vari‐\nous bits of the return status.\n",
                "subsections": []
            },
            "EXAMPLE": {
                "content": "@load \"fork\"\n...\nif ((pid = fork()) == 0)\nprint \"hello from the child\"\nelse\nprint \"hello from the parent\"\n",
                "subsections": []
            },
            "SEE ALSO": {
                "content": "GAWK:  Effective  AWK  Programming,  filefuncs(3am), fnmatch(3am), inplace(3am), ordchr(3am),\nreaddir(3am), readfile(3am), revoutput(3am), rwarray(3am), time(3am).\n\nfork(2), wait(2), waitpid(2).\n",
                "subsections": []
            },
            "AUTHOR": {
                "content": "Arnold Robbins, arnold@skeeve.com.\n",
                "subsections": []
            },
            "COPYING PERMISSIONS": {
                "content": "Copyright © 2012, 2013, 2018, Free Software Foundation, Inc.\n\nPermission is granted to make and distribute verbatim copies of this manual page provided the\ncopyright notice and this permission notice are preserved on all copies.\n\nPermission  is granted to copy and distribute modified versions of this manual page under the\nconditions for verbatim copying, provided that the entire resulting derived work is  distrib‐\nuted under the terms of a permission notice identical to this one.\n\nPermission  is  granted  to copy and distribute translations of this manual page into another\nlanguage, under the above conditions for modified versions, except that this  permission  no‐\ntice may be stated in a translation approved by the Foundation.\n\n\n\nFree Software Foundation                     Feb 02 2018                                   FORK(3am)",
                "subsections": []
            }
        }
    }
}