* asymmetry with MSG_DONTWAIT in sendmsg() and recvmsg()
@ 2004-07-07 13:42 Chris Friesen
2004-07-08 8:34 ` Michael T Kerrisk
0 siblings, 1 reply; 10+ messages in thread
From: Chris Friesen @ 2004-07-07 13:42 UTC (permalink / raw)
To: netdev
I have a SOCK_STREAM PF_UNIX socket with no special options enabled using fcntl().
The default with sendmsg() and recvmsg() is to block.
With sndmsg(), I can use the MSG_DONTWAIT flag to enable non-blocking operation
for that one call.
How do I do the equivalent for recvmsg()?
Thanks,
Chris
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: asymmetry with MSG_DONTWAIT in sendmsg() and recvmsg()
2004-07-07 13:42 asymmetry with MSG_DONTWAIT in sendmsg() and recvmsg() Chris Friesen
@ 2004-07-08 8:34 ` Michael T Kerrisk
2004-07-08 16:21 ` Chris Friesen
0 siblings, 1 reply; 10+ messages in thread
From: Michael T Kerrisk @ 2004-07-08 8:34 UTC (permalink / raw)
To: Chris Friesen; +Cc: netdev
> I have a SOCK_STREAM PF_UNIX socket with no special options enabled using
> fcntl().
>
> The default with sendmsg() and recvmsg() is to block.
>
> With sndmsg(), I can use the MSG_DONTWAIT flag to enable non-blocking
> operation for that one call.
>
> How do I do the equivalent for recvmsg()?
MSG_DONTWAIT should also work with recvmsg().
Cheers
--
Michael Kerrisk
mtk-lists@gmx.net
"Sie haben neue Mails!" - Die GMX Toolbar informiert Sie beim Surfen!
Jetzt aktivieren unter http://www.gmx.net/info
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: asymmetry with MSG_DONTWAIT in sendmsg() and recvmsg()
2004-07-08 8:34 ` Michael T Kerrisk
@ 2004-07-08 16:21 ` Chris Friesen
2004-07-08 16:27 ` Andi Kleen
2004-07-08 17:25 ` Nivedita Singhvi
0 siblings, 2 replies; 10+ messages in thread
From: Chris Friesen @ 2004-07-08 16:21 UTC (permalink / raw)
To: Michael T Kerrisk; +Cc: netdev
Michael T Kerrisk wrote:
> MSG_DONTWAIT should also work with recvmsg().
Hmm... Just tried it with a DGRAM socket, and it seems to work. Any ideas why
its not in the man pages?
Chris
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: asymmetry with MSG_DONTWAIT in sendmsg() and recvmsg()
2004-07-08 16:21 ` Chris Friesen
@ 2004-07-08 16:27 ` Andi Kleen
2004-07-08 16:49 ` Chris Friesen
2004-07-08 17:25 ` Nivedita Singhvi
1 sibling, 1 reply; 10+ messages in thread
From: Andi Kleen @ 2004-07-08 16:27 UTC (permalink / raw)
To: Chris Friesen; +Cc: Michael T Kerrisk, netdev
On Thu, Jul 08, 2004 at 12:21:35PM -0400, Chris Friesen wrote:
> Michael T Kerrisk wrote:
>
> >MSG_DONTWAIT should also work with recvmsg().
>
> Hmm... Just tried it with a DGRAM socket, and it seems to work. Any ideas
> why its not in the man pages?
Nobody ever added it? Just send a patch to aeb@cwi.nl
-Andi
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: asymmetry with MSG_DONTWAIT in sendmsg() and recvmsg()
2004-07-08 16:27 ` Andi Kleen
@ 2004-07-08 16:49 ` Chris Friesen
2004-07-08 17:07 ` Andries Brouwer
0 siblings, 1 reply; 10+ messages in thread
From: Chris Friesen @ 2004-07-08 16:49 UTC (permalink / raw)
To: aeb; +Cc: Andi Kleen, Michael T Kerrisk, netdev
[-- Attachment #1: Type: text/plain, Size: 1468 bytes --]
Andi Kleen wrote:
> On Thu, Jul 08, 2004 at 12:21:35PM -0400, Chris Friesen wrote:
> > Michael T Kerrisk wrote:
> >
> > >MSG_DONTWAIT should also work with recvmsg().
> >
> > Hmm... Just tried it with a DGRAM socket, and it seems to work. Any
> ideas
> > why its not in the man pages?
>
> Nobody ever added it? Just send a patch to aeb@cwi.nl
Sending patch as suggested. Fundamentally, the delta is as follows, I've
included an attachment with what I hope are the proper formatting codes (copied
from send(2)).
--- recv.man 2004-07-08 15:43:17.000000000 -0400
+++ recv2.man 2004-07-08 15:47:29.000000000 -0400
@@ -67,6 +67,11 @@
disconnect occurs, or the next data to be received is of a dif-
ferent type than that returned.
+ MSG_DONTWAIT
+ Enables non-blocking operation; if the operation would block,
+ EAGAIN is returned (this can also be enabled using the O_NON-
+ BLOCK with the F_SETFL fcntl(2)).
+
MSG_NOSIGNAL
This flag turns off raising of SIGPIPE on stream sockets when
the other end disappears.
Note also that there is a mention of MSG_DONTWAIT in the msg_flags field in the
msghdr. It gives the impression that one can *set* that field to cause the
non-blocking behaviour. My understanding is that the msg_flags field is a
return value only. Perhaps that portion should be reworded as well.
Chris
[-- Attachment #2: man2recv.diff --]
[-- Type: application/octet-stream, Size: 741 bytes --]
^ permalink raw reply [flat|nested] 10+ messages in thread* Re: asymmetry with MSG_DONTWAIT in sendmsg() and recvmsg()
2004-07-08 16:49 ` Chris Friesen
@ 2004-07-08 17:07 ` Andries Brouwer
2004-07-08 18:33 ` Chris Friesen
0 siblings, 1 reply; 10+ messages in thread
From: Andries Brouwer @ 2004-07-08 17:07 UTC (permalink / raw)
To: Chris Friesen; +Cc: Andries.Brouwer, Andi Kleen, Michael T Kerrisk, netdev
On Thu, Jul 08, 2004 at 12:49:28PM -0400, Chris Friesen wrote:
> > > why its not in the man pages?
> >
> >Nobody ever added it? Just send a patch to aeb@cwi.nl
>
> Sending patch as suggested. Fundamentally, the delta is as follows, I've
> included an attachment with what I hope are the proper formatting codes
> (copied from send(2)).
>
> --- recv.man 2004-07-08 15:43:17.000000000 -0400
> +++ recv2.man 2004-07-08 15:47:29.000000000 -0400
> @@ -67,6 +67,11 @@
> disconnect occurs, or the next data to be received is of a
> dif-
> ferent type than that returned.
>
> + MSG_DONTWAIT
> + Enables non-blocking operation; if the operation would
> block,
> + EAGAIN is returned (this can also be enabled using the
> O_NON-
> + BLOCK with the F_SETFL fcntl(2)).
> +
> MSG_NOSIGNAL
> This flag turns off raising of SIGPIPE on stream sockets
> when
> the other end disappears.
>
>
> Note also that there is a mention of MSG_DONTWAIT in the msg_flags field in
> the msghdr. It gives the impression that one can *set* that field to cause
> the non-blocking behaviour. My understanding is that the msg_flags field
> is a return value only. Perhaps that portion should be reworded as well.
>
> Chris
Can you find the man-pages-1.67 package and construct a concrete patch?
(Don't know precisely what you want to do. The above gives a filename
recv.man, which would be recv.2 in my sources. But there is no MSG_NOSIGNAL
in recv.2, only in send.2. The fragment of text that you give occurs
already in recv.2.)
Andries
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: asymmetry with MSG_DONTWAIT in sendmsg() and recvmsg()
2004-07-08 17:07 ` Andries Brouwer
@ 2004-07-08 18:33 ` Chris Friesen
2004-07-08 19:05 ` Andries Brouwer
0 siblings, 1 reply; 10+ messages in thread
From: Chris Friesen @ 2004-07-08 18:33 UTC (permalink / raw)
To: Andries Brouwer; +Cc: Andi Kleen, Michael T Kerrisk, netdev
Andries Brouwer wrote:
> Can you find the man-pages-1.67 package and construct a concrete patch?
>
> (Don't know precisely what you want to do. The above gives a filename
> recv.man, which would be recv.2 in my sources. But there is no MSG_NOSIGNAL
> in recv.2, only in send.2. The fragment of text that you give occurs
> already in recv.2.)
Sorry, the filenames have no meaning since I wasn't working from the package,
but from the output of the "man" command.
Working from the webpage at:
http://homepages.cwi.nl/~aeb/linux/man2html/man2/recv.2.html
There is mention of MSG_DONTWAIT when discussing the "msg_flags" field in
"struct msghdr". It contains exactly the text proposed. However, the msg_flags
field is set on *return* of the call. Every other flag discussed there
"indicates" something. The blurb for MSG_DONTWAIT says that it "enables" a
behaviour, which doesn't make sense for a field set on call return.
There is no mention of MSG_DONTWAIT when discussing the "flags" parameter of the
recv/recvfrom/recvmsg call.
Generally, I want to move the current blob from the "msg_flags" area to the
"flags" area, and then add a different discussion for "msg_flags" if appropriate
(I'm not sure about that part).
Do you still want me to generate an actual patch against man-pages-1.67, or is
that description enough?
Chris
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: asymmetry with MSG_DONTWAIT in sendmsg() and recvmsg()
2004-07-08 18:33 ` Chris Friesen
@ 2004-07-08 19:05 ` Andries Brouwer
0 siblings, 0 replies; 10+ messages in thread
From: Andries Brouwer @ 2004-07-08 19:05 UTC (permalink / raw)
To: Chris Friesen; +Cc: Andries Brouwer, Andi Kleen, Michael T Kerrisk, netdev
On Thu, Jul 08, 2004 at 02:33:19PM -0400, Chris Friesen wrote:
> Andries Brouwer wrote:
> >Can you find the man-pages-1.67 package and construct a concrete patch?
> >
> >(Don't know precisely what you want to do. The above gives a filename
> >recv.man, which would be recv.2 in my sources. But there is no MSG_NOSIGNAL
> >in recv.2, only in send.2. The fragment of text that you give occurs
> >already in recv.2.)
>
> Working from the webpage at:
>
> http://homepages.cwi.nl/~aeb/linux/man2html/man2/recv.2.html
Ah, that is how I am punished for neglecting to update these html pages :-)
Will update them.
I was confused by your MSG_NOSIGNAL, but indeed, that is still on that page,
it was removed later.
Have moved the MSG_DONTWAIT part to after the MSG_WAITALL description.
[Will still check whether that is really appropriate.]
Thanks!
Andries
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: asymmetry with MSG_DONTWAIT in sendmsg() and recvmsg()
2004-07-08 16:21 ` Chris Friesen
2004-07-08 16:27 ` Andi Kleen
@ 2004-07-08 17:25 ` Nivedita Singhvi
2004-07-08 18:34 ` Chris Friesen
1 sibling, 1 reply; 10+ messages in thread
From: Nivedita Singhvi @ 2004-07-08 17:25 UTC (permalink / raw)
To: Chris Friesen; +Cc: Michael T Kerrisk, netdev
Chris Friesen wrote:
> Michael T Kerrisk wrote:
>
>> MSG_DONTWAIT should also work with recvmsg().
>
>
> Hmm... Just tried it with a DGRAM socket, and it seems to work. Any
> ideas why its not in the man pages?
Think you are on an older version of the man pages.
It's been there for a while.
thanks,
Nivedita
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: asymmetry with MSG_DONTWAIT in sendmsg() and recvmsg()
2004-07-08 17:25 ` Nivedita Singhvi
@ 2004-07-08 18:34 ` Chris Friesen
0 siblings, 0 replies; 10+ messages in thread
From: Chris Friesen @ 2004-07-08 18:34 UTC (permalink / raw)
To: Nivedita Singhvi; +Cc: Michael T Kerrisk, netdev
Nivedita Singhvi wrote:
> Chris Friesen wrote:
> > Michael T Kerrisk wrote:
> >
> >> MSG_DONTWAIT should also work with recvmsg().
> >
> >
> > Hmm... Just tried it with a DGRAM socket, and it seems to work. Any
> > ideas why its not in the man pages?
>
> Think you are on an older version of the man pages.
> It's been there for a while.
It's mentioned in the "msg_flags" section, which is set on call *return*. It's
not mentioned in the "flags" section.
Perhaps its just in the wrong part of the man page...
Chris
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2004-07-08 19:05 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-07-07 13:42 asymmetry with MSG_DONTWAIT in sendmsg() and recvmsg() Chris Friesen
2004-07-08 8:34 ` Michael T Kerrisk
2004-07-08 16:21 ` Chris Friesen
2004-07-08 16:27 ` Andi Kleen
2004-07-08 16:49 ` Chris Friesen
2004-07-08 17:07 ` Andries Brouwer
2004-07-08 18:33 ` Chris Friesen
2004-07-08 19:05 ` Andries Brouwer
2004-07-08 17:25 ` Nivedita Singhvi
2004-07-08 18:34 ` Chris Friesen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).