@@ -7,20 +7,20 @@ fn main() {
7
7
let flags = libc:: EFD_CLOEXEC ;
8
8
let fd = unsafe { libc:: eventfd ( 0 , flags) } ;
9
9
let mut sized_8_data: [ u8 ; 8 ] ;
10
+
11
+ // Write u64 - 1.
10
12
if cfg ! ( target_endian = "big" ) {
11
13
// Adjust the data based on the endianness of host system.
12
14
sized_8_data = [ 255 , 255 , 255 , 255 , 255 , 255 , 255 , 254 ] ;
13
15
} else {
14
16
sized_8_data = [ 254 , 255 , 255 , 255 , 255 , 255 , 255 , 255 ] ;
15
17
}
16
- // Write u64 - 1.
17
- let _res: i64 = unsafe {
18
+ let res: i64 = unsafe {
18
19
libc:: write ( fd, sized_8_data. as_ptr ( ) as * const libc:: c_void , 8 ) . try_into ( ) . unwrap ( )
19
20
} ;
20
- // Write u64 - 1.
21
- let _res: i64 = unsafe {
22
- libc:: write ( fd, sized_8_data. as_ptr ( ) as * const libc:: c_void , 8 ) . try_into ( ) . unwrap ( ) //~ERROR: blocking is unsupported
23
- } ;
21
+ assert_eq ! ( res, 8 ) ;
22
+
23
+ // Write 1.
24
24
if cfg ! ( target_endian = "big" ) {
25
25
// Adjust the data based on the endianess of host system.
26
26
sized_8_data = [ 0 , 0 , 0 , 0 , 0 , 0 , 0 , 1 ] ;
@@ -29,6 +29,6 @@ fn main() {
29
29
}
30
30
// Write 1 to the counter.
31
31
let _res: i64 = unsafe {
32
- libc:: write ( fd, sized_8_data. as_ptr ( ) as * const libc:: c_void , 8 ) . try_into ( ) . unwrap ( )
32
+ libc:: write ( fd, sized_8_data. as_ptr ( ) as * const libc:: c_void , 8 ) . try_into ( ) . unwrap ( ) //~ERROR: blocking is unsupported
33
33
} ;
34
34
}
0 commit comments