S6-FIFODIR(7)
β¨ s6-fifodir β the manual, but make it a group chat β¨
okay so bestie, welcome to s6-fifodir(7), Miscellaneous Information Manual section 7. this is the whole vibe of a fifodir: it's literally the rendez-vous point π« between the notifier of certain events and its listeners. like a lil hangout spot where the notifier says "hey!! something happened!!" and everyone who's listening hears about it. iconic behavior honestly.
π NAME π
s6-fifodir β the rendez-vous point between the notifier of certain events and its listeners π«Ά
πΈ DESCRIPTION πΈ
so an s6-fifodir is implemented via a directory in the filesystem. that's it. that's the whole thing. no data is stored in it β which means it is appropriate to create fifodirs in a RAM filesystem β¨ (yes, ram fs, because you're not storing anything, so why waste the disk, bestie).
π C API π
okay for the notifier side of things:
- you can create fifodirs via the
ftrigw_fifodir_create()function ins6-ftrigw(7)π - you can send an event to a fifodir via the
ftrigw_notify()function in the notifier part ofs6-ftrigw(7)π£ - you can clean up a fifodir via the
ftrigw_clean()function ins6-ftrigw(7)π§Ή - you can destroy fifodirs via the
rm_rf()function inlibstddjb[1] π
and for a listener:
- you can subscribe to a fifodir via the
ftrigr_subscribe()function in the listener part of thes6-ftrigr(7)π¦ - other functions in
s6-ftrigr(7)allow you to receive and handle events synchronously or asynchronously β
π Unix API π
for the notifier:
- you can create fifodirs with the
s6-mkfifodir(8)command - you can send an event to a fifodir with the
s6-ftrig-notify(8)command - you can clean up a fifodir with the
s6-cleanfifodir(8)command - you can destroy fifodirs with the
rm -rfcommand π
for a listener:
- you can subscribe to a fifodir and wait for an event, or a series or events, with the
s6-ftrig-wait(8)command β³ - you can subscribe to a fifodir, then trigger a program, then wait for an event, with the
s6-ftrig-listen1(8)ands6-ftrig-listen(8)commands. this makes it possible to only send a notification after you're sure a notifier is actually listening, in order to prevent race conditions π no cap, that's the good stuff.
π IMPLEMENTATION NOTES π
- notifiers and listeners agree on a fifodir π€
- the fifodir directory is created by the notifier. it must be writable by listeners.
- to subscribe, a listener atomically creates a named pipe (FIFO) in this directory and listens to the reading end. this named pipe must be writable by the notifier.
- to send an event to listeners, the notifier writes the event byte to all the named pipes in the directory. credit for this idea goes to Stefan Karrmann π periodt.
- to unsubscribe, a listener unlinks his named pipe from the directory.
heads up bestie β note that in the s6 implementation of fifodirs, there are a few additional details: for instance, the named pipes created in a fifodir by a listener follow a strict naming convention, for efficiency and safety reasons. if you are using fifodirs, it is recommended that you use the provided C library functions or the s6-ftrig-* command line utilities instead of directly hacking into the fifodir internals π
fifodirs are created by their notifier, so they always originally inherit its uid and gid. a notifier must be able to make his fifodir either publicly accessible (anyone can subscribe) or restricted (only a given group can subscribe).
π§ a publicly accessible fifodir π§
it must have rights 1733:
- anyone can create a fifo in that fifodir
- only the notifier can see all the subscribers' fifos
- a listener can only delete its own fifo
- a notifier can delete any fifo for cleaning purposes
π a restricted fifodir π
it must have the gid g of the group of allowed listeners and have rights 3730. unless the notifier is root, it must be in the group of allowed listeners to be able to create such a fifodir.
- only members of
gcan create a fifo in that fifodir - only the notifier can see all the subscribers' fifos
- fifos are always created with gid
g - a listener can only delete its own fifo
- a notifier can delete any fifo for cleaning purposes
π and the named pipe itself π
a named pipe in a fifodir must always belong to its listener and have rights 0622:
- only this listener can read on the fifo
- anyone who has reading rights on the fifodir (i.e. only the notifier) can write to the fifo
the libftrig interface takes care of all the subtleties β¨ so like, let it.
π₯ SEE ALSO π₯
this man page is ported from the authoritative documentation at: https://skarnet.org/software/s6/fifodir.html
π AUTHORS π
- Laurent Bercot
- Alexis
<flexibeast@gmail.com>(man page port)
that's the whole page, bestie, you ate that π«Άβ¨ the Debian version of this dropped November 7, 2023 β the S6-FIFODIR(7) era, we love to see it π
π bye mwah π
π¦ 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