diff options
| author | Geoffroy Couprie <geo.couprie@gmail.com> | 2014-01-16 16:56:21 +0100 |
|---|---|---|
| committer | Alex Crichton <alex@alexcrichton.com> | 2014-02-16 18:45:48 -0800 |
| commit | a226f566002b58d618787f1121388b3df65be9c2 (patch) | |
| tree | ae01e5bd7c2f749b34b8e4ed6740a271f00a7787 /src/libstd | |
| parent | c8489069b43191c5298f17430933b3b88fb79c3c (diff) | |
| download | rust-a226f566002b58d618787f1121388b3df65be9c2.tar.gz rust-a226f566002b58d618787f1121388b3df65be9c2.zip | |
Implement Unix domain sockets in libnative
Diffstat (limited to 'src/libstd')
| -rw-r--r-- | src/libstd/libc.rs | 24 | ||||
| -rw-r--r-- | src/libstd/rt/rtio.rs | 5 |
2 files changed, 29 insertions, 0 deletions
diff --git a/src/libstd/libc.rs b/src/libstd/libc.rs index 7dc4c692f63..c42a8896053 100644 --- a/src/libstd/libc.rs +++ b/src/libstd/libc.rs @@ -269,6 +269,7 @@ pub mod types { pub mod bsd44 { use libc::types::os::arch::c95::{c_char, c_int, c_uint}; + pub static sun_len:uint = 108; pub type socklen_t = u32; pub type sa_family_t = u16; pub type in_port_t = u16; @@ -319,6 +320,10 @@ pub mod types { ai_canonname: *c_char, ai_next: *addrinfo } + pub struct sockaddr_un { + sun_family: sa_family_t, + sun_path: [c_char, ..108] + } } } @@ -636,6 +641,7 @@ pub mod types { pub mod bsd44 { use libc::types::os::arch::c95::{c_char, c_int, c_uint}; + pub static sun_len:uint = 104; pub type socklen_t = u32; pub type sa_family_t = u8; pub type in_port_t = u16; @@ -691,6 +697,11 @@ pub mod types { ai_addr: *sockaddr, ai_next: *addrinfo } + pub struct sockaddr_un { + sun_len: u8, + sun_family: sa_family_t, + sun_path: [c_char, ..104] + } } } @@ -833,6 +844,7 @@ pub mod types { pub mod bsd44 { use libc::types::os::arch::c95::{c_char, c_int, c_uint, size_t}; + pub static sun_len:uint = 108; pub type SOCKET = c_uint; pub type socklen_t = c_int; pub type sa_family_t = u16; @@ -884,6 +896,10 @@ pub mod types { ai_addr: *sockaddr, ai_next: *addrinfo } + pub struct sockaddr_un { + sun_family: sa_family_t, + sun_path: [c_char, ..108] + } } } @@ -1197,6 +1213,7 @@ pub mod types { pub mod bsd44 { use libc::types::os::arch::c95::{c_char, c_int, c_uint}; + pub static sun_len:uint = 104; pub type socklen_t = c_int; pub type sa_family_t = u8; pub type in_port_t = u16; @@ -1252,6 +1269,11 @@ pub mod types { ai_addr: *sockaddr, ai_next: *addrinfo } + pub struct sockaddr_un { + sun_len: u8, + sun_family: sa_family_t, + sun_path: [c_char, ..104] + } } } @@ -2310,6 +2332,7 @@ pub mod consts { pub static MADV_UNMERGEABLE : c_int = 13; pub static MADV_HWPOISON : c_int = 100; + pub static AF_UNIX: c_int = 1; pub static AF_INET: c_int = 2; pub static AF_INET6: c_int = 10; pub static SOCK_STREAM: c_int = 1; @@ -3137,6 +3160,7 @@ pub mod consts { pub static MINCORE_REFERENCED_OTHER : c_int = 0x8; pub static MINCORE_MODIFIED_OTHER : c_int = 0x10; + pub static AF_UNIX: c_int = 1; pub static AF_INET: c_int = 2; pub static AF_INET6: c_int = 30; pub static SOCK_STREAM: c_int = 1; diff --git a/src/libstd/rt/rtio.rs b/src/libstd/rt/rtio.rs index 5573f8ec02e..578ace2ba86 100644 --- a/src/libstd/rt/rtio.rs +++ b/src/libstd/rt/rtio.rs @@ -260,6 +260,11 @@ pub trait RtioPipe { fn clone(&self) -> ~RtioPipe; } +pub trait RtioDatagramPipe : RtioPipe { + fn recvfrom(&mut self, buf: &mut [u8]) -> Result<(uint, CString), IoError>; + fn sendto(&mut self, buf: &[u8], dst: &CString) -> Result<(), IoError>; +} + pub trait RtioUnixListener { fn listen(~self) -> Result<~RtioUnixAcceptor, IoError>; } |
