Subject: Re: CVS commit: syssrc
To: Konrad Schroder <perseant@hhhh.org>
From: Jason R Thorpe <thorpej@zembu.com>
List: tech-kern
Date: 07/13/2000 17:37:24
On Thu, Jul 13, 2000 at 05:27:32PM -0700, Konrad Schroder wrote:
> Passing zero to wait forever is fine, the cleaner only needs to wake up
> when lfs_avail goes too low or a new segment is acquired for writing, or
> the fs is unmounted.
>
> But I definitely don't understand what the point is of adding "time"
> into the value (though it's been that way since 4.4Lite)...do I
> misunderstand something, or should it just be
I think you misunderstand something. If you look at hzto(), it subtracts
`time' from the passed-in timeval to compute the returned ticks value.
It seems like the right way to get "forever" is to pass NULL for the
system call's `tv' argument, rather than to pass {0,0}. Otherwise,
there's no way to distinguish between "passed {0,0} to wait forever" and
"timeout expired already for whatever reason, and we should not wait
at all".
>
> if (SCARG(uap, tv)) {
> error = copyin(SCARG(uap, tv), &atv, sizeof(struct timeval));
> if (error)
> return (error);
> if (itimerfix(&atv))
> return (EINVAL);
> timeout = hzto(&atv);
> } else
> timeout = 0;
>
> error = tsleep(addr, PCATCH | PUSER, "segment", timeout);
>
> ?
> Konrad Schroder
> perseant@hhhh.org
>
>
--
-- Jason R. Thorpe <thorpej@zembu.com>