@@ -69,6 +69,10 @@ unsafe impl OpCode for OpenFile {
6969 . build ( )
7070 . into ( )
7171 }
72+
73+ fn call_blocking ( self : Pin < & mut Self > ) -> io:: Result < usize > {
74+ self . call ( )
75+ }
7276}
7377
7478unsafe impl OpCode for CloseFile {
@@ -77,21 +81,21 @@ unsafe impl OpCode for CloseFile {
7781 . build ( )
7882 . into ( )
7983 }
84+
85+ fn call_blocking ( self : Pin < & mut Self > ) -> io:: Result < usize > {
86+ self . call ( )
87+ }
8088}
8189
8290unsafe impl < S : AsFd > OpCode for TruncateFile < S > {
8391 fn create_entry ( self : Pin < & mut Self > ) -> OpEntry {
84- if super :: is_op_supported ( opcode:: Ftruncate :: CODE ) {
85- return opcode:: Ftruncate :: new ( Fd ( self . fd . as_fd ( ) . as_raw_fd ( ) ) , self . size )
86- . build ( )
87- . into ( ) ;
88- }
89-
90- OpEntry :: Blocking
92+ opcode:: Ftruncate :: new ( Fd ( self . fd . as_fd ( ) . as_raw_fd ( ) ) , self . size )
93+ . build ( )
94+ . into ( )
9195 }
9296
9397 fn call_blocking ( self : Pin < & mut Self > ) -> io:: Result < usize > {
94- self . truncate ( )
98+ self . call ( )
9599 }
96100}
97101
@@ -127,6 +131,19 @@ unsafe impl<S: AsFd> OpCode for FileStat<S> {
127131 . build ( )
128132 . into ( )
129133 }
134+
135+ fn call_blocking ( self : Pin < & mut Self > ) -> io:: Result < usize > {
136+ let this = self . project ( ) ;
137+ static EMPTY_NAME : & [ u8 ] = b"\0 " ;
138+ let res = syscall ! ( libc:: statx(
139+ this. fd. as_fd( ) . as_raw_fd( ) ,
140+ EMPTY_NAME . as_ptr( ) . cast( ) ,
141+ libc:: AT_EMPTY_PATH ,
142+ statx_mask( ) ,
143+ this. stat as * mut _ as _
144+ ) ) ?;
145+ Ok ( res as _ )
146+ }
130147}
131148
132149impl < S > IntoInner for FileStat < S > {
@@ -171,6 +188,21 @@ unsafe impl OpCode for PathStat {
171188 . build ( )
172189 . into ( )
173190 }
191+
192+ fn call_blocking ( mut self : Pin < & mut Self > ) -> io:: Result < usize > {
193+ let mut flags = libc:: AT_EMPTY_PATH ;
194+ if !self . follow_symlink {
195+ flags |= libc:: AT_SYMLINK_NOFOLLOW ;
196+ }
197+ let res = syscall ! ( libc:: statx(
198+ libc:: AT_FDCWD ,
199+ self . path. as_ptr( ) ,
200+ flags,
201+ statx_mask( ) ,
202+ std:: ptr:: addr_of_mut!( self . stat) . cast( )
203+ ) ) ?;
204+ Ok ( res as _ )
205+ }
174206}
175207
176208impl IntoInner for PathStat {
@@ -316,6 +348,10 @@ unsafe impl OpCode for Unlink {
316348 . build ( )
317349 . into ( )
318350 }
351+
352+ fn call_blocking ( self : Pin < & mut Self > ) -> io:: Result < usize > {
353+ self . call ( )
354+ }
319355}
320356
321357unsafe impl OpCode for CreateDir {
@@ -325,6 +361,10 @@ unsafe impl OpCode for CreateDir {
325361 . build ( )
326362 . into ( )
327363 }
364+
365+ fn call_blocking ( self : Pin < & mut Self > ) -> io:: Result < usize > {
366+ self . call ( )
367+ }
328368}
329369
330370unsafe impl OpCode for Rename {
@@ -338,6 +378,10 @@ unsafe impl OpCode for Rename {
338378 . build ( )
339379 . into ( )
340380 }
381+
382+ fn call_blocking ( self : Pin < & mut Self > ) -> io:: Result < usize > {
383+ self . call ( )
384+ }
341385}
342386
343387unsafe impl OpCode for Symlink {
@@ -350,6 +394,10 @@ unsafe impl OpCode for Symlink {
350394 . build ( )
351395 . into ( )
352396 }
397+
398+ fn call_blocking ( self : Pin < & mut Self > ) -> io:: Result < usize > {
399+ self . call ( )
400+ }
353401}
354402
355403unsafe impl OpCode for HardLink {
@@ -363,21 +411,21 @@ unsafe impl OpCode for HardLink {
363411 . build ( )
364412 . into ( )
365413 }
414+
415+ fn call_blocking ( self : Pin < & mut Self > ) -> io:: Result < usize > {
416+ self . call ( )
417+ }
366418}
367419
368420unsafe impl OpCode for CreateSocket {
369421 fn create_entry ( self : Pin < & mut Self > ) -> OpEntry {
370- if super :: is_op_supported ( opcode:: Socket :: CODE ) {
371- opcode:: Socket :: new (
372- self . domain ,
373- self . socket_type | libc:: SOCK_CLOEXEC ,
374- self . protocol ,
375- )
376- . build ( )
377- . into ( )
378- } else {
379- OpEntry :: Blocking
380- }
422+ opcode:: Socket :: new (
423+ self . domain ,
424+ self . socket_type | libc:: SOCK_CLOEXEC ,
425+ self . protocol ,
426+ )
427+ . build ( )
428+ . into ( )
381429 }
382430
383431 fn call_blocking ( self : Pin < & mut Self > ) -> io:: Result < usize > {
@@ -395,6 +443,10 @@ unsafe impl<S: AsFd> OpCode for ShutdownSocket<S> {
395443 . build ( )
396444 . into ( )
397445 }
446+
447+ fn call_blocking ( self : Pin < & mut Self > ) -> io:: Result < usize > {
448+ self . call ( )
449+ }
398450}
399451
400452unsafe impl OpCode for CloseSocket {
@@ -403,6 +455,10 @@ unsafe impl OpCode for CloseSocket {
403455 . build ( )
404456 . into ( )
405457 }
458+
459+ fn call_blocking ( self : Pin < & mut Self > ) -> io:: Result < usize > {
460+ self . call ( )
461+ }
406462}
407463
408464unsafe impl < S : AsFd > OpCode for Accept < S > {
@@ -756,6 +812,29 @@ unsafe impl<S1: AsFd, S2: AsFd> OpCode for Splice<S1, S2> {
756812 . build ( )
757813 . into ( )
758814 }
815+
816+ fn call_blocking ( self : Pin < & mut Self > ) -> io:: Result < usize > {
817+ let mut offset_in = self . offset_in ;
818+ let mut offset_out = self . offset_out ;
819+ let offset_in_ptr = if offset_in < 0 {
820+ std:: ptr:: null_mut ( )
821+ } else {
822+ & mut offset_in
823+ } ;
824+ let offset_out_ptr = if offset_out < 0 {
825+ std:: ptr:: null_mut ( )
826+ } else {
827+ & mut offset_out
828+ } ;
829+ Ok ( syscall ! ( libc:: splice(
830+ self . fd_in. as_fd( ) . as_raw_fd( ) ,
831+ offset_in_ptr,
832+ self . fd_out. as_fd( ) . as_raw_fd( ) ,
833+ offset_out_ptr,
834+ self . len,
835+ self . flags,
836+ ) ) ? as _ )
837+ }
759838}
760839
761840mod buf_ring {
0 commit comments