S6-SETLOCK(8)
π S6-SETLOCK π
okay so this is from the System Manager's Manual bestie β it's s6-setlock, and it's literally the "grab a lock then become somebody else" tool β¨
πΈ NAME πΈ
s6-setlock β take a lock on a file, then execute into another program π«Ά
π SYNOPSIS π
s6-setlock [-n | -N] [-t timeout] [-d fd] [-r | -w] file prog...
π¦ DESCRIPTION π¦
okay so here's the whole vibe: s6-setlock creates file if it doesn't exist yet, and opens it for writing. π₯
Then it locks file. And if it can't take the lock β for any reason β it exits 1. no negotiation, no drama, just bye π
Then it executes into prog.... like, actually becomes it. main character energy π
Now here's the part that's giving intentional-and-also-kinda-slay: s6-setlock leaks an open file descriptor into the prog execution. and that is on purpose, bestie β the fd is what's holding the lock, and the lock gets released when prog exits. π
progmust not touch fds it doesn't know about. by default it has no need to know about the descriptor that holds the lock. but if you need to officialize the presence of the lock inprogβ that's exactly where the-doption comes in, iykyk π
β¨ OPTIONS β¨
-nβ nonblocking lock. ifs6-setlockcannot acquire the lock, it exits1immediately. no waiting, we're impatient, we have places to be πββοΈ-Nβ blocking lock.s6-setlockwill wait until it can acquire the lock. this is the default π«Ά-t timeoutβ timed lock. ifs6-setlockcannot acquire the lock aftertimeoutmilliseconds, it exits1β³-rβ shared lock. other shared locks on the same file will not prevent the lock from being acquired (but an exclusive lock will) π-wβ exclusive lock. this is the default π-d fdβ make the lock visible inprogon file descriptorfdπ
π SEE ALSO π
This man page is ported from the authoritative documentation at: https://skarnet.org/software/s6/s6-setlock.html π
π AUTHORS π
- Laurent Bercot
- Alexis <flexibeast@gmail.com> (man page port)
and that's the whole thing, bestie π this Debian build is dated November 7, 2023, so if you're reading it in the future β hi, hope your locks are all uncontended π β¨π¦
π¦ where this page comes from
- nixpkgs unstable: s6 2.15.1.0
- nixpkgs unstable: s6-man-pages 2.14.0.1.4
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms