Files
Nim/inotify.html
github-actions[bot] ef3d9e7b38 Deploy to GitHub pages
2025-12-28 15:55:52 +00:00

547 lines
41 KiB
HTML

<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!-- This file is generated by Nim. -->
<html xmlns="https://www.w3.org/1999/xhtml" xml:lang="en" lang="en" data-theme="auto">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>std/inotify</title>
<!-- Google fonts -->
<link href='https://fonts.googleapis.com/css?family=Lato:400,600,900' rel='stylesheet' type='text/css'/>
<link href='https://fonts.googleapis.com/css?family=Source+Code+Pro:400,500,600' rel='stylesheet' type='text/css'/>
<!-- Favicon -->
<link rel="shortcut icon" href="data:image/x-icon;base64,AAABAAEAEBAAAAEAIABoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AAAAAAUAAAAF////AP///wD///8A////AP///wD///8A////AP///wD///8A////AAAAAAIAAABbAAAAlQAAAKIAAACbAAAAmwAAAKIAAACVAAAAWwAAAAL///8A////AP///wD///8A////AAAAABQAAADAAAAAYwAAAA3///8A////AP///wD///8AAAAADQAAAGMAAADAAAAAFP///wD///8A////AP///wAAAACdAAAAOv///wD///8A////AP///wD///8A////AP///wD///8AAAAAOgAAAJ3///8A////AP///wAAAAAnAAAAcP///wAAAAAoAAAASv///wD///8A////AP///wAAAABKAAAAKP///wAAAABwAAAAJ////wD///8AAAAAgQAAABwAAACIAAAAkAAAAJMAAACtAAAAFQAAABUAAACtAAAAkwAAAJAAAACIAAAAHAAAAIH///8A////AAAAAKQAAACrAAAAaP///wD///8AAAAARQAAANIAAADSAAAARf///wD///8AAAAAaAAAAKsAAACk////AAAAADMAAACcAAAAnQAAABj///8A////AP///wAAAAAYAAAAGP///wD///8A////AAAAABgAAACdAAAAnAAAADMAAAB1AAAAwwAAAP8AAADpAAAAsQAAAE4AAAAb////AP///wAAAAAbAAAATgAAALEAAADpAAAA/wAAAMMAAAB1AAAAtwAAAOkAAAD/AAAA/wAAAP8AAADvAAAA3gAAAN4AAADeAAAA3gAAAO8AAAD/AAAA/wAAAP8AAADpAAAAtwAAAGUAAAA/AAAA3wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAADfAAAAPwAAAGX///8A////AAAAAEgAAADtAAAAvwAAAL0AAADGAAAA7wAAAO8AAADGAAAAvQAAAL8AAADtAAAASP///wD///8A////AP///wD///8AAAAAO////wD///8A////AAAAAIcAAACH////AP///wD///8AAAAAO////wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A//8AAP//AAD4HwAA7/cAAN/7AAD//wAAoYUAAJ55AACf+QAAh+EAAAAAAADAAwAA4AcAAP5/AAD//wAA//8AAA=="/>
<link rel="icon" type="image/png" sizes="32x32" href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAA3XAAAN1wFCKJt4AAAAB3RJTUUH4QQQEwksSS9ZWwAAAk1JREFUWMPtll2ITVEUx39nn/O7Y5qR8f05wtCUUr6ZIS++8pEnkZInPImneaCQ5METNdOkeFBKUhMPRIkHKfEuUZSUlGlKPN2TrgfncpvmnntnmlEyq1Z7t89/rf9a6+y99oZxGZf/XeIq61EdtgKXgdXA0xrYAvBjOIF1AI9zvjcC74BSpndrJPkBWDScTF8Aa4E3wDlgHbASaANmVqlcCnwHvgDvgVfAJ+AikAAvgfVZwLnSVZHZaOuKoQi3ZOMi4NkYkpe1p4J7A8BpYAD49hfIy/oqG0+hLomiKP2L5L+1ubn5115S+3OAn4EnwBlgMzCjyt6ZAnQCJ4A7wOs88iRJHvw50HoujuPBoCKwHWiosy8MdfZnAdcHk8dxXFJ3VQbQlCTJvRBCGdRbD4M6uc5glpY3eAihpN5S5w12diSEcCCEcKUO4ljdr15T76ur1FDDLIQQ3qv71EdDOe3Kxj3leRXyk+pxdWnFWod6Wt2bY3de3aSuUHcPBVimHs7mK9WrmeOF6lR1o9qnzskh2ar2qm1qizpfXaPeVGdlmGN5pb09qMxz1Xb1kLqgzn1RyH7JUXW52lr5e/Kqi9qpto7V1atuUzfnARrV7jEib1T76gG2qxdGmXyiekkt1GswPTtek0aBfJp6YySGBfWg2tPQ0FAYgf1stUfdmdcjarbYJEniKIq6gY/Aw+zWHAC+p2labGpqiorFYgGYCEzN7oQdQClN07O1/EfDyGgC0ALMBdYAi4FyK+4H3gLPsxfR1zRNi+NP7nH5J+QntnXe5B5mpfQAAAAASUVORK5CYII=">
<!-- CSS -->
<link rel="stylesheet" type="text/css" href="nimdoc.out.css?v=2.3.1">
<!-- JS -->
<script type="text/javascript" src="dochack.js?v=2.3.1"></script>
</head>
<body>
<div class="document" id="documentId">
<div class="container">
<h1 class="title">std/inotify</h1>
<div class="row">
<div class="three columns">
<div class="theme-select-wrapper">
<label for="theme-select">Theme:&nbsp;</label>
<select id="theme-select" onchange="setTheme(this.value)">
<option value="auto">🌗 Match OS</option>
<option value="dark">🌑 Dark</option>
<option value="light">🌕 Light</option>
</select>
</div>
<div id="global-links">
<ul class="simple-boot">
<li><a href="manual.html">Manual</a></li>
<li><a href="lib.html">Standard library</a></li>
<li> <a id="indexLink" href="theindex.html">Index</a></li>
<li><a href="compiler/theindex.html">Compiler docs</a></li>
<li><a href="https://nim-lang.github.io/fusion/theindex.html">Fusion docs</a></li>
<li><a href="https://nim-lang.github.io/Nim/">devel</a>, <a href="https://nim-lang.org/documentation.html">stable</a></li>
</ul>
</div>
<div id="searchInputDiv">
Search: <input type="search" id="searchInput"
oninput="search()" />
</div>
<ul class="simple simple-toc" id="toc-list">
<li>
<a class="reference reference-toplevel" href="#6" id="56">Imports</a>
</li>
<li>
<details open>
<summary><a class="reference reference-toplevel" href="#7" id="57">Types</a></summary>
<ul class="simple simple-toc-section">
<li><a class="reference" href="#InotifyEvent" title="InotifyEvent {.pure, final, importc: &quot;struct inotify_event&quot;,
header: &quot;&lt;sys/inotify.h&gt;&quot;, completeStruct.} = object
wd* {.importc: &quot;wd&quot;.}: FileHandle ## Watch descriptor.
mask* {.importc: &quot;mask&quot;.}: uint32 ## Watch mask.
cookie* {.importc: &quot;cookie&quot;.}: uint32 ## Cookie to synchronize two events.
len* {.importc: &quot;len&quot;.}: uint32 ## Length (including NULs) of name.
name* {.importc: &quot;name&quot;.}: UncheckedArray[char] ## Name.">InotifyEvent</a></li>
</ul>
</details>
</li>
<li>
<details open>
<summary><a class="reference reference-toplevel" href="#10" id="60">Consts</a></summary>
<ul class="simple simple-toc-section">
<li><a class="reference" href="#IN_ACCESS" title="IN_ACCESS = 0x00000001">IN_ACCESS</a></li>
<li><a class="reference" href="#IN_ALL_EVENTS" title="IN_ALL_EVENTS = 4095">IN_ALL_EVENTS</a></li>
<li><a class="reference" href="#IN_ATTRIB" title="IN_ATTRIB = 0x00000004">IN_ATTRIB</a></li>
<li><a class="reference" href="#IN_CLOSE" title="IN_CLOSE = 24">IN_CLOSE</a></li>
<li><a class="reference" href="#IN_CLOSE_NOWRITE" title="IN_CLOSE_NOWRITE = 0x00000010">IN_CLOSE_NOWRITE</a></li>
<li><a class="reference" href="#IN_CLOSE_WRITE" title="IN_CLOSE_WRITE = 0x00000008">IN_CLOSE_WRITE</a></li>
<li><a class="reference" href="#IN_CREATE" title="IN_CREATE = 0x00000100">IN_CREATE</a></li>
<li><a class="reference" href="#IN_DELETE" title="IN_DELETE = 0x00000200">IN_DELETE</a></li>
<li><a class="reference" href="#IN_DELETE_SELF" title="IN_DELETE_SELF = 0x00000400">IN_DELETE_SELF</a></li>
<li><a class="reference" href="#IN_DONT_FOLLOW" title="IN_DONT_FOLLOW = 0x02000000">IN_DONT_FOLLOW</a></li>
<li><a class="reference" href="#IN_EXCL_UNLINK" title="IN_EXCL_UNLINK = 0x04000000">IN_EXCL_UNLINK</a></li>
<li><a class="reference" href="#IN_IGNORED" title="IN_IGNORED = 0x00008000">IN_IGNORED</a></li>
<li><a class="reference" href="#IN_ISDIR" title="IN_ISDIR = 0x40000000">IN_ISDIR</a></li>
<li><a class="reference" href="#IN_MASK_ADD" title="IN_MASK_ADD = 0x20000000">IN_MASK_ADD</a></li>
<li><a class="reference" href="#IN_MODIFY" title="IN_MODIFY = 0x00000002">IN_MODIFY</a></li>
<li><a class="reference" href="#IN_MOVE" title="IN_MOVE = 192">IN_MOVE</a></li>
<li><a class="reference" href="#IN_MOVE_SELF" title="IN_MOVE_SELF = 0x00000800">IN_MOVE_SELF</a></li>
<li><a class="reference" href="#IN_MOVED_FROM" title="IN_MOVED_FROM = 0x00000040">IN_MOVED_FROM</a></li>
<li><a class="reference" href="#IN_MOVED_TO" title="IN_MOVED_TO = 0x00000080">IN_MOVED_TO</a></li>
<li><a class="reference" href="#IN_ONESHOT" title="IN_ONESHOT = 0x0000000080000000'i64">IN_ONESHOT</a></li>
<li><a class="reference" href="#IN_ONLYDIR" title="IN_ONLYDIR = 0x01000000">IN_ONLYDIR</a></li>
<li><a class="reference" href="#IN_OPEN" title="IN_OPEN = 0x00000020">IN_OPEN</a></li>
<li><a class="reference" href="#IN_Q_OVERFLOW" title="IN_Q_OVERFLOW = 0x00004000">IN_Q_OVERFLOW</a></li>
<li><a class="reference" href="#IN_UNMOUNT" title="IN_UNMOUNT = 0x00002000">IN_UNMOUNT</a></li>
</ul>
</details>
</li>
<li>
<details open>
<summary><a class="reference reference-toplevel" href="#12" id="62">Procs</a></summary>
<ul class="simple simple-toc-section">
<ul class="simple nested-toc-section">inotify_add_watch
<li><a class="reference" href="#inotify_add_watch%2Ccint%2Ccstring%2Cuint32" title="inotify_add_watch(fd: cint; name: cstring; mask: uint32): cint">inotify_add_watch(fd: cint; name: cstring; mask: uint32): cint</a></li>
</ul>
<ul class="simple nested-toc-section">inotify_init
<li><a class="reference" href="#inotify_init" title="inotify_init(): FileHandle">inotify_init(): FileHandle</a></li>
</ul>
<ul class="simple nested-toc-section">inotify_init1
<li><a class="reference" href="#inotify_init1%2Ccint" title="inotify_init1(flags: cint): FileHandle">inotify_init1(flags: cint): FileHandle</a></li>
</ul>
<ul class="simple nested-toc-section">inotify_rm_watch
<li><a class="reference" href="#inotify_rm_watch%2Ccint%2Ccint" title="inotify_rm_watch(fd: cint; wd: cint): cint">inotify_rm_watch(fd: cint; wd: cint): cint</a></li>
</ul>
</ul>
</details>
</li>
<li>
<details open>
<summary><a class="reference reference-toplevel" href="#15" id="65">Iterators</a></summary>
<ul class="simple simple-toc-section">
<ul class="simple nested-toc-section">inotify_events
<li><a class="reference" href="#inotify_events.i%2Cpointer%2Cint" title="inotify_events(evs: pointer; n: int): ptr InotifyEvent">inotify_events(evs: pointer; n: int): ptr InotifyEvent</a></li>
</ul>
</ul>
</details>
</li>
</ul>
</div>
<div class="nine columns" id="content">
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/posix/inotify.nim#L1" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/posix/inotify.nim#L1" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
<div id="tocRoot"></div>
<p class="module-desc">
<p><strong class="examples_text">Example:</strong></p>
<pre class="listing"><span class="Keyword">import</span> <span class="Identifier">std</span><span class="Operator">/</span><span class="Identifier">inotify</span>
<span class="Keyword">when</span> <span class="Identifier">defined</span><span class="Punctuation">(</span><span class="Identifier">linux</span><span class="Punctuation">)</span><span class="Punctuation">:</span>
<span class="Keyword">let</span> <span class="Identifier">inotifyFd</span> <span class="Operator">=</span> <span class="Identifier">inotify_init</span><span class="Punctuation">(</span><span class="Punctuation">)</span> <span class="Comment"># create and get new inotify FileHandle</span>
<span class="Identifier">doAssert</span> <span class="Identifier">inotifyFd</span> <span class="Operator">&gt;=</span> <span class="DecNumber">0</span> <span class="Comment"># check for errors</span>
<span class="Keyword">let</span> <span class="Identifier">wd</span> <span class="Operator">=</span> <span class="Identifier">inotifyFd</span><span class="Operator">.</span><span class="Identifier">inotify_add_watch</span><span class="Punctuation">(</span><span class="StringLit">&quot;/tmp&quot;</span><span class="Punctuation">,</span> <span class="Identifier">IN_CREATE</span> <span class="Keyword">or</span> <span class="Identifier">IN_DELETE</span><span class="Punctuation">)</span> <span class="Comment"># Add new watch</span>
<span class="Identifier">doAssert</span> <span class="Identifier">wd</span> <span class="Operator">&gt;=</span> <span class="DecNumber">0</span> <span class="Comment"># check for errors</span>
<span class="Keyword">discard</span> <span class="Identifier">inotifyFd</span><span class="Operator">.</span><span class="Identifier">inotify_rm_watch</span><span class="Punctuation">(</span><span class="Identifier">wd</span><span class="Punctuation">)</span> <span class="Comment"># remove watch</span></pre></p>
<div class="section" id="6">
<h1><a class="toc-backref" href="#6">Imports</a></h1>
<dl class="item">
<a class="reference external" href="syncio.html">syncio</a>
</dl>
</div>
<div class="section" id="7">
<h1><a class="toc-backref" href="#7">Types</a></h1>
<dl class="item">
<div id="InotifyEvent">
<dt><pre><a href="inotify.html#InotifyEvent"><span class="Identifier">InotifyEvent</span></a> {.<span class="Identifier">pure</span><span class="Other">,</span> <span class="Identifier">final</span><span class="Other">,</span> <span class="Identifier">importc</span><span class="Other">:</span> <span class="StringLit">&quot;struct inotify_event&quot;</span><span class="Other">,</span>
<span class="Identifier">header</span><span class="Other">:</span> <span class="StringLit">&quot;&lt;sys/inotify.h&gt;&quot;</span><span class="Other">,</span> <span class="Identifier">completeStruct</span>.} <span class="Other">=</span> <span class="Keyword">object</span>
<span class="Identifier">wd</span><span class="Operator">*</span> {.<span class="Identifier">importc</span><span class="Other">:</span> <span class="StringLit">&quot;wd&quot;</span>.}<span class="Other">:</span> <a href="syncio.html#FileHandle"><span class="Identifier">FileHandle</span></a> <span class="Comment">## Watch descriptor.</span>
<span class="Identifier">mask</span><span class="Operator">*</span> {.<span class="Identifier">importc</span><span class="Other">:</span> <span class="StringLit">&quot;mask&quot;</span>.}<span class="Other">:</span> <a href="system.html#uint32"><span class="Identifier">uint32</span></a> <span class="Comment">## Watch mask.</span>
<span class="Identifier">cookie</span><span class="Operator">*</span> {.<span class="Identifier">importc</span><span class="Other">:</span> <span class="StringLit">&quot;cookie&quot;</span>.}<span class="Other">:</span> <a href="system.html#uint32"><span class="Identifier">uint32</span></a> <span class="Comment">## Cookie to synchronize two events.</span>
<span class="Identifier">len</span><span class="Operator">*</span> {.<span class="Identifier">importc</span><span class="Other">:</span> <span class="StringLit">&quot;len&quot;</span>.}<span class="Other">:</span> <a href="system.html#uint32"><span class="Identifier">uint32</span></a> <span class="Comment">## Length (including NULs) of name.</span>
<span class="Identifier">name</span><span class="Operator">*</span> {.<span class="Identifier">importc</span><span class="Other">:</span> <span class="StringLit">&quot;name&quot;</span>.}<span class="Other">:</span> <a href="system.html#UncheckedArray"><span class="Identifier">UncheckedArray</span></a><span class="Other">[</span><a href="system.html#char"><span class="Identifier">char</span></a><span class="Other">]</span> <span class="Comment">## Name.</span></pre></dt>
<dd>
An Inotify event.
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/posix/inotify.nim#L18" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/posix/inotify.nim#L18" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</dl>
</div>
<div class="section" id="10">
<h1><a class="toc-backref" href="#10">Consts</a></h1>
<dl class="item">
<div id="IN_ACCESS">
<dt><pre><a href="inotify.html#IN_ACCESS"><span class="Identifier">IN_ACCESS</span></a> <span class="Other">=</span> <span class="DecNumber">0x00000001</span></pre></dt>
<dd>
File was accessed.
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/posix/inotify.nim#L27" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/posix/inotify.nim#L27" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="IN_ALL_EVENTS">
<dt><pre><a href="inotify.html#IN_ALL_EVENTS"><span class="Identifier">IN_ALL_EVENTS</span></a> <span class="Other">=</span> <span class="DecNumber">4095</span></pre></dt>
<dd>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/posix/inotify.nim#L59" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/posix/inotify.nim#L59" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="IN_ATTRIB">
<dt><pre><a href="inotify.html#IN_ATTRIB"><span class="Identifier">IN_ATTRIB</span></a> <span class="Other">=</span> <span class="DecNumber">0x00000004</span></pre></dt>
<dd>
Metadata changed.
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/posix/inotify.nim#L29" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/posix/inotify.nim#L29" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="IN_CLOSE">
<dt><pre><a href="inotify.html#IN_CLOSE"><span class="Identifier">IN_CLOSE</span></a> <span class="Other">=</span> <span class="DecNumber">24</span></pre></dt>
<dd>
Close.
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/posix/inotify.nim#L32" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/posix/inotify.nim#L32" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="IN_CLOSE_NOWRITE">
<dt><pre><a href="inotify.html#IN_CLOSE_NOWRITE"><span class="Identifier">IN_CLOSE_NOWRITE</span></a> <span class="Other">=</span> <span class="DecNumber">0x00000010</span></pre></dt>
<dd>
Unwrittable file closed.
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/posix/inotify.nim#L31" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/posix/inotify.nim#L31" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="IN_CLOSE_WRITE">
<dt><pre><a href="inotify.html#IN_CLOSE_WRITE"><span class="Identifier">IN_CLOSE_WRITE</span></a> <span class="Other">=</span> <span class="DecNumber">0x00000008</span></pre></dt>
<dd>
Writtable file was closed.
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/posix/inotify.nim#L30" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/posix/inotify.nim#L30" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="IN_CREATE">
<dt><pre><a href="inotify.html#IN_CREATE"><span class="Identifier">IN_CREATE</span></a> <span class="Other">=</span> <span class="DecNumber">0x00000100</span></pre></dt>
<dd>
Subfile was created.
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/posix/inotify.nim#L37" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/posix/inotify.nim#L37" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="IN_DELETE">
<dt><pre><a href="inotify.html#IN_DELETE"><span class="Identifier">IN_DELETE</span></a> <span class="Other">=</span> <span class="DecNumber">0x00000200</span></pre></dt>
<dd>
Subfile was deleted.
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/posix/inotify.nim#L38" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/posix/inotify.nim#L38" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="IN_DELETE_SELF">
<dt><pre><a href="inotify.html#IN_DELETE_SELF"><span class="Identifier">IN_DELETE_SELF</span></a> <span class="Other">=</span> <span class="DecNumber">0x00000400</span></pre></dt>
<dd>
Self was deleted.
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/posix/inotify.nim#L39" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/posix/inotify.nim#L39" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="IN_DONT_FOLLOW">
<dt><pre><a href="inotify.html#IN_DONT_FOLLOW"><span class="Identifier">IN_DONT_FOLLOW</span></a> <span class="Other">=</span> <span class="DecNumber">0x02000000</span></pre></dt>
<dd>
Do not follow a sym link.
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/posix/inotify.nim#L51" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/posix/inotify.nim#L51" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="IN_EXCL_UNLINK">
<dt><pre><a href="inotify.html#IN_EXCL_UNLINK"><span class="Identifier">IN_EXCL_UNLINK</span></a> <span class="Other">=</span> <span class="DecNumber">0x04000000</span></pre></dt>
<dd>
Exclude events on unlinked objects.
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/posix/inotify.nim#L52" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/posix/inotify.nim#L52" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="IN_IGNORED">
<dt><pre><a href="inotify.html#IN_IGNORED"><span class="Identifier">IN_IGNORED</span></a> <span class="Other">=</span> <span class="DecNumber">0x00008000</span></pre></dt>
<dd>
File was ignored.
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/posix/inotify.nim#L46" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/posix/inotify.nim#L46" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="IN_ISDIR">
<dt><pre><a href="inotify.html#IN_ISDIR"><span class="Identifier">IN_ISDIR</span></a> <span class="Other">=</span> <span class="DecNumber">0x40000000</span></pre></dt>
<dd>
Event occurred against dir.
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/posix/inotify.nim#L54" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/posix/inotify.nim#L54" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="IN_MASK_ADD">
<dt><pre><a href="inotify.html#IN_MASK_ADD"><span class="Identifier">IN_MASK_ADD</span></a> <span class="Other">=</span> <span class="DecNumber">0x20000000</span></pre></dt>
<dd>
Add to the mask of an already existing watch.
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/posix/inotify.nim#L53" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/posix/inotify.nim#L53" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="IN_MODIFY">
<dt><pre><a href="inotify.html#IN_MODIFY"><span class="Identifier">IN_MODIFY</span></a> <span class="Other">=</span> <span class="DecNumber">0x00000002</span></pre></dt>
<dd>
File was modified.
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/posix/inotify.nim#L28" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/posix/inotify.nim#L28" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="IN_MOVE">
<dt><pre><a href="inotify.html#IN_MOVE"><span class="Identifier">IN_MOVE</span></a> <span class="Other">=</span> <span class="DecNumber">192</span></pre></dt>
<dd>
Moves.
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/posix/inotify.nim#L36" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/posix/inotify.nim#L36" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="IN_MOVE_SELF">
<dt><pre><a href="inotify.html#IN_MOVE_SELF"><span class="Identifier">IN_MOVE_SELF</span></a> <span class="Other">=</span> <span class="DecNumber">0x00000800</span></pre></dt>
<dd>
Self was moved.
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/posix/inotify.nim#L40" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/posix/inotify.nim#L40" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="IN_MOVED_FROM">
<dt><pre><a href="inotify.html#IN_MOVED_FROM"><span class="Identifier">IN_MOVED_FROM</span></a> <span class="Other">=</span> <span class="DecNumber">0x00000040</span></pre></dt>
<dd>
File was moved from X.
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/posix/inotify.nim#L34" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/posix/inotify.nim#L34" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="IN_MOVED_TO">
<dt><pre><a href="inotify.html#IN_MOVED_TO"><span class="Identifier">IN_MOVED_TO</span></a> <span class="Other">=</span> <span class="DecNumber">0x00000080</span></pre></dt>
<dd>
File was moved to Y.
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/posix/inotify.nim#L35" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/posix/inotify.nim#L35" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="IN_ONESHOT">
<dt><pre><a href="inotify.html#IN_ONESHOT"><span class="Identifier">IN_ONESHOT</span></a> <span class="Other">=</span> <span class="DecNumber">0x0000000080000000'i64</span></pre></dt>
<dd>
Only send event once.
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/posix/inotify.nim#L55" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/posix/inotify.nim#L55" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="IN_ONLYDIR">
<dt><pre><a href="inotify.html#IN_ONLYDIR"><span class="Identifier">IN_ONLYDIR</span></a> <span class="Other">=</span> <span class="DecNumber">0x01000000</span></pre></dt>
<dd>
Only watch the path if it is a directory.
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/posix/inotify.nim#L50" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/posix/inotify.nim#L50" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="IN_OPEN">
<dt><pre><a href="inotify.html#IN_OPEN"><span class="Identifier">IN_OPEN</span></a> <span class="Other">=</span> <span class="DecNumber">0x00000020</span></pre></dt>
<dd>
File was opened.
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/posix/inotify.nim#L33" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/posix/inotify.nim#L33" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="IN_Q_OVERFLOW">
<dt><pre><a href="inotify.html#IN_Q_OVERFLOW"><span class="Identifier">IN_Q_OVERFLOW</span></a> <span class="Other">=</span> <span class="DecNumber">0x00004000</span></pre></dt>
<dd>
Event queued overflowed.
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/posix/inotify.nim#L45" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/posix/inotify.nim#L45" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="IN_UNMOUNT">
<dt><pre><a href="inotify.html#IN_UNMOUNT"><span class="Identifier">IN_UNMOUNT</span></a> <span class="Other">=</span> <span class="DecNumber">0x00002000</span></pre></dt>
<dd>
Backing fs was unmounted.
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/posix/inotify.nim#L44" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/posix/inotify.nim#L44" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</dl>
</div>
<div class="section" id="12">
<h1><a class="toc-backref" href="#12">Procs</a></h1>
<dl class="item">
<div id="inotify_add_watch-procs-all">
<div id="inotify_add_watch,cint,cstring,uint32">
<dt><pre><span class="Keyword">proc</span> <a href="#inotify_add_watch%2Ccint%2Ccstring%2Cuint32"><span class="Identifier">inotify_add_watch</span></a><span class="Other">(</span><span class="Identifier">fd</span><span class="Other">:</span> <a href="ctypes.html#cint"><span class="Identifier">cint</span></a><span class="Other">;</span> <span class="Identifier">name</span><span class="Other">:</span> <a href="system.html#cstring"><span class="Identifier">cstring</span></a><span class="Other">;</span> <span class="Identifier">mask</span><span class="Other">:</span> <a href="system.html#uint32"><span class="Identifier">uint32</span></a><span class="Other">)</span><span class="Other">:</span> <a href="ctypes.html#cint"><span class="Identifier">cint</span></a> {.<span class="Identifier">cdecl</span><span class="Other">,</span>
<span class="Identifier">importc</span><span class="Other">:</span> <span class="StringLit">&quot;inotify_add_watch&quot;</span><span class="Other">,</span> <span class="Identifier">header</span><span class="Other">:</span> <span class="StringLit">&quot;&lt;sys/inotify.h&gt;&quot;</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Add watch of object NAME to inotify instance FD. Notify about events specified by MASK.
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/posix/inotify.nim#L73" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/posix/inotify.nim#L73" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="inotify_init-procs-all">
<div id="inotify_init">
<dt><pre><span class="Keyword">proc</span> <a href="#inotify_init"><span class="Identifier">inotify_init</span></a><span class="Other">(</span><span class="Other">)</span><span class="Other">:</span> <a href="syncio.html#FileHandle"><span class="Identifier">FileHandle</span></a> {.<span class="Identifier">cdecl</span><span class="Other">,</span> <span class="Identifier">importc</span><span class="Other">:</span> <span class="StringLit">&quot;inotify_init&quot;</span><span class="Other">,</span>
<span class="Identifier">header</span><span class="Other">:</span> <span class="StringLit">&quot;&lt;sys/inotify.h&gt;&quot;</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Create and initialize inotify instance.
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/posix/inotify.nim#L64" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/posix/inotify.nim#L64" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="inotify_init1-procs-all">
<div id="inotify_init1,cint">
<dt><pre><span class="Keyword">proc</span> <a href="#inotify_init1%2Ccint"><span class="Identifier">inotify_init1</span></a><span class="Other">(</span><span class="Identifier">flags</span><span class="Other">:</span> <a href="ctypes.html#cint"><span class="Identifier">cint</span></a><span class="Other">)</span><span class="Other">:</span> <a href="syncio.html#FileHandle"><span class="Identifier">FileHandle</span></a> {.<span class="Identifier">cdecl</span><span class="Other">,</span> <span class="Identifier">importc</span><span class="Other">:</span> <span class="StringLit">&quot;inotify_init1&quot;</span><span class="Other">,</span>
<span class="Identifier">header</span><span class="Other">:</span> <span class="StringLit">&quot;&lt;sys/inotify.h&gt;&quot;</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Like <a class="reference external" href="#inotify_init">inotify_init</a> , but has a flags argument that provides access to some extra functionality.
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/posix/inotify.nim#L68" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/posix/inotify.nim#L68" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="inotify_rm_watch-procs-all">
<div id="inotify_rm_watch,cint,cint">
<dt><pre><span class="Keyword">proc</span> <a href="#inotify_rm_watch%2Ccint%2Ccint"><span class="Identifier">inotify_rm_watch</span></a><span class="Other">(</span><span class="Identifier">fd</span><span class="Other">:</span> <a href="ctypes.html#cint"><span class="Identifier">cint</span></a><span class="Other">;</span> <span class="Identifier">wd</span><span class="Other">:</span> <a href="ctypes.html#cint"><span class="Identifier">cint</span></a><span class="Other">)</span><span class="Other">:</span> <a href="ctypes.html#cint"><span class="Identifier">cint</span></a> {.<span class="Identifier">cdecl</span><span class="Other">,</span>
<span class="Identifier">importc</span><span class="Other">:</span> <span class="StringLit">&quot;inotify_rm_watch&quot;</span><span class="Other">,</span> <span class="Identifier">header</span><span class="Other">:</span> <span class="StringLit">&quot;&lt;sys/inotify.h&gt;&quot;</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Remove the watch specified by WD from the inotify instance FD.
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/posix/inotify.nim#L77" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/posix/inotify.nim#L77" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
</dl>
</div>
<div class="section" id="15">
<h1><a class="toc-backref" href="#15">Iterators</a></h1>
<dl class="item">
<div id="inotify_events-iterators-all">
<div id="inotify_events.i,pointer,int">
<dt><pre><span class="Keyword">iterator</span> <a href="#inotify_events.i%2Cpointer%2Cint"><span class="Identifier">inotify_events</span></a><span class="Other">(</span><span class="Identifier">evs</span><span class="Other">:</span> <a href="system.html#pointer"><span class="Identifier">pointer</span></a><span class="Other">;</span> <span class="Identifier">n</span><span class="Other">:</span> <a href="system.html#int"><span class="Identifier">int</span></a><span class="Other">)</span><span class="Other">:</span> <span class="Keyword">ptr</span> <a href="inotify.html#InotifyEvent"><span class="Identifier">InotifyEvent</span></a> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Abstract the packed buffer interface to yield event object pointers.
<p><strong class="examples_text">Example: cmd: -r:off</strong></p>
<pre class="listing"><span class="Keyword">when</span> <span class="Identifier">defined</span><span class="Punctuation">(</span><span class="Identifier">linux</span><span class="Punctuation">)</span><span class="Punctuation">:</span>
<span class="Keyword">import</span> <span class="Identifier">std</span><span class="Operator">/</span><span class="Identifier">posix</span> <span class="Comment"># needed for FileHandle read procedure</span>
<span class="Keyword">const</span> <span class="Identifier">MaxWatches</span> <span class="Operator">=</span> <span class="DecNumber">8192</span>
<span class="Keyword">let</span> <span class="Identifier">inotifyFd</span> <span class="Operator">=</span> <span class="Identifier">inotify_init</span><span class="Punctuation">(</span><span class="Punctuation">)</span> <span class="Comment"># create new inotify instance and get it's FileHandle</span>
<span class="Keyword">let</span> <span class="Identifier">wd</span> <span class="Operator">=</span> <span class="Identifier">inotifyFd</span><span class="Operator">.</span><span class="Identifier">inotify_add_watch</span><span class="Punctuation">(</span><span class="StringLit">&quot;/tmp&quot;</span><span class="Punctuation">,</span> <span class="Identifier">IN_CREATE</span> <span class="Keyword">or</span> <span class="Identifier">IN_DELETE</span><span class="Punctuation">)</span> <span class="Comment"># Add new watch</span>
<span class="Keyword">var</span> <span class="Identifier">events</span><span class="Punctuation">:</span> <span class="Identifier">array</span><span class="Punctuation">[</span><span class="Identifier">MaxWatches</span><span class="Punctuation">,</span> <span class="Identifier">byte</span><span class="Punctuation">]</span> <span class="Comment"># event buffer</span>
<span class="Keyword">while</span> <span class="Punctuation">(</span><span class="Keyword">let</span> <span class="Identifier">n</span> <span class="Operator">=</span> <span class="Identifier">read</span><span class="Punctuation">(</span><span class="Identifier">inotifyFd</span><span class="Punctuation">,</span> <span class="Keyword">addr</span> <span class="Identifier">events</span><span class="Punctuation">,</span> <span class="Identifier">MaxWatches</span><span class="Punctuation">)</span><span class="Punctuation">;</span> <span class="Identifier">n</span><span class="Punctuation">)</span> <span class="Operator">&gt;</span> <span class="DecNumber">0</span><span class="Punctuation">:</span> <span class="Comment"># blocks until any events have been read</span>
<span class="Keyword">for</span> <span class="Identifier">e</span> <span class="Keyword">in</span> <span class="Identifier">inotify_events</span><span class="Punctuation">(</span><span class="Keyword">addr</span> <span class="Identifier">events</span><span class="Punctuation">,</span> <span class="Identifier">n</span><span class="Punctuation">)</span><span class="Punctuation">:</span>
<span class="Identifier">echo</span> <span class="Punctuation">(</span><span class="Identifier">e</span><span class="Punctuation">[</span><span class="Punctuation">]</span><span class="Operator">.</span><span class="Identifier">wd</span><span class="Punctuation">,</span> <span class="Identifier">e</span><span class="Punctuation">[</span><span class="Punctuation">]</span><span class="Operator">.</span><span class="Identifier">mask</span><span class="Punctuation">,</span> <span class="Keyword">cast</span><span class="Punctuation">[</span><span class="Identifier">cstring</span><span class="Punctuation">]</span><span class="Punctuation">(</span><span class="Keyword">addr</span> <span class="Identifier">e</span><span class="Punctuation">[</span><span class="Punctuation">]</span><span class="Operator">.</span><span class="Identifier">name</span><span class="Punctuation">)</span><span class="Punctuation">)</span> <span class="Comment"># echo watch id, mask, and name value of each event</span></pre>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/posix/inotify.nim#L81" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/posix/inotify.nim#L81" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
</dl>
</div>
</div>
</div>
<div class="twelve-columns footer">
<span class="nim-sprite"></span>
<br>
<small style="color: var(--hint);">Made with Nim. Generated: 2025-12-28 15:54:34 UTC</small>
</div>
</div>
</div>
<script defer data-domain="nim-lang.org" src="https://plausible.io/js/plausible.js"></script>
</body>
</html>