RE: FW: [RFC] A more general timeout specification

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi John

>From: john stultz [mailto:[email protected]]
>On Thu, 2005-07-28 at 18:52 -0700, Inaky Perez-Gonzalez wrote:
>> The main user of this new inteface is to allow system calls to get
>> time specified in an absolute form (as most of POSIX states) and thus
>> avoid extra time conversion work.
...
>>
http://groups-beta.google.com/groups?q=a+more+general+timeout+specificat
ion
...
>>
>> timeout_validate() error-checks the syntax of a timeout
>> argument and returns either zero or -EINVAL.  By breaking
>> timeout_validate() out from timeout_sleep(), it becomes possible
>> to error check the timeout 'far away' from the places in the
>> code where we would actually do the timeout, as well as being
>> able to perform such checks only at those places we know the
>> timeout specification is coming from an unsafe source.
>
>using gettimeofday() so that part looks good. I'm not completely sold
on
>why the validate interface is needed, but I didn't hear any objections
>from George, so I'd defer to those who deal more with those interfaces.

_validate() is mostly needed when we take a timeout specification from
user space (timeouts from kernel space are supposed to be ok). We need
to validate that the clock id passed is correct (existant), that
the 'struct timespec' is also legal (eg: nsec < 1000M), that the flags 
are ok (relative/absolute), etc...

The idea is that in your code that uses this, once you copy the 'struct 
timeout' from  user space you check it for validity. Then you can 
dive into any kind of code (atomic, sleep paths, whatever) without
having
to code an error path from deeep down for when the user passed a bad 
timeout.

It sure makes it more simple :)

-- Inaky
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]
  Powered by Linux