File tree Expand file tree Collapse file tree 1 file changed +13
-2
lines changed Expand file tree Collapse file tree 1 file changed +13
-2
lines changed Original file line number Diff line number Diff line change @@ -1162,15 +1162,26 @@ impl UnixCmsg {
1162
1162
}
1163
1163
} ,
1164
1164
BlockingMode :: Timeout ( duration) => {
1165
- let events = libc:: POLLIN | libc:: POLLPRI | libc:: POLLRDHUP ;
1165
+ #[ cfg( target_os = "linux" ) ]
1166
+ const POLLRDHUP : lib:: c_short = libc:: POLLRDHUP ;
1167
+
1168
+ // It's rather unfortunate that Rust's libc doesn't know that
1169
+ // FreeBSD has POLLRDHUP, but in the mean time we can add
1170
+ // the value ourselves.
1171
+ // https://cgit.freebsd.org/src/tree/sys/sys/poll.h#n72
1172
+ #[ cfg( target_os = "freebsd" ) ]
1173
+ const POLLRDHUP : libc:: c_short = 0x4000 ;
1174
+
1175
+ let events = libc:: POLLIN | libc:: POLLPRI | POLLRDHUP ;
1176
+
1166
1177
let mut fd = [ libc:: pollfd {
1167
1178
fd,
1168
1179
events,
1169
1180
revents : 0 ,
1170
1181
} ] ;
1171
1182
let result = libc:: poll (
1172
1183
fd. as_mut_ptr ( ) ,
1173
- fd. len ( ) as libc :: c_ulong ,
1184
+ fd. len ( ) as _ ,
1174
1185
duration. as_millis ( ) . try_into ( ) . unwrap_or ( -1 ) ,
1175
1186
) ;
1176
1187
You can’t perform that action at this time.
0 commit comments