netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Problem with semantics?
@ 2007-08-13 17:07 Shay Goikhman
  2007-08-14  0:38 ` Andi Kleen
  0 siblings, 1 reply; 3+ messages in thread
From: Shay Goikhman @ 2007-08-13 17:07 UTC (permalink / raw)
  To: netdev; +Cc: davem



Dear Linux maintainers,

 I'm doing :

      setsockopt(s,  SO_RCVTIMEO, t1 );                  // set time-out
t1 on socket while block receiving on it
      select(,,, &fd_set_including(s), .., &errs, t2);      // block till
receive or time-out  t 2 jointly on a set of sockets

Apparently, I could no find reference on the coupled behavior of the two
above statements in Linux documentation.
As I understand the blocking semantics, I would expect  that  if t1<t2 ,
select should return after t1 with the descriptor 's' in 'errs' if 's' does
not become readable in the t1 interval.

It is not so in life -- select ignores t1 altogether.

Do you have some enlightening knowledge on the matter?
Thanks,
-Shay


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Problem with semantics?
  2007-08-13 17:07 Problem with semantics? Shay Goikhman
@ 2007-08-14  0:38 ` Andi Kleen
  2007-08-27 15:46   ` Michael Kerrisk
  0 siblings, 1 reply; 3+ messages in thread
From: Andi Kleen @ 2007-08-14  0:38 UTC (permalink / raw)
  To: Shay Goikhman; +Cc: netdev, davem, mtk-manpages

Shay Goikhman <GOIKHMAN@il.ibm.com> writes:

> Dear Linux maintainers,
> 
>  I'm doing :
> 
>       setsockopt(s,  SO_RCVTIMEO, t1 );                  // set time-out
> t1 on socket while block receiving on it
>       select(,,, &fd_set_including(s), .., &errs, t2);      // block till
> receive or time-out  t 2 jointly on a set of sockets
> 
> Apparently, I could no find reference on the coupled behavior of the two
> above statements in Linux documentation.
> As I understand the blocking semantics, I would expect  that  if t1<t2 ,
> select should return after t1 with the descriptor 's' in 'errs' if 's' does
> not become readable in the t1 interval.
> 
> It is not so in life -- select ignores t1 altogether.
> 
> Do you have some enlightening knowledge on the matter?

RCVTIMEO only applies to recvmsg et.al., similar to SNDTIMEO only
apply to sendmsg etc. But select/poll only report events, they
do not actually send or receive by themselves.

Michael, perhaps you can clarify that in the manpages

-Andi

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Problem with semantics?
  2007-08-14  0:38 ` Andi Kleen
@ 2007-08-27 15:46   ` Michael Kerrisk
  0 siblings, 0 replies; 3+ messages in thread
From: Michael Kerrisk @ 2007-08-27 15:46 UTC (permalink / raw)
  To: Andi Kleen; +Cc: Shay Goikhman, netdev, davem

Hi Andi,

Andi Kleen wrote:
> Shay Goikhman <GOIKHMAN@il.ibm.com> writes:
> 
>> Dear Linux maintainers,
>>
>>  I'm doing :
>>
>>       setsockopt(s,  SO_RCVTIMEO, t1 );                  // set time-out
>> t1 on socket while block receiving on it
>>       select(,,, &fd_set_including(s), .., &errs, t2);      // block till
>> receive or time-out  t 2 jointly on a set of sockets
>>
>> Apparently, I could no find reference on the coupled behavior of the two
>> above statements in Linux documentation.
>> As I understand the blocking semantics, I would expect  that  if t1<t2 ,
>> select should return after t1 with the descriptor 's' in 'errs' if 's' does
>> not become readable in the t1 interval.
>>
>> It is not so in life -- select ignores t1 altogether.
>>
>> Do you have some enlightening knowledge on the matter?
> 
> RCVTIMEO only applies to recvmsg et.al., similar to SNDTIMEO only
> apply to sendmsg etc. But select/poll only report events, they
> do not actually send or receive by themselves.
> 
> Michael, perhaps you can clarify that in the manpages

I added the following to sockets.7:

              Timeouts have
              effect   for  socket  I/O  calls  (read(2),  recv(2),
              recvfrom(2),    recvmsg(2),    write(2),     send(2),
              sendto(2),  sendmsg(2));  timeouts have no effect for
              select(2), poll(2), epoll_wait(2), etc.

The change will be in man-pages-2.65.

Thanks for your note.

Cheers,

Michael

-- 
Michael Kerrisk
maintainer of Linux man pages Sections 2, 3, 4, 5, and 7

Want to help with man page maintenance?  Grab the latest tarball at
http://www.kernel.org/pub/linux/docs/manpages/
read the HOWTOHELP file and grep the source files for 'FIXME'.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2007-08-27 15:48 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-08-13 17:07 Problem with semantics? Shay Goikhman
2007-08-14  0:38 ` Andi Kleen
2007-08-27 15:46   ` Michael Kerrisk

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).