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))

The magic numbers 47 and 48 might change, but Larceny will
provide its own definitions of those two procedures before
the magic numbers change.

> Perhaps the existing strategy of
> implementing errno accessors as syscalls is bad, and we should
> instead put localized state into different components of the
> runtime (or at least isolate the errno of the ffi...)

The errno business is a crock, but it's C's crock so we 
have to respect it.  In C, everything preserves a nonzero
errno; that's true of Larceny as well.  In C, any call to
any function that might end up calling a C function that
can set errno can set errno; that too is true of Larceny.

So I believe Larceny's current semantics for get-errno and
set-errno! (as implemented above) is the right semantics.
We should export it and document it.

Will

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

Reply via email to