On Tue, Aug 31, 2010 at 5:54 AM, erik quanstrom <[email protected]> wrote:
>> A simple change:
>> pid = getpid();
>
> shouldn't you just fix it so _tos->pid is set?
yep. I just have to find the time.
>
> also, the comments in the new nsec.c don't
> match the code. the code looks something like this
>
> do{
> ...
> tries = 0;
> }while(tries++ == 0); /* retry once */
>
> of course either this should be
>
> /* just retry for ever */
> for(;;){
> ...
> }
> or
> /* retry once */
> for(tries = 0; tries < 2; tries++)
>
> also, there's nothing stoping the race between
> - two procs allocating the same element of the pid array
> - two procs opening the global fd twice
personal opinion: the difficulty of getting this code right, and its
complexity, tell me something is wrong with the interface. Look at the
trouble we're going through to get a 64-bit number out of the kernel.
Look at how hard it is to get right.
Two ways out:
1. "reserved" fds. an fd that is always open, can not be closed, and
will return important values, e.g. reserved fd 32766 could always be a
connection to bintime
2. a system call to get bintime.
others? Either way I don't see the current approach as making a lot of sense.
ron