auto merge of #17497 : nodakai/rust/libnative-misc-fixes, r=alexcrichton
libnative/io: datasync() wrongly called fsync(). liblibc and libnative: send() should use const buffers.
This commit is contained in:
commit
375fe17218
4 changed files with 5 additions and 5 deletions
|
@ -4633,7 +4633,7 @@ pub mod funcs {
|
||||||
option_len: socklen_t) -> c_int;
|
option_len: socklen_t) -> c_int;
|
||||||
pub fn recv(socket: c_int, buf: *mut c_void, len: size_t,
|
pub fn recv(socket: c_int, buf: *mut c_void, len: size_t,
|
||||||
flags: c_int) -> ssize_t;
|
flags: c_int) -> ssize_t;
|
||||||
pub fn send(socket: c_int, buf: *mut c_void, len: size_t,
|
pub fn send(socket: c_int, buf: *const c_void, len: size_t,
|
||||||
flags: c_int) -> ssize_t;
|
flags: c_int) -> ssize_t;
|
||||||
pub fn recvfrom(socket: c_int, buf: *mut c_void, len: size_t,
|
pub fn recvfrom(socket: c_int, buf: *mut c_void, len: size_t,
|
||||||
flags: c_int, addr: *mut sockaddr,
|
flags: c_int, addr: *mut sockaddr,
|
||||||
|
@ -4673,7 +4673,7 @@ pub mod funcs {
|
||||||
pub fn closesocket(socket: SOCKET) -> c_int;
|
pub fn closesocket(socket: SOCKET) -> c_int;
|
||||||
pub fn recv(socket: SOCKET, buf: *mut c_void, len: c_int,
|
pub fn recv(socket: SOCKET, buf: *mut c_void, len: c_int,
|
||||||
flags: c_int) -> c_int;
|
flags: c_int) -> c_int;
|
||||||
pub fn send(socket: SOCKET, buf: *mut c_void, len: c_int,
|
pub fn send(socket: SOCKET, buf: *const c_void, len: c_int,
|
||||||
flags: c_int) -> c_int;
|
flags: c_int) -> c_int;
|
||||||
pub fn recvfrom(socket: SOCKET, buf: *mut c_void, len: c_int,
|
pub fn recvfrom(socket: SOCKET, buf: *mut c_void, len: c_int,
|
||||||
flags: c_int, addr: *mut sockaddr,
|
flags: c_int, addr: *mut sockaddr,
|
||||||
|
|
|
@ -303,7 +303,7 @@ impl rtio::RtioFileStream for CFile {
|
||||||
self.flush().and_then(|()| self.fd.fsync())
|
self.flush().and_then(|()| self.fd.fsync())
|
||||||
}
|
}
|
||||||
fn datasync(&mut self) -> IoResult<()> {
|
fn datasync(&mut self) -> IoResult<()> {
|
||||||
self.flush().and_then(|()| self.fd.fsync())
|
self.flush().and_then(|()| self.fd.datasync())
|
||||||
}
|
}
|
||||||
fn truncate(&mut self, offset: i64) -> IoResult<()> {
|
fn truncate(&mut self, offset: i64) -> IoResult<()> {
|
||||||
self.flush().and_then(|()| self.fd.truncate(offset))
|
self.flush().and_then(|()| self.fd.truncate(offset))
|
||||||
|
|
|
@ -337,7 +337,7 @@ impl rtio::RtioTcpStream for TcpStream {
|
||||||
let dowrite = |nb: bool, buf: *const u8, len: uint| unsafe {
|
let dowrite = |nb: bool, buf: *const u8, len: uint| unsafe {
|
||||||
let flags = if nb {c::MSG_DONTWAIT} else {0};
|
let flags = if nb {c::MSG_DONTWAIT} else {0};
|
||||||
libc::send(fd,
|
libc::send(fd,
|
||||||
buf as *mut libc::c_void,
|
buf as *const _,
|
||||||
len as wrlen,
|
len as wrlen,
|
||||||
flags) as i64
|
flags) as i64
|
||||||
};
|
};
|
||||||
|
|
|
@ -173,7 +173,7 @@ impl rtio::RtioPipe for UnixStream {
|
||||||
let dowrite = |nb: bool, buf: *const u8, len: uint| unsafe {
|
let dowrite = |nb: bool, buf: *const u8, len: uint| unsafe {
|
||||||
let flags = if nb {c::MSG_DONTWAIT} else {0};
|
let flags = if nb {c::MSG_DONTWAIT} else {0};
|
||||||
libc::send(fd,
|
libc::send(fd,
|
||||||
buf as *mut libc::c_void,
|
buf as *const _,
|
||||||
len as libc::size_t,
|
len as libc::size_t,
|
||||||
flags) as i64
|
flags) as i64
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue