fix bootstrap on intel mac
parent
c53e75ef0f
commit
5de68cd30f
|
@ -10,12 +10,12 @@ IN: io.unix.mmap
|
|||
>r f -roll r> open-r/w [ 0 mmap ] keep
|
||||
over MAP_FAILED = [ close (io-error) ] when ;
|
||||
|
||||
M: unix-io <mapped-file> ( path length -- obj )
|
||||
M: unix <mapped-file> ( path length -- obj )
|
||||
swap >r
|
||||
dup PROT_READ PROT_WRITE bitor MAP_FILE MAP_SHARED bitor
|
||||
r> mmap-open f mapped-file construct-boa ;
|
||||
|
||||
M: unix-io close-mapped-file ( mmap -- )
|
||||
M: unix close-mapped-file ( mmap -- )
|
||||
[ mapped-file-address ] keep
|
||||
[ mapped-file-length munmap ] keep
|
||||
mapped-file-handle close
|
||||
|
|
|
@ -7,7 +7,7 @@ USING: alien alien.c-types generic io kernel math namespaces
|
|||
io.nonblocking parser threads unix sequences
|
||||
byte-arrays io.sockets io.binary io.unix.backend
|
||||
io.streams.duplex io.sockets.impl math.parser continuations libc
|
||||
combinators io.backend io.files ;
|
||||
combinators io.backend io.files system ;
|
||||
IN: io.unix.sockets
|
||||
|
||||
: pending-init-error ( port -- )
|
||||
|
@ -23,7 +23,7 @@ IN: io.unix.sockets
|
|||
: sockopt ( fd level opt -- )
|
||||
1 <int> "int" heap-size setsockopt io-error ;
|
||||
|
||||
M: unix-io addrinfo-error ( n -- )
|
||||
M: unix addrinfo-error ( n -- )
|
||||
dup zero? [ drop ] [ gai_strerror throw ] if ;
|
||||
|
||||
! Client sockets - TCP and Unix domain
|
||||
|
@ -42,7 +42,7 @@ M: connect-task do-io-task
|
|||
: wait-to-connect ( port -- )
|
||||
[ <connect-task> add-io-task ] with-port-continuation drop ;
|
||||
|
||||
M: unix-io (client) ( addrspec -- client-in client-out )
|
||||
M: unix (client) ( addrspec -- client-in client-out )
|
||||
dup make-sockaddr/size >r >r
|
||||
protocol-family SOCK_STREAM socket-fd
|
||||
dup r> r> connect
|
||||
|
@ -91,11 +91,11 @@ USE: io.sockets
|
|||
dup rot make-sockaddr/size bind
|
||||
zero? [ dup close (io-error) ] unless ;
|
||||
|
||||
M: unix-io (server) ( addrspec -- handle )
|
||||
M: unix (server) ( addrspec -- handle )
|
||||
SOCK_STREAM server-fd
|
||||
dup 10 listen zero? [ dup close (io-error) ] unless ;
|
||||
|
||||
M: unix-io (accept) ( server -- addrspec handle )
|
||||
M: unix (accept) ( server -- addrspec handle )
|
||||
#! Wait for a client connection.
|
||||
dup check-server-port
|
||||
dup wait-to-accept
|
||||
|
@ -104,7 +104,7 @@ M: unix-io (accept) ( server -- addrspec handle )
|
|||
swap server-port-client ;
|
||||
|
||||
! Datagram sockets - UDP and Unix domain
|
||||
M: unix-io <datagram>
|
||||
M: unix <datagram>
|
||||
[ SOCK_DGRAM server-fd ] keep <datagram-port> ;
|
||||
|
||||
SYMBOL: receive-buffer
|
||||
|
@ -147,7 +147,7 @@ M: receive-task do-io-task
|
|||
: wait-receive ( stream -- )
|
||||
[ <receive-task> add-io-task ] with-port-continuation drop ;
|
||||
|
||||
M: unix-io receive ( datagram -- packet addrspec )
|
||||
M: unix receive ( datagram -- packet addrspec )
|
||||
dup check-datagram-port
|
||||
dup wait-receive
|
||||
dup pending-error
|
||||
|
@ -179,7 +179,7 @@ M: send-task do-io-task
|
|||
[ <send-task> add-io-task ] with-port-continuation
|
||||
2drop 2drop ;
|
||||
|
||||
M: unix-io send ( packet addrspec datagram -- )
|
||||
M: unix send ( packet addrspec datagram -- )
|
||||
3dup check-datagram-send
|
||||
[ >r make-sockaddr/size r> wait-send ] keep
|
||||
pending-error ;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
USING: io.unix.backend io.unix.files io.unix.sockets io.timeouts
|
||||
io.unix.launcher io.unix.mmap io.backend combinators namespaces
|
||||
system vocabs.loader sequences ;
|
||||
system vocabs.loader sequences words ;
|
||||
|
||||
"io.unix." os word-name append require
|
||||
|
|
|
@ -73,8 +73,8 @@ C-STRUCT: sockaddr-un
|
|||
: SEEK_END 2 ; inline
|
||||
|
||||
os {
|
||||
{ "macosx" [ "unix.bsd.macosx" require ] }
|
||||
{ "freebsd" [ "unix.bsd.freebsd" require ] }
|
||||
{ "openbsd" [ "unix.bsd.openbsd" require ] }
|
||||
{ "netbsd" [ "unix.bsd.netbsd" require ] }
|
||||
{ macosx [ "unix.bsd.macosx" require ] }
|
||||
{ freebsd [ "unix.bsd.freebsd" require ] }
|
||||
{ openbsd [ "unix.bsd.openbsd" require ] }
|
||||
{ netbsd [ "unix.bsd.netbsd" require ] }
|
||||
} case
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
! Copyright (C) 2008 Slava Pestov.
|
||||
! See http://factorcode.org/license.txt for BSD license.
|
||||
USING: alien.syntax system sequences vocabs.loader ;
|
||||
USING: alien.syntax system sequences vocabs.loader words ;
|
||||
IN: unix.kqueue
|
||||
|
||||
<< "unix.kqueue." os word-name append require >>
|
||||
|
|
|
@ -1,17 +1,14 @@
|
|||
|
||||
USING: kernel system alien.syntax combinators vocabs.loader ;
|
||||
|
||||
USING: kernel system alien.syntax combinators vocabs.loader
|
||||
system ;
|
||||
IN: unix.types
|
||||
|
||||
TYPEDEF: void* caddr_t
|
||||
|
||||
os
|
||||
{
|
||||
{ "linux" [ "unix.types.linux" require ] }
|
||||
{ "macosx" [ "unix.types.macosx" require ] }
|
||||
{ "freebsd" [ "unix.types.freebsd" require ] }
|
||||
{ "openbsd" [ "unix.types.openbsd" require ] }
|
||||
{ "netbsd" [ "unix.types.netbsd" require ] }
|
||||
{ "winnt" [ ] }
|
||||
}
|
||||
case
|
||||
os {
|
||||
{ linux [ "unix.types.linux" require ] }
|
||||
{ macosx [ "unix.types.macosx" require ] }
|
||||
{ freebsd [ "unix.types.freebsd" require ] }
|
||||
{ openbsd [ "unix.types.openbsd" require ] }
|
||||
{ netbsd [ "unix.types.netbsd" require ] }
|
||||
{ winnt [ ] }
|
||||
} case
|
||||
|
|
|
@ -161,8 +161,8 @@ FUNCTION: pid_t waitpid ( pid_t wpid, int* status, int options ) ;
|
|||
FUNCTION: ssize_t write ( int fd, void* buf, size_t nbytes ) ;
|
||||
|
||||
{
|
||||
{ [ linux? ] [ "unix.linux" require ] }
|
||||
{ [ bsd? ] [ "unix.bsd" require ] }
|
||||
{ [ solaris? ] [ "unix.solaris" require ] }
|
||||
{ [ os linux? ] [ "unix.linux" require ] }
|
||||
{ [ os bsd? ] [ "unix.bsd" require ] }
|
||||
{ [ os solaris? ] [ "unix.solaris" require ] }
|
||||
} cond
|
||||
|
||||
|
|
Loading…
Reference in New Issue