git: kernel - make POLLHUP conform better to OpenGroup

看板DFBSD_commit作者時間15年前 (2010/08/14 06:32), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串1/1
commit 9a5d20db2b31ebaf094a3cb60c7342b1026f2947 Author: Matthew Dillon <dillon@apollo.backplane.com> Date: Fri Aug 13 15:06:12 2010 -0700 kernel - make POLLHUP conform better to OpenGroup * The poll() backend now only evaluates EV_EOF for EVFILT_WRITE, and generates a POLLHUP which is properly mutually exclusive with POLLWRNORM and POLLOUT. We do this even for a half-closed (write-side-closed) socket. * We no longer set POLLHUP for POLLRD* or POLLIN, instead relying on the userland doing the read() and checking the 0 result (which userland has always done historically). EV_EOF for EVFILT_READ cannot be used to set POLLHUP for POLLRD* or POLLIN because it could indicate a half-closed connection (read-side-closed) where writing is still allowed, which is a more common situation on sockets. We would have to add another EV_ flag to set POLLHUP for POLLRD* or POLLIN to detect the fully disconnected state. The OpenGroup standard does allow POLLHUP to be mixed with POLLRD* or POLLIN but for now we just don't set it at all in that case. Only a POLLOUT/POLLWRNORM flag request can cause POLLHUP to be set for now. Summary of changes: sys/kern/sys_generic.c | 37 ++++++++++++++++++++++++++++++------- 1 files changed, 30 insertions(+), 7 deletions(-) http://gitweb.dragonflybsd.org/dragonfly.git/commitdiff/9a5d20db2b31ebaf094a3cb60c7342b1026f2947 -- DragonFly BSD source repository
文章代碼(AID): #1CPSVbbQ (DFBSD_commit)