svn commit: r196460 - head/sys/kern

Jilles Tjoelker jilles at stack.nl
Wed Aug 26 22:38:05 UTC 2009


On Wed, Aug 26, 2009 at 05:08:57PM +1000, Bruce Evans wrote:
> On Tue, 25 Aug 2009, Jilles Tjoelker wrote:
> > On Tue, Aug 25, 2009 at 04:07:11AM +1000, Bruce Evans wrote:
> >> On Sun, 23 Aug 2009, Jilles Tjoelker wrote:
> >> % Index: sys/fs/fifofs/fifo_vnops.c
> >> % ===================================================================
> >> % --- sys/fs/fifofs/fifo_vnops.c	(revision 196459)
> >> % +++ sys/fs/fifofs/fifo_vnops.c	(working copy)
> >> % @@ -193,6 +193,10 @@
> >> %  			goto fail2;
> >> %  		fip->fi_writesock = wso;
> >> %  		error = soconnect2(wso, rso);
> >> % +		if (error == 0)
> >> % +			error = soshutdown(rso, SHUT_WR);
> >> % +		if (error == 0)
> >> % +			error = soshutdown(wso, SHUT_RD);
> >> %  		if (error) {
> >> %  			(void)soclose(wso);
> >> %  fail2:

> The second shutdown became harmless for me when I fixed the clobbering of
> sb_state.  Does it have any effect?

It seems not. shutdown(SHUT_RD) basically calls the pru_flush protocol
function (which uipc_usrreq.c does not provide), calls socantrecvmore
(which uipc_usrreq.c had already done synchronously with the first
shutdown) and clears the receive socket buffer (which is already empty).

Regarding the direct access to SBS_CANTRCVMORE and SBS_CANTSENDMORE,
this seems related to the special property of fifos that they can
disconnect and reconnect a stream using the same object. The socket
layer normally does not allow clearing SBS_CANTRCVMORE and
SBS_CANTSENDMORE. The only case where fifo_vnops.c touches these flags
directly where a so* function call could be used is the setting of
SBS_CANTRCVMORE on the read side at initial creation (possibly because a
wakeup is not necessary there).

I suppose the new fifo implementation will avoid abusing sockets this
way.

-- 
Jilles Tjoelker


More information about the svn-src-head mailing list