chazu / ypsilon

Automatically exported from code.google.com/p/ypsilon
Other
0 stars 1 forks source link

errno setter is needed #69

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Sorry to bother you again with this thing,
but there are functions like "readdir()"
for which setting "errno" to zero before
the call is the only way to distinguish
an error condition from another event.
So an "errno" setter is needed (Larceny
implements it, Ikarus not yet.)

Original issue reported on code.google.com by mrc....@gmail.com on 2 Jan 2009 at 9:16

GoogleCodeExporter commented 9 years ago
I have implemented a setter by using the FFI to
call the function "__errno_location()", which
returns the pointer to the (thread specific)
"errno" variable, and then using the poker
for "int".

From my limited testing so far it works.

Original comment by mrc....@gmail.com on 5 Jan 2009 at 9:56

GoogleCodeExporter commented 9 years ago
Thank you for your message and sorry for not getting back to you sooner.

I have added shared-object-errno and shared-object-win32-lasterror to revision 
343.
shared-object-errno is a parameter and it capture and holds errno set by last 
ffi call.
To set specific value to errno, use (shared-object-errno <new-value>).
shared-object-errno works on windows also.

(c-ffi-func1 ...)
(shared-object-errno)      returns errno value set by c-ffi-func1
(shared-object-errno 0)    resets errno to 0
(shared-object-errno)      returns 0
(c-ffi-func2 ...)
(shared-object-errno)      returns errno value set by c-ffi-func2

Please try. Thank you!
-- fujita

Original comment by y.fujita...@gmail.com on 6 Jan 2009 at 1:33

GoogleCodeExporter commented 9 years ago
Sorry for the wrong report! Is it already there in version 335?
I used SHARED-OBJECT-ERRNO as a getter but I had not noticed
that it is a parameter.

Thanks!

Original comment by mrc....@gmail.com on 6 Jan 2009 at 7:33