File tree Expand file tree Collapse file tree 5 files changed +35
-1
lines changed Expand file tree Collapse file tree 5 files changed +35
-1
lines changed Original file line number Diff line number Diff line change @@ -145,6 +145,7 @@ fn main() {
145145 cfg. header ( "sys/epoll.h" ) ;
146146 cfg. header ( "sys/eventfd.h" ) ;
147147 cfg. header ( "sys/prctl.h" ) ;
148+ cfg. header ( "sys/sendfile.h" ) ;
148149 cfg. header ( "sys/vfs.h" ) ;
149150 cfg. header ( "sys/syscall.h" ) ;
150151 if !musl {
Original file line number Diff line number Diff line change @@ -250,6 +250,13 @@ s! {
250250 pub l_type: :: c_short,
251251 pub l_whence: :: c_short,
252252 }
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+ }
253260}
254261
255262pub const EXIT_FAILURE : :: c_int = 1 ;
@@ -914,6 +921,12 @@ extern {
914921 id : :: c_int ,
915922 data : * mut :: c_char ) -> :: c_int ;
916923 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 ;
917930}
918931
919932cfg_if ! {
Original file line number Diff line number Diff line change @@ -4,6 +4,9 @@ pub type fsfilcnt_t = ::uint64_t;
44pub const PTHREAD_STACK_MIN : :: size_t = 2048 ;
55pub const KERN_PROC_PATHNAME : :: c_int = 12 ;
66pub 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 ;
710
811extern {
912 pub fn __error ( ) -> * mut :: c_int ;
Original file line number Diff line number Diff line change @@ -139,6 +139,13 @@ s! {
139139 pub l_whence: :: c_short,
140140 pub l_sysid: :: c_int,
141141 }
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+ }
142149}
143150
144151pub const EXIT_FAILURE : :: c_int = 1 ;
@@ -616,6 +623,13 @@ extern {
616623 pub fn sched_setscheduler ( pid : :: pid_t , policy : :: c_int , param : * const sched_param ) -> :: c_int ;
617624 pub fn sched_getscheduler ( pid : :: pid_t ) -> :: c_int ;
618625 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 ;
619633}
620634
621635cfg_if ! {
Original file line number Diff line number Diff line change @@ -624,6 +624,10 @@ extern {
624624 pub fn fstatfs ( fd : :: c_int , buf : * mut statfs ) -> :: c_int ;
625625 pub fn memrchr ( cx : * const :: c_void , c : :: c_int , n : :: size_t ) -> * mut :: c_void ;
626626 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 ;
627631 pub fn splice ( fd_in : :: c_int ,
628632 off_in : * mut :: loff_t ,
629633 fd_out : :: c_int ,
@@ -638,7 +642,6 @@ extern {
638642 iov : * const :: iovec ,
639643 nr_segs : :: size_t ,
640644 flags : :: c_uint ) -> :: ssize_t ;
641-
642645}
643646
644647cfg_if ! {
You can’t perform that action at this time.
0 commit comments