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