NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: kern/60786: poll reports socket writable after shutdown(SHUT_WR)



The following reply was made to PR kern/60786; it has been noted by GNATS.

From: Robert Elz <kre%munnari.OZ.AU@localhost>
To: gnats-bugs%netbsd.org@localhost
Cc: 
Subject: Re: kern/60786: poll reports socket writable after shutdown(SHUT_WR)
Date: Fri, 25 Sep 2026 05:49:25 +0700

     Date:        Thu, 24 Sep 2026 22:05:00 +0000 (UTC)
     From:        "campbell+netbsd%mumble.net@localhost via gnats" <gnats-admin%NetBSD.org@localhost>
     Message-ID:  <20260924220500.D099A1A923E%mollari.NetBSD.org@localhost>
 
   | 	I don't know if there's language in POSIX about this but surely
   | 	it is nonsensical for poll to claim that a socket is writable
   | 	after it has been shut down in the writing direction!
 
 poll() (and select()) have never claimed anything was writable or
 readable - they merely indicate whether or not a write (or read) will
 hang if attempted at the time of the poll/select (and assuming some
 other process/thread isn't manipulating the same object).
 
 If you want to know if something is writable, write() to it.   If you
 don't want the possibility of a hang while doing that, do a poll first,
 if that indicates no hang will occur, do a write() (and if you really
 want to be certain, turn on O_NONBLOCK as well).   If the fd is closed,
 shut down, revoked, or similar, the write will return an error.
 
 kre
 



Home | Main Index | Thread Index | Old Index