On Sun, 27 Jun 2021 18:16:34 +0200, Claudio Jeker wrote:

> On Sun, Jun 27, 2021 at 05:28:09PM +0200, Mark Kettenis wrote:
> > > Date: Sun, 27 Jun 2021 13:36:03 +0000
> > > From: Klemens Nanni <[email protected]>
> > > 
> > > On Sat, Jun 12, 2021 at 11:54:58PM -0700, Greg Steuck wrote:
> > > > I started with a failing test for Haskell network package on 6.9-curren
> t amd64
> > > > (cabal get network-3.1.2.1 && cabal v2-test)
> > > > 
> > > > network-3.1.2.1/build/spec/spec --match "/Network.Socket.ByteString/rec
> vMsg/works well/"
> > > > 
> > > >   tests/Network/Socket/ByteStringSpec.hs:209:21: 
> > > >   1) Network.Socket.ByteString.recvMsg works well
> > > >        expected: MsgFlag {fromMsgFlag = 0}
> > > >         but got: MsgFlag {fromMsgFlag = 128}
> > > > 
> > > > ktrace says:
> > > > 
> > > >  47649 spec     CALL  sendto(14,0x8a2126e838c,0x16,0,0x8a4a3622df0,0x10
> )
> > > >  47649 spec     STRU  struct sockaddr { AF_INET, 127.0.0.1:9486 }
> > > >  47649 spec     GIO   fd 14 wrote 22 bytes
> > > >        "This is a test message"
> > > >  47649 spec     RET   sendto 22/0x16
> > > >  47649 spec     CALL  futex(0x8a4aef6f930,0x81<FUTEX_WAIT|FUTEX_PRIVATE
> _FLAG>,1,0,0)
> > > >  47649 spec     STRU  struct kevent { ident=13, filter=EVFILT_READ, fla
> gs=0x11<EV_ADD|EV_ONESHOT>, fflags=0<>, data=38, udata=0x0 }
> > > >  47649 spec     RET   kevent 1
> > > >  47649 spec     CALL  recvmsg(13,0x8a4a3622c50,0)
> > > >  47649 spec     GIO   fd 13 read 22 bytes
> > > >        "This is a test message"
> > > >  47649 spec     STRU  struct sockaddr { AF_INET, 127.0.0.1:12293 }
> > > >  47649 spec     STRU  struct msghdr { name=0x8a4a3622b70, namelen=16, i
> ov=0x8a4a3622c30, iovlen=1, control=0x8a4a3622c10, controllen=0, flags=0x80<M
> SG_DONTWAIT> }
> > > >  47649 spec     STRU  struct iovec { base=0x8a4a3622666, len=1002 }
> > > >  47649 spec     RET   recvmsg 22/0x16
> > > > 
> > > > This seems to contradict recvmsg(2) which doesn't list MSG_DONTWAIT as 
> a
> > > > possible value of the flags. Would this be useful as a C regress test?
> > > 
> > > Looks like this was missed in sys/kern/uipc_syscalls.c revision 1.178
> > > 
> > >   date: 2018/07/30 12:22:14;  author: mpi;  state: Exp;  lines: +10 -18; 
>  commitid: K43aQe66cQkEOSbc;
> > >   Use FNONBLOCK instead of SS_NBIO to check/indicate that the I/O mode
> > >   for sockets is non-blocking.
> > > 
> > >   This allows us to G/C SS_NBIO.  Having to keep the two flags in sync
> > >   in a mp-safe way is complicated.
> > > 
> > >   This change introduce a behavior change in sosplice(), it can now
> > >   always block.  However this should not matter much due to the socket
> > >   lock being taken beforhand.
> > > 
> > >   bluhm@, benno@, visa@
> > > 
> > > Wording taken from mpi's commit message which is exactly what recvit()
> > > does in one place, i.e.
> > > 
> > >   if (fp->f_flag & FNONBLOCK)
> > >           mp->msg_flags |= MSG_DONTWAIT;
> > > 
> > > 
> > > Here's the documentation bits for it?
> > > Feedback? Objections? OK?
> > 
> > I think this points out that diff wasn't quite right.  I mean,
> > changing the man page doesn't fix the Haskell test does it?
>
> I agree, I think MSG_DONTWAIT should not be returend to userland.

Agreed, it should be cleared before return to userland.

 - todd

Reply via email to