Re: negative timeout can be set up by setsockopt system call

From: linux-os (Dick Johnson)
Date: Fri Nov 04 2005 - 17:08:08 EST



On Fri, 4 Nov 2005, Ram Gupta wrote:

> I observed that the the setsockopt system call can setup negative
> timeout. As a matter of fact the function sock_set_timeout checks for
> zero timeout but does not check for negative timeouts. I tested this
> against 2.6.14 kernel but it is so in all previous release also. So I
> am wondering if it is a bug or there is some reason for keeping it that
> way which I am missing.
>
> Regards
> Ram gupta

As a parameter it takes a void pointer to the value plus a
length of the object to which the value points. Given this,
I don't understand "negative". The pointer can point to
anything of a specified size so it doesn't have a sense
of +/-.

If the socket call itself checked for sign it would
severly limit what options could be adjusted. Perhaps
the SO_SNDTIMEO/SO_RCVTIMEO might do some checking, but
I think it's valid to set the timeout to -1, meaning it
never times-out.


Cheers,
Dick Johnson
Penguin : Linux version 2.6.13.4 on an i686 machine (5589.55 BogoMips).
Warning : 98.36% of all statistics are fiction.
.

****************************************************************
The information transmitted in this message is confidential and may be privileged. Any review, retransmission, dissemination, or other use of this information by persons or entities other than the intended recipient is prohibited. If you are not the intended recipient, please notify Analogic Corporation immediately - by replying to this message or by sending an email to DeliveryErrors@xxxxxxxxxxxx - and destroy all copies of this information, including any attachments, without reading or disclosing them.

Thank you.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/