File tree 5 files changed +35
-1
lines changed 5 files changed +35
-1
lines changed Original file line number Diff line number Diff line change @@ -145,6 +145,7 @@ fn main() {
145
145
cfg. header ( "sys/epoll.h" ) ;
146
146
cfg. header ( "sys/eventfd.h" ) ;
147
147
cfg. header ( "sys/prctl.h" ) ;
148
+ cfg. header ( "sys/sendfile.h" ) ;
148
149
cfg. header ( "sys/vfs.h" ) ;
149
150
cfg. header ( "sys/syscall.h" ) ;
150
151
if !musl {
Original file line number Diff line number Diff line change @@ -250,6 +250,13 @@ s! {
250
250
pub l_type: :: c_short,
251
251
pub l_whence: :: c_short,
252
252
}
253
+
254
+ pub struct sf_hdtr {
255
+ pub headers: * mut :: iovec,
256
+ pub hdr_cnt: :: c_int,
257
+ pub trailers: * mut :: iovec,
258
+ pub trl_cnt: :: c_int,
259
+ }
253
260
}
254
261
255
262
pub const EXIT_FAILURE : :: c_int = 1 ;
@@ -914,6 +921,12 @@ extern {
914
921
id : :: c_int ,
915
922
data : * mut :: c_char ) -> :: c_int ;
916
923
pub fn sethostname ( name : * const :: c_char , len : :: c_int ) -> :: c_int ;
924
+ pub fn sendfile ( fd : :: c_int ,
925
+ s : :: c_int ,
926
+ offset : :: off_t ,
927
+ len : * mut :: off_t ,
928
+ hdtr : * mut :: sf_hdtr ,
929
+ flags : :: c_int ) -> :: c_int ;
917
930
}
918
931
919
932
cfg_if ! {
Original file line number Diff line number Diff line change @@ -4,6 +4,9 @@ pub type fsfilcnt_t = ::uint64_t;
4
4
pub const PTHREAD_STACK_MIN : :: size_t = 2048 ;
5
5
pub const KERN_PROC_PATHNAME : :: c_int = 12 ;
6
6
pub const SIGSTKSZ : :: size_t = 34816 ;
7
+ pub const SF_NODISKIO : :: c_int = 0x00000001 ;
8
+ pub const SF_MNOWAIT : :: c_int = 0x00000002 ;
9
+ pub const SF_SYNC : :: c_int = 0x00000004 ;
7
10
8
11
extern {
9
12
pub fn __error ( ) -> * mut :: c_int ;
Original file line number Diff line number Diff line change @@ -139,6 +139,13 @@ s! {
139
139
pub l_whence: :: c_short,
140
140
pub l_sysid: :: c_int,
141
141
}
142
+
143
+ pub struct sf_hdtr {
144
+ pub headers: * mut :: iovec,
145
+ pub hdr_cnt: :: c_int,
146
+ pub trailers: * mut :: iovec,
147
+ pub trl_cnt: :: c_int,
148
+ }
142
149
}
143
150
144
151
pub const EXIT_FAILURE : :: c_int = 1 ;
@@ -616,6 +623,13 @@ extern {
616
623
pub fn sched_setscheduler ( pid : :: pid_t , policy : :: c_int , param : * const sched_param ) -> :: c_int ;
617
624
pub fn sched_getscheduler ( pid : :: pid_t ) -> :: c_int ;
618
625
pub fn memrchr ( cx : * const :: c_void , c : :: c_int , n : :: size_t ) -> * mut :: c_void ;
626
+ pub fn sendfile ( fd : :: c_int ,
627
+ s : :: c_int ,
628
+ offset : :: off_t ,
629
+ nbytes : :: size_t ,
630
+ hdtr : * mut :: sf_hdtr ,
631
+ sbytes : * mut :: off_t ,
632
+ flags : :: c_int ) -> :: c_int ;
619
633
}
620
634
621
635
cfg_if ! {
Original file line number Diff line number Diff line change @@ -624,6 +624,10 @@ extern {
624
624
pub fn fstatfs ( fd : :: c_int , buf : * mut statfs ) -> :: c_int ;
625
625
pub fn memrchr ( cx : * const :: c_void , c : :: c_int , n : :: size_t ) -> * mut :: c_void ;
626
626
pub fn syscall ( num : :: c_long , ...) -> :: c_long ;
627
+ pub fn sendfile ( out_fd : :: c_int ,
628
+ in_fd : :: c_int ,
629
+ offset : * mut off_t ,
630
+ count : :: size_t ) -> :: ssize_t ;
627
631
pub fn splice ( fd_in : :: c_int ,
628
632
off_in : * mut :: loff_t ,
629
633
fd_out : :: c_int ,
@@ -638,7 +642,6 @@ extern {
638
642
iov : * const :: iovec ,
639
643
nr_segs : :: size_t ,
640
644
flags : :: c_uint ) -> :: ssize_t ;
641
-
642
645
}
643
646
644
647
cfg_if ! {
You can’t perform that action at this time.
0 commit comments