SYD-OFD(1)
π SYD-OFD π
okay so bestie, welcome to syd-ofd(1) β it lives in the General Commands Manual section and it is, no exaggeration, the lock girlie of your dreams β¨
π NAME π
syd-ofd β takes a lock on a file, then executes into another program. that's it. that's the whole personality π«Ά
πΈ SYNOPSIS πΈ
syd-ofd [-n | -N] [-t timeout] [-d fd] [-s=-r | -x=-w] file {command
[arg...]}
π¦ DESCRIPTION π¦
so here's the tea, bestie: syd-ofd takes a lock on a file, then executes into another program. literally what it says on the tin π
it's functionally identical to the s6-setlock(1) utility β like, twin energy β except it uses OFD locks, which are new in POSIX 2024. iconic behavior only π
this lock type is also known as "file-private locks" and it's open file description-based rather than process based, which is what the old-style POSIX locks that s6-setlock(1) uses are doing. and this difference is not just a little footnote, bestie β it's the whole reason this exists:
- because of it,
syd(1)can pass the file descriptor to the sandbox process and close its own copy while the sandbox process is still holding the lock π«Ά - which is not possible with old style locks and
s6-setlock(1). nope. can't do it. that's the whole flex π₯
β¨ OPTIONS β¨
-hβ display help. the classic. the goat π-nβ nonblocking lock. ifsyd-ofdcannot acquire the lock, it will exit11("EAGAIN": Try again) immediately. no waiting, no pining, she moves on π¨-Nβ blocking lock.syd-ofdwill wait until it can acquire the lock. this is the default. she'll wait for you, she's loyal like that π-t timeoutβ timed lock. ifsyd-ofdcannot acquire the lock after timeout milliseconds, it will exit4("EINTR": Interrupted system call). a little patience, but not infinite patience β³-s=-rβ shared lock. other shared locks on the same file will not prevent the lock from being acquired (but an exclusive lock will). sharing is caring, until it isn't π- the
-roption is retained for compatibility with thes6-setlock(1)utility.
- the
-x=-wβ exclusive lock. this is the default. main character energy, no sharing π- the
-woption is retained for compatibility with thes6-setlock(1)utility.
- the
-d fdβ make the lock visible in program on file descriptor fd. show it off, let them see the lock π
π EXIT STATUS π
- on clean exit,
syd-ofdexits with the same code as the child process. matching outfits fr fr π― - on unclean termination, the exit code is set to 128 plus signal number. harsh but fair.
- in case executing the child process fails,
syd-ofdexits with theerrno(3)number. the receipt is always there π§Ύ
π₯ SECURITY π₯
okay this part is serious, bestie, pay attention π
syd-ofd uses openat(2) with the resolve flags RESOLVE_NO_MAGICLINKS and RESOLVE_NO_SYMLINKS when opening or creating the lock file. so, consequently:
- if any component of the specified path is a symbolic link, the call fails and returns error code
40(ELOOP: "Too many symbolic links encountered") π« - in the same manner, the presence of any
..(dot-dot) component in the lock-file path causes the call to fail and return error code13(EACCES: "Permission denied") π«
and why?? because this restriction is intended to mitigate confused-deputy vulnerabilities during lock-file creation and related file operations β by preventing an intermediary or less-privileged actor from redirecting the operation via symbolic links or parent-directory (..) components to an unintended filesystem location. no sneaky redirection on her watch π
π SEE ALSO π
syd(1), syd(2), syd(5), syd-lock(1), syd-mdwe(1), syd-pds(1), syd-ring(1), syd-sec(1), syd-tsc(1), s6-setlock(1), fcntl(2), F_OFD_SETLKW(2const), openat2(2)
sydhomepage:https://sydbox.exherbo.org/s6-setlockmanpage:https://skarnet.org/software/s6/s6-setlock.html- POSIX 2024
fcntl(2)manpage:https://pubs.opengroup.org/onlinepubs/9799919799/functions/fcntl.html
π AUTHORS π
maintained by Ali Polatel. up-to-date sources can be found at https://gitlab.exherbo.org/sydbox/sydbox.git and on Radicle at rad:z38HCnbmcDegA2BMxuPaPRPMdp6wF. bugs/patches can be submitted to https://gitlab.exherbo.org/groups/sydbox/-/issues. discuss in #sydbox on Libera Chat or in #sydbox:mailstation.de on Matrix π«Ά
so yeah, that's the whole page bestie β brought to you by SYD-OFD version SYD-OFD(1), dated 2026-09-01. go forth and lock responsibly π
π¦ where this page comes from
- arch rolling: syd 3.59.0-1 Β· GPL-3.0-only
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms