[Larceny-users] on porting to larceny

Felix Klock felixluser at pnkfx.org
Tue Dec 30 13:38:42 EST 2008


Marco-

On Dec 27, 2008, at 4:26 AM, Marco Maggi wrote:

> *** The  FFI  does  not  allow  retrieval  of  the
> "errno" value just  after a foreign function call.
> Ikarus and Ypsilon allow this by storing the value
> in an internal state variable that can be accessed
> later with a procedure.
>
> My initial proposal to both the Ikarus and Ypsilon
> implementers  was  to   provide  two  versions  of
> interface  function   to  foreign  functions:  the
> traditional one and  an augmented onte returning 2
> values: the return value from the foreign function
> and the value of  "errno".  For Larceny this would
> mean implementing a FOREIGN-PROCEDURE/WITH-ERRNO.

I just want to clarify this point:
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).

I added them when I was attacking ticket #155:
https://trac.ccs.neu.edu/trac/larceny/ticket/155

But reading your message, I wonder about the approach of adding an  
internal state variable.  The point of doing that is to isolate the  
effects the runtime has on errno from the effects that foreign  
invocations have, correct?

I will have to think about this; I do not know which runtime  
invocations could affect errno.  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...)

-Felix






More information about the Larceny-users mailing list