WHAMMY! convert io.sockets.unix
parent
475530ef3d
commit
c6fcb32136
|
@ -4,7 +4,7 @@ USING: alien alien.c-types alien.strings generic kernel math threads
|
||||||
sequences byte-arrays io.binary io.backend.unix io.streams.duplex
|
sequences byte-arrays io.binary io.backend.unix io.streams.duplex
|
||||||
io.backend io.pathnames io.files.private io.encodings.utf8 math.parser
|
io.backend io.pathnames io.files.private io.encodings.utf8 math.parser
|
||||||
continuations libc combinators system accessors destructors unix
|
continuations libc combinators system accessors destructors unix
|
||||||
locals init ;
|
locals init classes.struct ;
|
||||||
|
|
||||||
EXCLUDE: namespaces => bind ;
|
EXCLUDE: namespaces => bind ;
|
||||||
EXCLUDE: io => read write ;
|
EXCLUDE: io => read write ;
|
||||||
|
@ -139,17 +139,17 @@ M: unix (send) ( packet addrspec datagram -- )
|
||||||
! Unix domain sockets
|
! Unix domain sockets
|
||||||
M: local protocol-family drop PF_UNIX ;
|
M: local protocol-family drop PF_UNIX ;
|
||||||
|
|
||||||
M: local sockaddr-size drop "sockaddr-un" heap-size ;
|
M: local sockaddr-size drop sockaddr-un heap-size ;
|
||||||
|
|
||||||
M: local empty-sockaddr drop "sockaddr-un" <c-object> ;
|
M: local empty-sockaddr drop sockaddr-un <struct> ;
|
||||||
|
|
||||||
M: local make-sockaddr
|
M: local make-sockaddr
|
||||||
path>> (normalize-path)
|
path>> (normalize-path)
|
||||||
dup length 1 + max-un-path > [ "Path too long" throw ] when
|
dup length 1 + max-un-path > [ "Path too long" throw ] when
|
||||||
"sockaddr-un" <c-object>
|
sockaddr-un <struct>
|
||||||
AF_UNIX over set-sockaddr-un-family
|
AF_UNIX >>family
|
||||||
[ [ utf8 string>alien ] dip set-sockaddr-un-path ] keep ;
|
swap utf8 string>alien >>path ;
|
||||||
|
|
||||||
M: local parse-sockaddr
|
M: local parse-sockaddr
|
||||||
drop
|
drop
|
||||||
sockaddr-un-path utf8 alien>string <local> ;
|
path>> utf8 alien>string <local> ;
|
||||||
|
|
Loading…
Reference in New Issue