On Tue, Dec 30, 2008 at 4:03 PM, William D Clinger <w...@ccs.neu.edu> wrote:

> Felix wrote:
> > There are syscalls for fetching or modifying the system errno
> > "variable/global state" directly.
> >
> > Unfortunately, I don't think they're currently documented (or
> > even used).
>
> Or even exported.
>
> As an extremely temporary measure (to be fixed within a
> few days), Marco can use the following definitions:
>
>  (define (get-errno)
>    (syscall 47))
>
>  (define (set-errno! n)
>    (assert (fixnum? n))
>    (syscall 48 n))
>

Darn missed those.  I did it through the FFI.

But as pointed out its not Larceny Tasking safe.  I told myself I'd, of
course, make sure to a demarcate the code as critical section code to
prevent reading spurious errno cross task switches.

Glancing at my socket code where the errno is critical for checking for
EAGAIN for non-blocking I/O looks like I muffed it.

Having the Larceny runtime keep automagically keep the last FFI call errno
on a per thread basis would be nice.

http://github.com/GreyLensman/rl3/tree/4e429fca6a61d7f367094776a937ba57bb886274/rl3/system/unix.sls

http://github.com/GreyLensman/rl3/tree/4e429fca6a61d7f367094776a937ba57bb886274/rl3/io/net/sockets.sls

Ray
_______________________________________________
Larceny-users mailing list
Larceny-users@lists.ccs.neu.edu
https://lists.ccs.neu.edu/bin/listinfo/larceny-users

Reply via email to