§
    Ètºf²  ã                   óH  — d Z ddlZddlZddlmZmZ ddlmZ  G d„ de¦  «        Z	de
fd„Zd	e
d
ee         de
de
fd„Zd	e
de
ddfd„Zdej        ddfd„Zej                             d¦  «        Zes ed¦  «        ‚ej                             e¦  «        Z ee¦  «         dS )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)ÚAnyÚcast)ÚFilePathc                   ó   — e Zd ZdZdS )ÚINotifyErrorzR
    Unify all the possible exceptions that can be raised by the INotify API.
    N)Ú__name__Ú
__module__Ú__qualname__Ú__doc__© ó    úV/var/www/surfInsights/venv3-11/lib/python3.11/site-packages/twisted/python/_inotify.pyr   r      s   € € € € € ðð ð ð r   r   Úreturnc                  óˆ   — t          t          t                               ¦   «         ¦  «        } | dk     rt	          d¦  «        ‚| S )zO
    Create an inotify instance and return the associated file descriptor.
    r   zINotify initialization error.)r   ÚintÚlibcÚinotify_initr   )Úfds    r   Úinitr      s<   € õ 
�c•4×$Ò$Ñ&Ô&Ñ	'Ô	'€BØ	ˆA‚v€vÝÐ:Ñ;Ô;Ð;Ø€Ir   r   ÚpathÚmaskc                 óÊ   — t          t          t                               | |                     ¦   «         j        |¦  «        ¦  «        }|dk     rt          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.
    r   zFailed to add watch on 'z' - (ú))r   r   r   Úinotify_add_watchÚasBytesModer   r   )r   r   r   Úwds       r   Úaddr   #   sd   € õ 
�c•4×)Ò)¨"¨d×.>Ò.>Ñ.@Ô.@Ô.EÀtÑLÔLÑ	MÔ	M€BØ	ˆA‚v€vÝÐJ°dÐJÐJÀ2ÐJÐJÐJÑKÔKÐKØ€Ir   r   c                 ó<   — t                                | |¦  «         dS )zM
    Remove the given watch descriptor from the inotify file descriptor.
    N)r   Úinotify_rm_watch)r   r   s     r   Úremover    2   s    € õ0 	×Ò˜"˜bÑ!Ô!Ð!Ð!Ð!r   r   c                 óŠ  — dD ]"}t          | |d¦  «        €t          d¦  «        ‚Œ#g | j        _        t          j        | j        _        t          j        t          j        g| j        _        t          j        | j        _        t          j        t          j        t          j	        g| j
        _        t          j        | j
        _        dS )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}.
    )r   r   r   Nzlibc6 2.4 or higher needed)ÚgetattrÚImportErrorr   ÚargtypesÚctypesÚc_intÚrestyper   Úc_char_pÚc_uint32r   )r   Úfunctions     r   ÚinitializeModuler+   M   sž   € ð Nð <ð <ˆÝ�4˜ 4Ñ(Ô(Ð0ÝÐ:Ñ;Ô;Ð;ð 1à!#€DÔÔÝ &¤€DÔÔå&,¤lµF´LÐ%A€DÔÔ"Ý$*¤L€DÔÔ!å'-¤|µV´_ÅfÄoÐ&V€DÔÔ#Ý%+¤\€DÔÔ"Ð"Ð"r   ÚczCan't find C library.)r   r%   Úctypes.utilÚtypingr   r   Útwisted.python.filepathr   Ú	Exceptionr   r   r   r   r    ÚCDLLr+   ÚutilÚfind_libraryÚnamer#   ÚcdllÚLoadLibraryr   r   r   r   ú<module>r7      sr  ðð
ð ð €€€Ø Ð Ð Ð Ø Ð Ð Ð Ð Ð Ð Ð à ,Ð ,Ð ,Ð ,Ð ,Ð ,ðð ð ð ð �9ñ ô ð ðˆcð ð ð ð ðˆCð �x ”}ð ¨Cð °Cð ð ð ð ð"ˆsð "˜ð " ð "ð "ð "ð "ð62˜6œ;ð 2¨4ð 2ð 2ð 2ð 2ð& „{×Ò Ñ$Ô$€Øð /Ø
ˆ+Ð-Ñ
.Ô
.Ð.Ø„{×Ò˜tÑ$Ô$€Ø Ð �Ñ Ô Ð Ð Ð r   