libc: rename (io-error) to throw-errno.
parent
3f362dfc99
commit
39093727b1
|
@ -97,7 +97,7 @@ M: fd refill
|
|||
errno {
|
||||
{ EINTR [ 2drop +retry+ ] }
|
||||
{ EAGAIN [ 2drop +input+ ] }
|
||||
[ (io-error) ]
|
||||
[ throw-errno ]
|
||||
} case
|
||||
] if ;
|
||||
|
||||
|
@ -117,7 +117,7 @@ M: fd drain
|
|||
errno {
|
||||
{ EINTR [ 2drop +retry+ ] }
|
||||
{ EAGAIN [ 2drop +output+ ] }
|
||||
[ (io-error) ]
|
||||
[ throw-errno ]
|
||||
} case
|
||||
] if ;
|
||||
|
||||
|
@ -155,7 +155,11 @@ M: stdin dispose*
|
|||
stdin data>> handle-fd buffer buffer-end size read
|
||||
dup 0 < [
|
||||
drop
|
||||
errno EINTR = [ buffer stdin size refill-stdin ] [ (io-error) ] if
|
||||
errno EINTR = [
|
||||
buffer stdin size refill-stdin
|
||||
] [
|
||||
throw-errno
|
||||
] if
|
||||
] [
|
||||
size = [ "Error reading stdin pipe" throw ] unless
|
||||
size buffer buffer+
|
||||
|
@ -215,7 +219,7 @@ TUPLE: mx-port < port mx ;
|
|||
: multiplexer-error ( n -- n )
|
||||
dup 0 < [
|
||||
errno [ EAGAIN = ] [ EINTR = ] bi or
|
||||
[ drop 0 ] [ (io-error) ] if
|
||||
[ drop 0 ] [ throw-errno ] if
|
||||
] when ;
|
||||
|
||||
:: ?flag ( n mask symbol -- n )
|
||||
|
|
|
@ -35,7 +35,7 @@ M: unix copy-file ( from to -- )
|
|||
|
||||
: with-unix-directory ( path quot -- )
|
||||
dupd '[ _ _
|
||||
[ opendir dup [ (io-error) ] unless ] dip
|
||||
[ opendir dup [ throw-errno ] unless ] dip
|
||||
dupd curry swap '[ _ closedir io-error ] [ ] cleanup
|
||||
] with-directory ; inline
|
||||
|
||||
|
|
|
@ -288,7 +288,7 @@ PRIVATE>
|
|||
|
||||
: access? ( path mode -- ? )
|
||||
[ normalize-path ] [ access ] bi* 0 < [
|
||||
errno EACCES = [ f ] [ (io-error) ] if
|
||||
errno EACCES = [ f ] [ throw-errno ] if
|
||||
] [ t ] if ;
|
||||
|
||||
PRIVATE>
|
||||
|
|
|
@ -8,7 +8,7 @@ IN: io.files.unix
|
|||
M: unix cwd ( -- path )
|
||||
MAXPATHLEN [ <byte-array> ] keep
|
||||
[ getcwd ] unix-system-call
|
||||
[ (io-error) ] unless* ;
|
||||
[ throw-errno ] unless* ;
|
||||
|
||||
M: unix cd ( path -- ) [ chdir ] unix-system-call drop ;
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@ IN: io.mmap.unix
|
|||
[
|
||||
f length prot flags
|
||||
path open-mode file-mode open-file [ <fd> |dispose drop ] keep
|
||||
[ 0 mmap dup MAP_FAILED = [ (io-error) ] when ] keep
|
||||
[ 0 mmap dup MAP_FAILED = [ throw-errno ] when ] keep
|
||||
] with-destructors ;
|
||||
|
||||
M: unix (mapped-file-r/w)
|
||||
|
|
|
@ -187,7 +187,7 @@ SYMBOL: default-secure-context
|
|||
: syscall-error ( r -- event )
|
||||
ERR_get_error [
|
||||
{
|
||||
{ -1 [ errno ECONNRESET = [ premature-close ] [ (io-error) ] if ] }
|
||||
{ -1 [ errno ECONNRESET = [ premature-close ] [ throw-errno ] if ] }
|
||||
! OpenSSL docs say this it is an error condition for
|
||||
! a server to not send a close notify, but web
|
||||
! servers in the wild don't seem to do this, for
|
||||
|
|
|
@ -56,7 +56,7 @@ DEFER: wait-to-connect
|
|||
errno {
|
||||
{ EAGAIN [ wait-for-output ] }
|
||||
{ EINTR [ wait-to-connect ] }
|
||||
[ (io-error) ]
|
||||
[ throw-errno ]
|
||||
} case
|
||||
] if ;
|
||||
|
||||
|
@ -67,7 +67,7 @@ M: object establish-connection
|
|||
errno {
|
||||
{ EINTR [ establish-connection ] }
|
||||
{ EINPROGRESS [ drop wait-for-output ] }
|
||||
[ (io-error) ]
|
||||
[ throw-errno ]
|
||||
} case
|
||||
] if ;
|
||||
|
||||
|
@ -114,7 +114,7 @@ M: object (accept)
|
|||
[ (accept) ]
|
||||
2bi
|
||||
] }
|
||||
[ (io-error) ]
|
||||
[ throw-errno ]
|
||||
} case
|
||||
] if ;
|
||||
|
||||
|
@ -157,7 +157,7 @@ M: unix (receive-unsafe)
|
|||
datagram +output+ wait-for-port
|
||||
packet sockaddr len socket datagram do-send
|
||||
] }
|
||||
[ (io-error) ]
|
||||
[ throw-errno ]
|
||||
} case
|
||||
] when ; inline recursive
|
||||
|
||||
|
|
|
@ -45,9 +45,9 @@ M: object strerror strerror_unsafe ;
|
|||
|
||||
ERROR: libc-error errno message ;
|
||||
|
||||
: (io-error) ( -- * ) errno dup strerror libc-error ;
|
||||
: throw-errno ( -- * ) errno dup strerror libc-error ;
|
||||
|
||||
: io-error ( n -- ) 0 < [ (io-error) ] when ;
|
||||
: io-error ( n -- ) 0 < [ throw-errno ] when ;
|
||||
|
||||
<PRIVATE
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@ IN: io.files.acls.macosx
|
|||
! [ uuid_string_t <struct> [ mbr_uuid_to_string io-error ] keep ]
|
||||
} case ;
|
||||
|
||||
: acl-error ( n -- ) -1 = [ (io-error) ] when ; inline
|
||||
: acl-error ( n -- ) -1 = [ throw-errno ] when ; inline
|
||||
|
||||
:: file-acl ( path -- acl_t/f )
|
||||
path
|
||||
|
@ -25,9 +25,10 @@ IN: io.files.acls.macosx
|
|||
clear-errno
|
||||
ACL_TYPE_EXTENDED acl_get_file dup [
|
||||
errno ENOENT = [
|
||||
[ path exists? ] preserve-errno [ drop f ] [ (io-error) ] if
|
||||
[ path exists? ] preserve-errno
|
||||
[ drop f ] [ throw-errno ] if
|
||||
] [
|
||||
(io-error)
|
||||
throw-errno
|
||||
] if
|
||||
] unless ;
|
||||
|
||||
|
|
Loading…
Reference in New Issue