Kqueue (with edge): does short reading mean that readiness has been lost?

When working with Linux epoll in run mode at the edges ( EPOLLET) and with a read / write error with EAGAIN/, EWOULDBLOCKthis means that the read / write was lost and that the new ready condition will be available through epoll_wait()as soon as the readiness is restored.

In addition, when working with Linux epoll in the mode with boundary start and non-blocking streaming mode socker and provided that we registered an interest in events EPOLLRDHUPand that the EPOLLRDHUPevent was not received, a short read / write (return value is less than the requested size) also means a loss of readiness read / write, and we can still rely on a new readiness notification when readiness is restored, even if the read / write is in error EAGAIN/ EWOULDBLOCK.

Similarly, when working with Kqueue (macOS / FreeBSD) in edge-start mode ( EV_CLEAR) and reading / writing with EAGAIN/ fails EWOULDBLOCK, this means that read / write readiness has been lost and that when ready for new readiness will be available through kevent().

Question: When working with Kqueue in the mode with boundary mode and non-blocking juice stream mode and provided that we have registered interest in events EV_EOFand that the event EV_EOFhas not yet been received, is there a similar guarantee that a short read / write means that read / write is not ready and what, when preparedness ready, will a new preparedness event be achieved?

EDIT: Note. Knowing that a short read means a loss of readiness allows me (in the general case) to avoid an excessive call read()only to receive EAGAIN/ EWOULDBLOCK.

The meaning of short read / write in the context of Linux epoll follows from this comment in the epoll(7) man page:

, (, pipe, FIFO, stream socket), , - / , , / . , read (2), , read (2) , , - . write (2). ( , , , .) ​​

+4
1

" Kqueue ), kqueue . , , EV_CLEAR , ,

, , reset.

( BSD kqueue())

, ,

EV_EOF EV_EOF

EV_EOF ; , , , , EVFILT_READ.

,

, / ?

, , , BSD, Linux. , Linux read(2) .

, , Linux epoll() docs , , , EAGAIN, . kqueue , EV_CLEAR.

, read(), , , , . , , , , .

0

Source: https://habr.com/ru/post/1658165/


All Articles