Mat*_*man 6 c sockets macos operating-system kqueue
kqueue(在OS X上)是否对读/写常规文件有用?我知道,epoll的是不是在Linux上常规文件有用的,所以我想知道如果同样是kqueue的事实.
编辑:我不是指读/写文件,显然read()和write()都是为了这个.我的意思是,"kqueue实际上对检测文件何时可读/可写有用吗?"
小智 1
是的,kqueue 可用于监视文件的可读性。从手册页:
 EVFILT_READ      Takes a file descriptor as the identifier, and returns
                  whenever there is data available to read.  The behavior
                  of the filter is slightly different depending on the
                  descriptor type.
 [...]
                  Vnodes
                      Returns when the file pointer is not at the end of
                      file.  data contains the offset from current posi-
                      tion to end of file, and may be negative.
Run Code Online (Sandbox Code Playgroud)
(在此上下文中,“vnode”是常规文件。)
EVFILT_WRITE由于常规文件始终是可写的,因此应用于它们是没有意义的。
|   归档时间:  |  
           
  |  
        
|   查看次数:  |  
           648 次  |  
        
|   最近记录:  |