Your IP : 216.73.216.213
B
:��]
� @ st d Z ddlZddlZG dd� de�Zdd� Zdd� Zd d
� Zdd� Zej �
d
�Zes\ed��ej
�e�Zee� dS )z�
Very low-level ctypes-based interface to Linux inotify(7).
ctypes and a version of libc which supports inotify system calls are
required.
� Nc @ s e Zd ZdZdS )�INotifyErrorzR
Unify all the possible exceptions that can be raised by the INotify API.
N)�__name__�
__module__�__qualname__�__doc__� r r �J/opt/alt/python37/lib64/python3.7/site-packages/twisted/python/_inotify.pyr s r c C s t �� } | dk rtd��| S )zO
Create an inotify instance and return the associated file descriptor.
r zINotify initialization error.)�libc�inotify_initr )�fdr r r �init s r c C s0 t �| |�� j|�}|dk r,td||f ��|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}.
@type fd: L{int}
@param path: The path to watch via inotify.
@type path: L{twisted.python.filepath.FilePath}
@param mask: Bitmask specifying the events that inotify should monitor.
@type mask: L{int}
r z"Failed to add watch on '%r' - (%r))r �inotify_add_watchZasBytesMode�pathr )r r �mask�wdr r r �add# s r c C s t �| |� dS )zM
Remove the given watch descriptor from the inotify file descriptor.
N)r �inotify_rm_watch)r r r r r �remove8 s r c C st x$dD ]}t | |d�dkrtd��qW g | j_tj| j_tjtjg| j_tj| j_tjtjtj g| j
_tj| j
_dS )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 Nzlibc6 2.4 or higher needed)�getattr�ImportErrorr
�argtypes�ctypes�c_int�restyper �c_char_p�c_uint32r
)r �functionr r r �initializeModuleT s
r �czCan't find C library.)r r Zctypes.util� Exceptionr r r r r �utilZfind_library�namer �cdll�LoadLibraryr r r r r �<module>
s