S6-FTRIGW(7)
π s6-ftrigw(7) β the notifier API, bestie edition π
okay so this one lives in the Miscellaneous Information Manual, and it's page S6-FTRIGW(7) β say hi π
β¨ NAME β¨
s6-ftrigw β the API for notifiers, aka programs that just wanna regularly announce what they're doing to the whole world π£ (well, to whoever's listening)
π¦ DESCRIPTION π¦
So here's the vibe: notifiers are supposed to create an s6-fifodir(7) in a hardcoded place in the filesystem, and then document where that spot is like the good citizen they are, no cap. Then listeners can subscribe to that s6-fifodir(7) and catch the events as they drop. π₯
check the s6/ftrigw.h header for the exact function prototypes β that's where the real receipts live, iykyk
π Creating a fifodir
char const *path = "/var/lib/myservice/fifodir" ;
gid_t gid = -1 ;
int forceperms = 0 ;
int r = ftrigw_fifodir_make(path, gid, forceperms) ;
ftrigw_fifodir_make() creates an s6-fifodir(7) at the path location. β¨ And the return codes? Listen up:
- it returns
0, and setserrno, if something goes wrong π - it returns
1if it actually succeeds π
Now for the spicy details:
- if an
s6-fifodir(7)owned by the user already exists atpath, andforcepermsis zero, thenftrigw_fifodir_make()immediately returns success. easy slay π - if
forcepermsis nonzero, then it tries to adjustpath's permissions before returning. lowkey doing a little extra credit π§
And about gid, bestie, this is important:
- if
gidis negative, thenpathgets created "public" β any listener at all will be able to subscribe topath. π open door policy - if
gidis nonnegative, thenpathis created "private" β only processes belonging to groupgidwill be able to subscribe topath. π members only
π Sending an event
char event = 'a' ;
r = ftrigw_notify(path, event) ;
ftrigw_notify() sends event to all the processes that are currently subscribed to path. π«Ά It returns β1 if an error occurs, or the number of successfully notified processes. So like, the count of people who actually got the message β very main character of it tbh π
πΈ Cleaning up
okay so this part is the "not me forgetting to clean my room" section π When stray KILL signals hit s6-ftrigrd(8) processes:
- it's a sign of incorrect system administration β yeah, that's a yikes π
- they can leave unused named pipes in the
s6-fifodir(7)
And it's the s6-fifodir(7)'s owner's job β i.e. the notifier's job, so literally you β to periodically do some housecleaning and remove those unused pipes. π§Ήβ¨
r = ftrigw_clean(path) ;
ftrigw_clean() cleans path. Returns 0, and sets errno, if it encounters an error π and it returns 1 if it succeeds π periodt.
β SEE ALSO β
This man page is ported from the authoritative documentation at: https://skarnet.org/software/s6/libs6/ftrigw.html π¦
π AUTHORS π
- Laurent Bercot
- Alexis <flexibeast@gmail.com> (man page port)
Debian π September 29, 2021 π that's the source, version and date bestie, mwah π«Ά go notify someone about it β¨
π¦ 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