[cffi-devel] Safe errno collection

Luís Oliveira luismbo at gmail.com
Fri Jan 9 13:03:55 UTC 2009


On Fri, Jan 9, 2009 at 5:17 AM, John Fremlin <jf at msi.co.jp> wrote:
> ClozureCL has something slightly similar called int-errno-call
>
> (defmacro int-errno-call (form)
>  (let* ((value (gensym)))
>    `(let* ((,value ,form))
>      (if (< ,value 0)
>        (%get-errno)
>        ,value))))

This doesn't address your concern that something might happen between
FORM and %GET-ERRNO does it? But, again, it seems like the only
problem here is tied to user-space threads. You might want to use
WITHOUT-SCHEDULING instead, not sure.

BTW, have a look at Osicat:
<http://common-lisp.net/project/osicat/git/osicat.git/>. I believe it
has the functionality you're looking for in the ERRNO-WRAPPER type and
the DEFSYSCALL macro (both in osicat/posix/early.lisp). It's just
missing a WITHOUT-SCHEDULING (or WITHOUT-INTERRUPTS?) for Allegro with
user-space threads, IIUC.

-- 
Luís Oliveira
http://student.dei.uc.pt/~lmoliv/




More information about the cffi-devel mailing list