inotify.py 文件源码

python
阅读 26 收藏 0 点赞 0 评论 0

项目:centos-base-consul 作者: zeroc0d3lab 项目源码 文件源码
def __init__(self, cloexec=True, nonblock=True):
        self._init1, self._add_watch, self._rm_watch, self._read = load_inotify()
        flags = 0
        if cloexec:
            flags |= self.CLOEXEC
        if nonblock:
            flags |= self.NONBLOCK
        self._inotify_fd = self._init1(flags)
        if self._inotify_fd == -1:
            raise INotifyError(os.strerror(ctypes.get_errno()))

        self._buf = ctypes.create_string_buffer(5000)
        self.fenc = get_preferred_file_name_encoding()
        self.hdr = struct.Struct(b'iIII')
        # We keep a reference to os to prevent it from being deleted
        # during interpreter shutdown, which would lead to errors in the
        # __del__ method
        self.os = os
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号