unix-system-call ( quot -- quot )


Vocabulary
unix

Definition
USING: combinators.short-circuit combinators.smart
generalizations kernel libc locals sequences
sequences.generalizations unix.ffi ;

IN: unix

MACRO:: unix-system-call ( quot -- quot )
quot inputs :> n quot first :> word 0 :> ret! f :> failed!
[
[
n ndup quot call ret! ret {
[ unix-call-failed? dup failed! ]
[ drop errno EINTR = ]
} 1&&
] loop failed [
n narray errno dup strerror word
unix-system-call-error
] [ n ndrop ret ] if
] ;