diff options
author | ed <ed@FreeBSD.org> | 2015-08-05 07:34:29 +0000 |
---|---|---|
committer | ed <ed@FreeBSD.org> | 2015-08-05 07:34:29 +0000 |
commit | 4a54322f0b8dcd72b1946004f9b964ef0093af1a (patch) | |
tree | 0e4fdb0a44c0bf8b91e9306d51abf85405ebba59 /lib | |
parent | 15c1eedd90810a194d5eb7c501b5c7519bd9347c (diff) | |
download | FreeBSD-src-4a54322f0b8dcd72b1946004f9b964ef0093af1a.zip FreeBSD-src-4a54322f0b8dcd72b1946004f9b964ef0093af1a.tar.gz |
Make it possible to implement poll(2) on top of kqueue(2).
It looks like EVFILT_READ and EVFILT_WRITE trigger under the same
conditions as poll()'s POLLRDNORM and POLLWRNORM as described by POSIX.
The only difference is that POLLRDNORM has to be triggered on regular
files unconditionally, whereas EVFILT_READ only triggers when not EOF.
Introduce a new flag, NOTE_FILE_POLL, that can be used to make
EVFILT_READ and EVFILT_WRITE behave identically to poll(). This flag
will be used by cloudlibc's poll() function.
Reviewed by: jmg
Differential Revision: https://reviews.freebsd.org/D3303
Diffstat (limited to 'lib')
-rw-r--r-- | lib/libc/sys/kqueue.2 | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/lib/libc/sys/kqueue.2 b/lib/libc/sys/kqueue.2 index c5e8caf..ca94852 100644 --- a/lib/libc/sys/kqueue.2 +++ b/lib/libc/sys/kqueue.2 @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd March 29, 2015 +.Dd August 4, 2015 .Dt KQUEUE 2 .Os .Sh NAME @@ -288,6 +288,14 @@ Returns when the file pointer is not at the end of file. .Va data contains the offset from current position to end of file, and may be negative. +.Pp +This behavior is different from +.Xr poll 2 , +where read events are triggered for regular files unconditionally. +This event can be triggered unconditionally by setting the +.Dv NOTE_FILE_POLL +flag in +.Va fflags . .It "Fifos, Pipes" Returns when the there is data to read; .Va data |