]> gitweb.factorcode.org Git - factor.git/commitdiff
libc: rename (io-error) to throw-errno.
authorJohn Benediktsson <mrjbq7@gmail.com>
Fri, 21 Nov 2014 17:29:45 +0000 (09:29 -0800)
committerJohn Benediktsson <mrjbq7@gmail.com>
Fri, 21 Nov 2014 17:29:45 +0000 (09:29 -0800)
basis/io/backend/unix/unix.factor
basis/io/directories/unix/unix.factor
basis/io/files/info/unix/unix.factor
basis/io/files/unix/unix.factor
basis/io/mmap/unix/unix.factor
basis/io/sockets/secure/openssl/openssl.factor
basis/io/sockets/unix/unix.factor
basis/libc/libc.factor
extra/io/files/acls/macosx/macosx.factor

index c0dac8f7171135038eeaee725c770b583662c3e6..10eb5ed103c8abc82befd0d2b50828f5cadb8cd8 100755 (executable)
@@ -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 )
index b401813005dab22df157bc133031163c68b9ac1d..6197e3a9e892e91101279eeaeb5eded07b505af0 100644 (file)
@@ -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
 
index 23f8103822c3214b12c98561709d6e1161a2af0a..54bf32480025c14416a0eef7ccadcab617f6821e 100644 (file)
@@ -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>
index 108f3bd4758b299f5b09e1758627d17deeb25ab3..39517bc68f6d02e75e05b0d3b6edc542ac06dad3 100644 (file)
@@ -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 ;
 
index 9703561b91d59704f1221a76435f64306c3924ff..3d8fde7ee6cd5cd6db3e02b6f3788b61579f9da1 100644 (file)
@@ -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)
index 417ca98fd17d9d4af53f5b92970f9163cb7cad7d..137741cc1556ede2dcca0fc69be6f3bfcdbae516 100644 (file)
@@ -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
index 085e0a33c48bff79db070f9c0fd1a35d654701c5..33f8e76c28cf8d0c95cfad90bb350999e934c073 100644 (file)
@@ -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
 
index d69b9994ffb72624a02c3e2d5622e849d0831243..18adc2a249af8a788c6e4ae03f5475fa8a79230a 100644 (file)
@@ -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
 
index 87bf22794b551748fe287c600421f3ee4b3656f8..71b24eb502afca60de3aa32e652b6ac382367e92 100644 (file)
@@ -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 ;