123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547 |
- <?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: </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: "struct inotify_event",
- header: "<sys/inotify.h>", completeStruct.} = object
- wd* {.importc: "wd".}: FileHandle ## Watch descriptor.
- mask* {.importc: "mask".}: uint32 ## Watch mask.
- cookie* {.importc: "cookie".}: uint32 ## Cookie to synchronize two events.
- len* {.importc: "len".}: uint32 ## Length (including NULs) of name.
- name* {.importc: "name".}: 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>
- <a href="https://github.com/nim-lang/Nim/edit/devel/lib/posix/inotify.nim#L1" class="link-seesrc" target="_blank" >Edit</a>
- <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">>=</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">"/tmp"</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">>=</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">"struct inotify_event"</span><span class="Other">,</span>
- <span class="Identifier">header</span><span class="Other">:</span> <span class="StringLit">"<sys/inotify.h>"</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">"wd"</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">"mask"</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">"cookie"</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">"len"</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">"name"</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>
- <a href="https://github.com/nim-lang/Nim/edit/devel/lib/posix/inotify.nim#L18" class="link-seesrc" target="_blank" >Edit</a>
- </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>
- <a href="https://github.com/nim-lang/Nim/edit/devel/lib/posix/inotify.nim#L27" class="link-seesrc" target="_blank" >Edit</a>
- </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>
- <a href="https://github.com/nim-lang/Nim/edit/devel/lib/posix/inotify.nim#L59" class="link-seesrc" target="_blank" >Edit</a>
- </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>
- <a href="https://github.com/nim-lang/Nim/edit/devel/lib/posix/inotify.nim#L29" class="link-seesrc" target="_blank" >Edit</a>
- </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>
- <a href="https://github.com/nim-lang/Nim/edit/devel/lib/posix/inotify.nim#L32" class="link-seesrc" target="_blank" >Edit</a>
- </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>
- <a href="https://github.com/nim-lang/Nim/edit/devel/lib/posix/inotify.nim#L31" class="link-seesrc" target="_blank" >Edit</a>
- </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>
- <a href="https://github.com/nim-lang/Nim/edit/devel/lib/posix/inotify.nim#L30" class="link-seesrc" target="_blank" >Edit</a>
- </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>
- <a href="https://github.com/nim-lang/Nim/edit/devel/lib/posix/inotify.nim#L37" class="link-seesrc" target="_blank" >Edit</a>
- </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>
- <a href="https://github.com/nim-lang/Nim/edit/devel/lib/posix/inotify.nim#L38" class="link-seesrc" target="_blank" >Edit</a>
- </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>
- <a href="https://github.com/nim-lang/Nim/edit/devel/lib/posix/inotify.nim#L39" class="link-seesrc" target="_blank" >Edit</a>
- </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>
- <a href="https://github.com/nim-lang/Nim/edit/devel/lib/posix/inotify.nim#L51" class="link-seesrc" target="_blank" >Edit</a>
- </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>
- <a href="https://github.com/nim-lang/Nim/edit/devel/lib/posix/inotify.nim#L52" class="link-seesrc" target="_blank" >Edit</a>
- </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>
- <a href="https://github.com/nim-lang/Nim/edit/devel/lib/posix/inotify.nim#L46" class="link-seesrc" target="_blank" >Edit</a>
- </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>
- <a href="https://github.com/nim-lang/Nim/edit/devel/lib/posix/inotify.nim#L54" class="link-seesrc" target="_blank" >Edit</a>
- </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>
- <a href="https://github.com/nim-lang/Nim/edit/devel/lib/posix/inotify.nim#L53" class="link-seesrc" target="_blank" >Edit</a>
- </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>
- <a href="https://github.com/nim-lang/Nim/edit/devel/lib/posix/inotify.nim#L28" class="link-seesrc" target="_blank" >Edit</a>
- </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>
- <a href="https://github.com/nim-lang/Nim/edit/devel/lib/posix/inotify.nim#L36" class="link-seesrc" target="_blank" >Edit</a>
- </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>
- <a href="https://github.com/nim-lang/Nim/edit/devel/lib/posix/inotify.nim#L40" class="link-seesrc" target="_blank" >Edit</a>
- </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>
- <a href="https://github.com/nim-lang/Nim/edit/devel/lib/posix/inotify.nim#L34" class="link-seesrc" target="_blank" >Edit</a>
- </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>
- <a href="https://github.com/nim-lang/Nim/edit/devel/lib/posix/inotify.nim#L35" class="link-seesrc" target="_blank" >Edit</a>
- </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>
- <a href="https://github.com/nim-lang/Nim/edit/devel/lib/posix/inotify.nim#L55" class="link-seesrc" target="_blank" >Edit</a>
- </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>
- <a href="https://github.com/nim-lang/Nim/edit/devel/lib/posix/inotify.nim#L50" class="link-seesrc" target="_blank" >Edit</a>
- </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>
- <a href="https://github.com/nim-lang/Nim/edit/devel/lib/posix/inotify.nim#L33" class="link-seesrc" target="_blank" >Edit</a>
- </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>
- <a href="https://github.com/nim-lang/Nim/edit/devel/lib/posix/inotify.nim#L45" class="link-seesrc" target="_blank" >Edit</a>
- </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>
- <a href="https://github.com/nim-lang/Nim/edit/devel/lib/posix/inotify.nim#L44" class="link-seesrc" target="_blank" >Edit</a>
- </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">"inotify_add_watch"</span><span class="Other">,</span> <span class="Identifier">header</span><span class="Other">:</span> <span class="StringLit">"<sys/inotify.h>"</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>
- <a href="https://github.com/nim-lang/Nim/edit/devel/lib/posix/inotify.nim#L73" class="link-seesrc" target="_blank" >Edit</a>
- </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">"inotify_init"</span><span class="Other">,</span>
- <span class="Identifier">header</span><span class="Other">:</span> <span class="StringLit">"<sys/inotify.h>"</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>
- <a href="https://github.com/nim-lang/Nim/edit/devel/lib/posix/inotify.nim#L64" class="link-seesrc" target="_blank" >Edit</a>
- </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">"inotify_init1"</span><span class="Other">,</span>
- <span class="Identifier">header</span><span class="Other">:</span> <span class="StringLit">"<sys/inotify.h>"</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>
- <a href="https://github.com/nim-lang/Nim/edit/devel/lib/posix/inotify.nim#L68" class="link-seesrc" target="_blank" >Edit</a>
- </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">"inotify_rm_watch"</span><span class="Other">,</span> <span class="Identifier">header</span><span class="Other">:</span> <span class="StringLit">"<sys/inotify.h>"</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>
- <a href="https://github.com/nim-lang/Nim/edit/devel/lib/posix/inotify.nim#L77" class="link-seesrc" target="_blank" >Edit</a>
- </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">"/tmp"</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">></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>
- <a href="https://github.com/nim-lang/Nim/edit/devel/lib/posix/inotify.nim#L81" class="link-seesrc" target="_blank" >Edit</a>
- </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-02-03 14:57:21 UTC</small>
- </div>
- </div>
- </div>
- <script defer data-domain="nim-lang.org" src="https://plausible.io/js/plausible.js"></script>
-
- </body>
- </html>
|