Documentation, add more examples (#13825)

This commit is contained in:
Juan Carlos 2020-04-01 14:39:58 -03:00 • committed by GitHub
commit 4816984726
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 26 additions and 12 deletions

View file

@ -70,3 +70,13 @@ proc inotify_add_watch*(fd: cint; name: cstring; mask: uint32): cint{.
# Remove the watch specified by WD from the inotify instance FD.
proc inotify_rm_watch*(fd: cint; wd: cint): cint{.cdecl,
importc: "inotify_rm_watch", header: "<sys/inotify.h>".}
runnableExamples:
when defined(linux):
block:
let inoty: cint = inotify_init() ## Create 1 Inotify.
doAssert inoty >= 0 ## Check for errors.
let watchdoge: cint = inotify_add_watch(inoty, ".", IN_ALL_EVENTS) ## Add directory to watchdog.
doAssert watchdoge >= 0 ## Check for errors.
doAssert inotify_rm_watch(inoty, watchdoge) >= 0 ## Remove directory from the watchdog