File tree 1 file changed +3
-7
lines changed 1 file changed +3
-7
lines changed Original file line number Diff line number Diff line change 1
1
//! Linux `eventfd` implementation.
2
2
use std:: cell:: { Cell , RefCell } ;
3
3
use std:: io;
4
- use std:: io:: { Error , ErrorKind } ;
4
+ use std:: io:: ErrorKind ;
5
5
6
6
use crate :: concurrency:: VClock ;
7
7
use crate :: shims:: unix:: fd:: FileDescriptionRef ;
@@ -66,9 +66,7 @@ impl FileDescription for Event {
66
66
let ty = ecx. machine . layouts . u64 ;
67
67
// Check the size of slice, and return error only if the size of the slice < 8.
68
68
if len < ty. size . bytes_usize ( ) {
69
- ecx. set_last_error_from_io_error ( Error :: from ( ErrorKind :: InvalidInput ) ) ?;
70
- ecx. write_int ( -1 , dest) ?;
71
- return Ok ( ( ) ) ;
69
+ return ecx. set_last_error_and_return ( ErrorKind :: InvalidInput , dest) ;
72
70
}
73
71
74
72
// eventfd read at the size of u64.
@@ -78,9 +76,7 @@ impl FileDescription for Event {
78
76
let counter = self . counter . get ( ) ;
79
77
if counter == 0 {
80
78
if self . is_nonblock {
81
- ecx. set_last_error_from_io_error ( Error :: from ( ErrorKind :: WouldBlock ) ) ?;
82
- ecx. write_int ( -1 , dest) ?;
83
- return Ok ( ( ) ) ;
79
+ return ecx. set_last_error_and_return ( ErrorKind :: WouldBlock , dest) ;
84
80
}
85
81
86
82
throw_unsup_format ! ( "eventfd: blocking is unsupported" ) ;
You can’t perform that action at this time.
0 commit comments