Skip to content

Commit e9db959

Browse files
committed
Merge pull request rust-lang#172 from kamalmarhubi/splice-and-friends
linux: Add splice, tee, vmsplice
2 parents 748c92a + 0cfc25f commit e9db959

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

src/unix/notbsd/mod.rs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ pub type sa_family_t = u16;
44
pub type pthread_key_t = ::c_uint;
55
pub type speed_t = ::c_uint;
66
pub type tcflag_t = ::c_uint;
7+
pub type loff_t = ::c_longlong;
78

89
pub enum timezone {}
910

@@ -526,6 +527,11 @@ pub const CLONE_CHILD_SETTID: ::c_int = 0x01000000;
526527

527528
pub const WNOHANG: ::c_int = 1;
528529

530+
pub const SPLICE_F_MOVE: ::c_uint = 0x01;
531+
pub const SPLICE_F_NONBLOCK: ::c_uint = 0x02;
532+
pub const SPLICE_F_MORE: ::c_uint = 0x04;
533+
pub const SPLICE_F_GIFT: ::c_uint = 0x08;
534+
529535
f! {
530536
pub fn FD_CLR(fd: ::c_int, set: *mut fd_set) -> () {
531537
let fd = fd as usize;
@@ -616,6 +622,21 @@ extern {
616622
pub fn fstatfs(fd: ::c_int, buf: *mut statfs) -> ::c_int;
617623
pub fn memrchr(cx: *const ::c_void, c: ::c_int, n: ::size_t) -> *mut ::c_void;
618624
pub fn syscall(num: ::c_long, ...) -> ::c_long;
625+
pub fn splice(fd_in: ::c_int,
626+
off_in: *mut ::loff_t,
627+
fd_out: ::c_int,
628+
off_out: *mut ::loff_t,
629+
len: ::size_t,
630+
flags: ::c_uint) -> ::ssize_t;
631+
pub fn tee(fd_in: ::c_int,
632+
fd_out: ::c_int,
633+
len: ::size_t,
634+
flags: ::c_uint) -> ::ssize_t;
635+
pub fn vmsplice(fd: ::c_int,
636+
iov: *const ::iovec,
637+
nr_segs: ::size_t,
638+
flags: ::c_uint) -> ::ssize_t;
639+
619640
}
620641

621642
cfg_if! {

0 commit comments

Comments
 (0)