A problem with the select(2) interface

Peter Jeremy peterjeremy at optushome.com.au
Thu May 17 10:12:47 UTC 2007


On 2007-May-16 15:23:14 +0200, Dag-Erling Smrgrav <des at des.no> wrote:
>MQ <antinvidia at gmail.com> writes:
>> No, that is not what I want. I think we'd better add a comments that
>> we *DO NOT WRITE TO THAT ADDRESS*, what the manual describes is that
>> there may be some platforms which write to that address. It's not the
>> same thing.
>
>Some platforms update the timeval and some don't, so portable
>applications must simply assume that its contents are undefined after
>the select(2) call.  It can not be relied on to contain either the
>initial value nor the amount of time remaining.  Thus your proposed
>change is pointless.

I disagree.  The FreeBSD man pages should document the behaviour of
FreeBSD.  It's all very nice stating that SUSv2 allows a system to
modify the value passed as timeout but (IMNSHO), it is more important
to document what FreeBSD actually does.

I agree that a _portable_ application must assume that timeout will
be undefined but that's no reason for refusing to document what
FreeBSD's behaviour actually is.

There are two situations where the actual behaviour matters:
1) Porting a random application that assumes specific behaviour for
   select().  I need to know how FreeBSD behaves to know whether I
   need to patch the code or not.
2) I'm writing code that is specifically for FreeBSD.  If I know
   timeout will not change, I can optimise the code to avoid having to
   re-initialise timeout before each select call.

-- 
Peter Jeremy
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 187 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-arch/attachments/20070517/2133727a/attachment.pgp


More information about the freebsd-arch mailing list