{
    "mode": "man",
    "parameter": "setlock",
    "section": "8",
    "url": "https://www.chedong.com/phpMan.php/man/setlock/8/json",
    "generated": "2026-09-04T18:22:19Z",
    "synopsis": "setlock [ -nNxX ] fn child",
    "sections": {
        "NAME": {
            "content": "setlock - runs another program with a file locked.\n",
            "subsections": []
        },
        "SYNOPSIS": {
            "content": "setlock [ -nNxX ] fn child\n",
            "subsections": []
        },
        "DESCRIPTION": {
            "content": "fn is a single argument.  child consists of one or more arguments.\n\nsetlock opens fn for writing (creating it if it does not exist), obtains an exclusive lock on\nit, and runs child.\n\nNormally the lock disappears when child exits.\n\nHere's  the  complete  story:  child is given a descriptor for a locked ofile pointing to the\ndisk file named fn.  The lock disappears when this ofile is\n\no      closed by all the processes that have descriptors for it or\n\no      explicitly unlocked.\n",
            "subsections": []
        },
        "OPTIONS": {
            "content": "",
            "subsections": [
                {
                    "name": "-n",
                    "content": "",
                    "flag": "-n"
                },
                {
                    "name": "-N",
                    "content": "tain a new lock.\n",
                    "flag": "-N"
                },
                {
                    "name": "-x",
                    "content": "",
                    "flag": "-x"
                },
                {
                    "name": "-X",
                    "content": "sage and exits nonzero.\n",
                    "flag": "-X"
                }
            ]
        },
        "SEE ALSO": {
            "content": "supervise(8),   svc(8),   svok(8),  svstat(8),  svscanboot(8),  svscan(8),  readproctitle(8),\nfghack(8), pgrphack(8), multilog(8), tai64n(8), tai64nlocal(8),  setuidgid(8),  envuidgid(8),\nenvdir(8), softlimit(8)\n\nhttp://cr.yp.to/daemontools.html\n\nsetlock(8)",
            "subsections": []
        }
    },
    "summary": "setlock - runs another program with a file locked.",
    "flags": [
        {
            "flag": "-n",
            "long": null,
            "arg": null,
            "description": ""
        },
        {
            "flag": "-N",
            "long": null,
            "arg": null,
            "description": "tain a new lock."
        },
        {
            "flag": "-x",
            "long": null,
            "arg": null,
            "description": ""
        },
        {
            "flag": "-X",
            "long": null,
            "arg": null,
            "description": "sage and exits nonzero."
        }
    ],
    "examples": [],
    "see_also": [
        {
            "name": "supervise",
            "section": "8",
            "url": "https://www.chedong.com/phpMan.php/man/supervise/8/json"
        },
        {
            "name": "svc",
            "section": "8",
            "url": "https://www.chedong.com/phpMan.php/man/svc/8/json"
        },
        {
            "name": "svok",
            "section": "8",
            "url": "https://www.chedong.com/phpMan.php/man/svok/8/json"
        },
        {
            "name": "svstat",
            "section": "8",
            "url": "https://www.chedong.com/phpMan.php/man/svstat/8/json"
        },
        {
            "name": "svscanboot",
            "section": "8",
            "url": "https://www.chedong.com/phpMan.php/man/svscanboot/8/json"
        },
        {
            "name": "svscan",
            "section": "8",
            "url": "https://www.chedong.com/phpMan.php/man/svscan/8/json"
        },
        {
            "name": "readproctitle",
            "section": "8",
            "url": "https://www.chedong.com/phpMan.php/man/readproctitle/8/json"
        },
        {
            "name": "fghack",
            "section": "8",
            "url": "https://www.chedong.com/phpMan.php/man/fghack/8/json"
        },
        {
            "name": "pgrphack",
            "section": "8",
            "url": "https://www.chedong.com/phpMan.php/man/pgrphack/8/json"
        },
        {
            "name": "multilog",
            "section": "8",
            "url": "https://www.chedong.com/phpMan.php/man/multilog/8/json"
        },
        {
            "name": "tai64n",
            "section": "8",
            "url": "https://www.chedong.com/phpMan.php/man/tai64n/8/json"
        },
        {
            "name": "tai64nlocal",
            "section": "8",
            "url": "https://www.chedong.com/phpMan.php/man/tai64nlocal/8/json"
        },
        {
            "name": "setuidgid",
            "section": "8",
            "url": "https://www.chedong.com/phpMan.php/man/setuidgid/8/json"
        },
        {
            "name": "envuidgid",
            "section": "8",
            "url": "https://www.chedong.com/phpMan.php/man/envuidgid/8/json"
        },
        {
            "name": "envdir",
            "section": "8",
            "url": "https://www.chedong.com/phpMan.php/man/envdir/8/json"
        },
        {
            "name": "softlimit",
            "section": "8",
            "url": "https://www.chedong.com/phpMan.php/man/softlimit/8/json"
        }
    ]
}