Convert usages of 'close' to 'close-file'
parent
b029942d1d
commit
d4172cca47
|
@ -85,8 +85,7 @@ M: integer init-handle ( fd -- )
|
||||||
[ F_SETFL O_NONBLOCK fcntl drop ]
|
[ F_SETFL O_NONBLOCK fcntl drop ]
|
||||||
[ F_SETFD FD_CLOEXEC fcntl drop ] bi ;
|
[ F_SETFD FD_CLOEXEC fcntl drop ] bi ;
|
||||||
|
|
||||||
M: integer close-handle ( fd -- )
|
M: integer close-handle ( fd -- ) close-file ;
|
||||||
close ;
|
|
||||||
|
|
||||||
TUPLE: unix-io-error error port ;
|
TUPLE: unix-io-error error port ;
|
||||||
|
|
||||||
|
|
|
@ -32,7 +32,7 @@ M: unix (file-writer) ( path -- stream )
|
||||||
|
|
||||||
: open-append ( path -- fd )
|
: open-append ( path -- fd )
|
||||||
append-flags file-mode open-file
|
append-flags file-mode open-file
|
||||||
[ dup 0 SEEK_END lseek io-error ] [ ] [ close ] cleanup ;
|
[ dup 0 SEEK_END lseek io-error ] [ ] [ close-file ] cleanup ;
|
||||||
|
|
||||||
M: unix (file-appender) ( path -- stream )
|
M: unix (file-appender) ( path -- stream )
|
||||||
open-append <output-port> ;
|
open-append <output-port> ;
|
||||||
|
@ -43,7 +43,7 @@ M: unix (file-appender) ( path -- stream )
|
||||||
M: unix touch-file ( path -- )
|
M: unix touch-file ( path -- )
|
||||||
normalize-path
|
normalize-path
|
||||||
dup exists? [ touch ] [
|
dup exists? [ touch ] [
|
||||||
touch-mode file-mode open-file close
|
touch-mode file-mode open-file close-file
|
||||||
] if ;
|
] if ;
|
||||||
|
|
||||||
M: unix move-file ( from to -- )
|
M: unix move-file ( from to -- )
|
||||||
|
|
|
@ -31,7 +31,7 @@ USE: unix
|
||||||
] when* ;
|
] when* ;
|
||||||
|
|
||||||
: redirect-fd ( oldfd fd -- )
|
: redirect-fd ( oldfd fd -- )
|
||||||
2dup = [ 2drop ] [ dupd dup2 io-error close ] if ;
|
2dup = [ 2drop ] [ dupd dup2 io-error close-file ] if ;
|
||||||
|
|
||||||
: reset-fd ( fd -- )
|
: reset-fd ( fd -- )
|
||||||
#! We drop the error code because on *BSD, fcntl of
|
#! We drop the error code because on *BSD, fcntl of
|
||||||
|
|
|
@ -8,7 +8,7 @@ IN: io.unix.mmap
|
||||||
|
|
||||||
: mmap-open ( length prot flags path -- alien fd )
|
: mmap-open ( length prot flags path -- alien fd )
|
||||||
>r f -roll r> open-r/w [ 0 mmap ] keep
|
>r f -roll r> open-r/w [ 0 mmap ] keep
|
||||||
over MAP_FAILED = [ close (io-error) ] when ;
|
over MAP_FAILED = [ close-file (io-error) ] when ;
|
||||||
|
|
||||||
M: unix (mapped-file) ( path length -- obj )
|
M: unix (mapped-file) ( path length -- obj )
|
||||||
swap >r
|
swap >r
|
||||||
|
@ -18,5 +18,5 @@ M: unix (mapped-file) ( path length -- obj )
|
||||||
M: unix close-mapped-file ( mmap -- )
|
M: unix close-mapped-file ( mmap -- )
|
||||||
[ mapped-file-address ] keep
|
[ mapped-file-address ] keep
|
||||||
[ mapped-file-length munmap ] keep
|
[ mapped-file-length munmap ] keep
|
||||||
mapped-file-handle close
|
mapped-file-handle close-file
|
||||||
io-error ;
|
io-error ;
|
||||||
|
|
|
@ -79,7 +79,7 @@ M: accept-task do-io-task
|
||||||
>r dup protocol-family r> socket-fd
|
>r dup protocol-family r> socket-fd
|
||||||
dup init-server-socket
|
dup init-server-socket
|
||||||
dup rot make-sockaddr/size bind
|
dup rot make-sockaddr/size bind
|
||||||
zero? [ dup close (io-error) ] unless ;
|
zero? [ dup close-file (io-error) ] unless ;
|
||||||
|
|
||||||
M: unix (server) ( addrspec -- handle )
|
M: unix (server) ( addrspec -- handle )
|
||||||
[
|
[
|
||||||
|
|
Loading…
Reference in New Issue