Ϫf <dZddlZddlZddlmZmZddlmZGddeZ de fdZ d e d eed e de fd Z d e d e ddfdZ dejddfdZej j#dZesedej(j+eZeey)z Very low-level ctypes-based interface to Linux inotify(7). ctypes and a version of libc which supports inotify system calls are required. N)Anycast)FilePathceZdZdZy) INotifyErrorzR Unify all the possible exceptions that can be raised by the INotify API. N)__name__ __module__ __qualname____doc__9/usr/lib/python3/dist-packages/twisted/python/_inotify.pyrrsr rreturncjtttj}|dkr t d|S)zO Create an inotify instance and return the associated file descriptor. rzINotify initialization error.)rintlibc inotify_initr)fds rinitrs1 c4$$& 'B Av:;; Ir rpathmaskctttj||j j |}|dkrt d|d|d|S)a/ Add a watch for the given path to the inotify file descriptor, and return the watch descriptor. @param fd: The file descriptor returned by C{libc.inotify_init}. @param path: The path to watch via inotify. @param mask: Bitmask specifying the events that inotify should monitor. rzFailed to add watch on 'z' - ())rrrinotify_add_watch asBytesModerr)rrrwds raddr#sU c4))"d.>.>.@.E.EtL MB Av5dXU2&JKK Ir rc0tj||y)zM Remove the given watch descriptor from the inotify file descriptor. N)rinotify_rm_watch)rrs rremover 2s0 "b!r rcdD]}t||dtdg|j_tj |j_tj tj g|j_tj |j_tj tjtjg|j_tj |j_y)z Initialize the module, checking if the expected APIs exist and setting the argtypes and restype for C{inotify_init}, C{inotify_add_watch}, and C{inotify_rm_watch}. )rrrNzlibc6 2.4 or higher needed) getattr ImportErrorrargtypesctypesc_intrestyperc_char_pc_uint32r)rfunctions rinitializeModuler+Ms N< 44 ( 0:; ;<"$D & D&,llFLL%AD"$*LLD!'-||V__foo&VD#%+\\D"r czCan't find C library.)r r% ctypes.utiltypingrrtwisted.python.filepathr Exceptionrrrrr CDLLr+util find_librarynamer#cdll LoadLibraryrr r rr7s ,9 c C x} C C "s"""626;;242&{{$ - .. {{t$r