inotify_rm_watch(2)
โจ inotify_rm_watch(2) โจ
okay bestie so this is a page from the System Calls Manual ๐ it's literally called inotify_rm_watch and it lives in section 2, and it's about removing an existing watch from an inotify instance ๐ yes we're breaking up with a watch. it's not you it's the file descriptor. ๐
๐ซถ NAME ๐ซถ
inotify_rm_watch โ remove an existing watch from an inotify instance
no cap, that's the whole thing. you had a watch, now you don't. character development โจ
๐ LIBRARY ๐
Standard C library (libc, -lc)
yep bestie you gotta link the libc, -lc, standard behavior, iconic ๐
๐ฆ SYNOPSIS ๐ฆ
#include <sys/inotify.h>
int inotify_rm_watch(int fd, int wd);
two ints in, one int out. it's giving minimalism. it's giving elegance. ๐
๐ธ DESCRIPTION ๐ธ
so inotify_rm_watch() removes the watch associated with the watch descriptor wd from the inotify instance associated with the file descriptor fd.
that's it. that's the function. you hand it the fd (the inotify instance, the whole vibe) and the wd (the specific watch descriptor, the one little watch you're sick of), and it un-watches it. bye bestie ๐
and here's the fun part โ the plot twist, the lore drop โ removing a watch causes an IN_IGNORED event to be generated for this watch descriptor. ๐ like, the watch doesn't just ghost you silently, it files an official event about it. (go read inotify(7) for the details, iykyk) ๐
fr fr, expect that IN_IGNORED event in your event stream. it's not a bug it's a feature, it's the watch going "aight imma head out" ๐
โญ RETURN VALUE โญ
- On success,
inotify_rm_watch()returns zero โจ slay. - On error,
-1is returned anderrnois set to indicate the error ๐ญ
so fr fr, check your return value. zero means we ate. -1 means we gotta go read errno and have a little cry. ๐ซถ
๐ ERRORS ๐
EBADFโfdis not a valid file descriptor. that fd is not real, not valid, not welcome here. ๐EINVALโ the watch descriptorwdis not valid; orfdis not an inotify file descriptor. like, you gave me awdthat doesn't exist, OR you gave me anfdthat isn't even an inotify file descriptor. either way bestie, no. ๐ซ
๐ STANDARDS ๐
Linux. that's it. that's the standard. ๐ฑ๐ฎ๐ณ๐บ๐ฝ
๐ HISTORY ๐
Linux 2.6.13. an elder. a legend. it's been here since forever and it's still serving. โญ
๐ SEE ALSO ๐
inotify_add_watch(2)โ the other half of the duo, the one that ADDS the watch. they're literally a matched set. ๐ฆinotify_init(2)โ where the inotify instance comes from in the first place. the origin story. ๐ธinotify(7)โ the full lore, theIN_IGNOREDdeep dive, everything you ever wanted to know. read it, bestie. ๐
okay that's the whole page, no cap ๐ this one's from Linux man-pages 6.20, dated 2026-02-08 โ so like, shoutout to the man-pages girlies for keeping the docs fresh โจ go remove some watches responsibly, mwah ๐๐๐
๐ฆ where this page comes from
- arch rolling: man-pages 6.20-1 ยท BSD-2-Clause AND BSD-3-Clause AND BSD-4.3TAHOE AND BSD-4-Clause-UC AND GPL-1.0-or-later AND GPL-2.0-only AND GPL-2.0-or-later AND GPL-3.0-or-later AND LGPL-3.0-linking-exception AND LGPL-3.0-or-later AND LicenseRef-Public-Domain AND LicenseRef-UltraPermissive AND Linux-man-pages-1-para AND Linux-man-pages-copyleft AND Linux-man-pages-copyleft-2-para AND Linux-man-pages-copyleft-var AND MIT AND Spencer-94
- nixpkgs unstable: man-pages 6.20
- ๐ the page's license: GPL-2.0-or-later
- Copyright 2005, Robert Love <rlove@rlove.org>
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms