> Which raises another question: are 9atom and 9front in synch with the
> BL distribution (itself in question) regarding syscall 53?

9atom is not.  i didn't know that it was added, nor do i 
know why nsec was added as a syscall.

i indirectly heard "go needs it", but that is not really a reason
i can understand technically.  why must it be a system call?

getting ahead of myself, if the problem is shared memory vs
shared fds, then the solution is easy: fix nsec in the c library.
don't save a copy of the fd.  that leads to trouble.  (the new
call takes ~6µs on my e3 v2)

if the problem is getting very low-latency timing, or relative
timing, then the solution is still easy: use the timestamp counter.
no version of nsec works for relative timing due to timesync
adjustments!

i'm sure there are other possibilities, i don't think i see them without
an explination.  so if anyone has anything else, that would be
interesting.

- erik

---
; cat /sys/src/libc/9sys/nsec.c
#include <u.h>
#include <libc.h>

vlong
nsec(void)
{
        uchar b[8];
        int fd;

        fd = open("/dev/bintime", OREAD);
        if(fd != -1)
        if(pread(fd, b, sizeof b, 0) == sizeof b){
                close(fd);
                return getbe(b, sizeof b);
        }
        close(fd);
        return 0;
}

Reply via email to