[LinuxPPS] Re: Missing test in __sys_time_pps_fetch

Rodolfo Giometti giometti at enneenne.com
Sun Jul 1 21:21:17 CEST 2007


On Sat, Jun 30, 2007 at 11:45:34PM -0600, clemens at dwf.com wrote:
> I am not sure of the logic in __sys_time_pps_fetch, but it does not
> seem to agree with the RFC.
> 
> First, the RFC allows the pointer to the timeout time to be NULL.
> I see no check for this case.

Look into function sys_time_pps_fetch() in file drivers/pps/pps.c.

> Second, you have a test on
> 
>     if (timeout->tv_sec != -1) {
> 
> which I dont understand at all, perhaps its something internal.
> 
> I would consider a NEGATIVE timeout to be an error, tho one could
> just as easily consider it equal zero.  In any case I dont
> undertand what a test against -1 in ts_sec would mean.

Zero is a special value and it cannot be considered.

I used -1 just for "no timeout". However I think it could be
fixed... RFC says nothing specific so we can use:

timeout > 0			-->>	set a timeout
timeout = 0			-->>	return immediately
timeout < 0 or timeout == NULL 	-->>	no timeout

It could be acceptable?

Rodolfo

-- 

GNU/Linux Solutions                  e-mail:    giometti at enneenne.com
Linux Device Driver                             giometti at gnudd.com
Embedded Systems                     		giometti at linux.it
UNIX programming                     phone:     +39 349 2432127



More information about the LinuxPPS mailing list