mod.rs 604 B

1234567891011121314151617181920212223242526
  1. //! sys/select.h implementation
  2. use core::mem;
  3. use header::sys_time::timeval;
  4. use platform::types::*;
  5. use platform::{Pal, Sys};
  6. // fd_set is also defined in C because cbindgen is incompatible with mem::size_of booo
  7. pub const FD_SETSIZE: usize = 1024;
  8. #[repr(C)]
  9. pub struct fd_set {
  10. pub fds_bits: [c_ulong; FD_SETSIZE / (8 * mem::size_of::<c_ulong>())],
  11. }
  12. #[no_mangle]
  13. pub extern "C" fn select(
  14. nfds: c_int,
  15. readfds: *mut fd_set,
  16. writefds: *mut fd_set,
  17. exceptfds: *mut fd_set,
  18. timeout: *mut timeval,
  19. ) -> c_int {
  20. Sys::select(nfds, readfds, writefds, exceptfds, timeout)
  21. }