diff --git a/src/fuchsia/mod.rs b/src/fuchsia/mod.rs index bf1a543609406..af334ea455c3b 100644 --- a/src/fuchsia/mod.rs +++ b/src/fuchsia/mod.rs @@ -380,7 +380,7 @@ s! { } pub struct fd_set { - fds_bits: [::c_ulong; FD_SETSIZE / ULONG_SIZE], + fds_bits: [::c_ulong; FD_SETSIZE as usize / ULONG_SIZE], } pub struct tm { @@ -1827,7 +1827,7 @@ pub const SS_DISABLE: ::c_int = 2; pub const PATH_MAX: ::c_int = 4096; -pub const FD_SETSIZE: usize = 1024; +pub const FD_SETSIZE: ::c_int = 1024; pub const EPOLLIN: ::c_int = 0x1; pub const EPOLLPRI: ::c_int = 0x2; diff --git a/src/unix/aix/mod.rs b/src/unix/aix/mod.rs index 0d7c2ed1d1b65..2ea524954c6f3 100644 --- a/src/unix/aix/mod.rs +++ b/src/unix/aix/mod.rs @@ -2140,7 +2140,7 @@ pub const POWER_8: ::c_int = 0x10000; pub const POWER_9: ::c_int = 0x20000; // sys/time.h -pub const FD_SETSIZE: usize = 65534; +pub const FD_SETSIZE: ::c_int = 65534; pub const TIMEOFDAY: ::c_int = 9; pub const CLOCK_REALTIME: ::clockid_t = TIMEOFDAY as clockid_t; pub const CLOCK_MONOTONIC: ::clockid_t = 10; diff --git a/src/unix/bsd/apple/mod.rs b/src/unix/bsd/apple/mod.rs index 21efb23eb2e32..f7437a9637e9f 100644 --- a/src/unix/bsd/apple/mod.rs +++ b/src/unix/bsd/apple/mod.rs @@ -4364,7 +4364,7 @@ pub const OS_SIGNPOST_INTERVAL_END: ::os_signpost_type_t = 0x02; pub const MINSIGSTKSZ: ::size_t = 32768; pub const SIGSTKSZ: ::size_t = 131072; -pub const FD_SETSIZE: usize = 1024; +pub const FD_SETSIZE: ::c_int = 1024; pub const ST_NOSUID: ::c_ulong = 2; diff --git a/src/unix/bsd/freebsdlike/mod.rs b/src/unix/bsd/freebsdlike/mod.rs index d2cd7794b107e..faeda848d07c9 100644 --- a/src/unix/bsd/freebsdlike/mod.rs +++ b/src/unix/bsd/freebsdlike/mod.rs @@ -1204,7 +1204,7 @@ pub const SCHED_FIFO: ::c_int = 1; pub const SCHED_OTHER: ::c_int = 2; pub const SCHED_RR: ::c_int = 3; -pub const FD_SETSIZE: usize = 1024; +pub const FD_SETSIZE: ::c_int = 1024; pub const ST_NOSUID: ::c_ulong = 2; diff --git a/src/unix/bsd/mod.rs b/src/unix/bsd/mod.rs index 6ce041357ebee..c3563abd4ebe2 100644 --- a/src/unix/bsd/mod.rs +++ b/src/unix/bsd/mod.rs @@ -59,10 +59,10 @@ s! { pub struct fd_set { #[cfg(all(target_pointer_width = "64", any(target_os = "freebsd", target_os = "dragonfly")))] - fds_bits: [i64; FD_SETSIZE / 64], + fds_bits: [i64; FD_SETSIZE as usize / 64], #[cfg(not(all(target_pointer_width = "64", any(target_os = "freebsd", target_os = "dragonfly"))))] - fds_bits: [i32; FD_SETSIZE / 32], + fds_bits: [i32; FD_SETSIZE as usize / 32], } pub struct tm { diff --git a/src/unix/bsd/netbsdlike/netbsd/mod.rs b/src/unix/bsd/netbsdlike/netbsd/mod.rs index 45f42d74165ee..0c9daabceb214 100644 --- a/src/unix/bsd/netbsdlike/netbsd/mod.rs +++ b/src/unix/bsd/netbsdlike/netbsd/mod.rs @@ -1860,7 +1860,7 @@ pub const _SC_SCHED_RT_TS: ::c_int = 2001; pub const _SC_SCHED_PRI_MIN: ::c_int = 2002; pub const _SC_SCHED_PRI_MAX: ::c_int = 2003; -pub const FD_SETSIZE: usize = 0x100; +pub const FD_SETSIZE: ::c_int = 0x100; pub const ST_NOSUID: ::c_ulong = 8; diff --git a/src/unix/bsd/netbsdlike/openbsd/mod.rs b/src/unix/bsd/netbsdlike/openbsd/mod.rs index 17dfa6571568f..a8ebdf53cf98c 100644 --- a/src/unix/bsd/netbsdlike/openbsd/mod.rs +++ b/src/unix/bsd/netbsdlike/openbsd/mod.rs @@ -1374,7 +1374,7 @@ pub const _SC_AVPHYS_PAGES: ::c_int = 501; pub const _SC_NPROCESSORS_CONF: ::c_int = 502; pub const _SC_NPROCESSORS_ONLN: ::c_int = 503; -pub const FD_SETSIZE: usize = 1024; +pub const FD_SETSIZE: ::c_int = 1024; pub const SCHED_FIFO: ::c_int = 1; pub const SCHED_OTHER: ::c_int = 2; diff --git a/src/unix/haiku/mod.rs b/src/unix/haiku/mod.rs index 00e9523c9865a..e742878f824b9 100644 --- a/src/unix/haiku/mod.rs +++ b/src/unix/haiku/mod.rs @@ -1100,7 +1100,7 @@ pub const SA_ONESHOT: ::c_int = SA_RESETHAND; pub const SS_ONSTACK: ::c_int = 0x1; pub const SS_DISABLE: ::c_int = 0x2; -pub const FD_SETSIZE: usize = 1024; +pub const FD_SETSIZE: ::c_int = 1024; pub const RTLD_LOCAL: ::c_int = 0x0; pub const RTLD_NOW: ::c_int = 0x1; diff --git a/src/unix/hurd/mod.rs b/src/unix/hurd/mod.rs index 75a272e4dd7de..9ab0e0bbcd1d8 100644 --- a/src/unix/hurd/mod.rs +++ b/src/unix/hurd/mod.rs @@ -1084,7 +1084,7 @@ pub const SHM_UNLOCK: ::c_int = 12; pub const STDIN_FILENO: ::c_int = 0; pub const STDOUT_FILENO: ::c_int = 1; pub const STDERR_FILENO: ::c_int = 2; -pub const __FD_SETSIZE: usize = 256; +pub const __FD_SETSIZE: ::c_int = 256; pub const R_OK: ::c_int = 4; pub const W_OK: ::c_int = 2; pub const X_OK: ::c_int = 1; @@ -1129,7 +1129,7 @@ pub const PDP_ENDIAN: usize = 3412; pub const BYTE_ORDER: usize = 1234; // sys/select.h -pub const FD_SETSIZE: usize = 256; +pub const FD_SETSIZE: ::c_int = 256; pub const __SIZEOF_PTHREAD_MUTEX_T: usize = 32; pub const __SIZEOF_PTHREAD_ATTR_T: usize = 32; pub const __SIZEOF_PTHREAD_RWLOCK_T: usize = 28; @@ -1452,8 +1452,8 @@ pub const _POSIX_MQ_OPEN_MAX: usize = 8; pub const _POSIX_MQ_PRIO_MAX: usize = 32; pub const _POSIX_NAME_MAX: usize = 14; pub const _POSIX_NGROUPS_MAX: usize = 8; -pub const _POSIX_OPEN_MAX: usize = 20; -pub const _POSIX_FD_SETSIZE: usize = 20; +pub const _POSIX_OPEN_MAX: ::c_int = 20; +pub const _POSIX_FD_SETSIZE: ::c_int = 20; pub const _POSIX_PATH_MAX: usize = 256; pub const _POSIX_PIPE_BUF: usize = 512; pub const _POSIX_RE_DUP_MAX: usize = 255; diff --git a/src/unix/linux_like/mod.rs b/src/unix/linux_like/mod.rs index 26fd68de49c7c..5ec1eb3f8b378 100644 --- a/src/unix/linux_like/mod.rs +++ b/src/unix/linux_like/mod.rs @@ -89,7 +89,7 @@ s! { } pub struct fd_set { - fds_bits: [::c_ulong; FD_SETSIZE / ULONG_SIZE], + fds_bits: [::c_ulong; FD_SETSIZE as usize / ULONG_SIZE], } pub struct tm { @@ -1069,7 +1069,7 @@ pub const PATH_MAX: ::c_int = 4096; pub const UIO_MAXIOV: ::c_int = 1024; -pub const FD_SETSIZE: usize = 1024; +pub const FD_SETSIZE: ::c_int = 1024; pub const EPOLLIN: ::c_int = 0x1; pub const EPOLLPRI: ::c_int = 0x2; diff --git a/src/unix/newlib/mod.rs b/src/unix/newlib/mod.rs index a572cc38bfda9..e8e7e191819dd 100644 --- a/src/unix/newlib/mod.rs +++ b/src/unix/newlib/mod.rs @@ -171,7 +171,7 @@ s! { } pub struct fd_set { // Unverified - fds_bits: [::c_ulong; FD_SETSIZE / ULONG_SIZE], + fds_bits: [::c_ulong; FD_SETSIZE as usize / ULONG_SIZE], } pub struct passwd { // Unverified @@ -283,11 +283,11 @@ pub const PTHREAD_MUTEX_ERRORCHECK: ::c_int = 2; cfg_if! { if #[cfg(any(target_os = "horizon", target_os = "espidf"))] { - pub const FD_SETSIZE: usize = 64; + pub const FD_SETSIZE: ::c_int = 64; } else if #[cfg(target_os = "vita")] { - pub const FD_SETSIZE: usize = 256; + pub const FD_SETSIZE: ::c_int = 256; } else { - pub const FD_SETSIZE: usize = 1024; + pub const FD_SETSIZE: ::c_int = 1024; } } // intentionally not public, only used for fd_set diff --git a/src/unix/nto/mod.rs b/src/unix/nto/mod.rs index 91e531ffd7961..79c45e8413960 100644 --- a/src/unix/nto/mod.rs +++ b/src/unix/nto/mod.rs @@ -154,7 +154,7 @@ s! { } pub struct fd_set { - fds_bits: [::c_uint; 2 * FD_SETSIZE / ULONG_SIZE], + fds_bits: [::c_uint; 2 * FD_SETSIZE as usize / ULONG_SIZE], } pub struct tm { @@ -1383,7 +1383,7 @@ pub const PATH_MAX: ::c_int = 1024; pub const UIO_MAXIOV: ::c_int = 1024; -pub const FD_SETSIZE: usize = 256; +pub const FD_SETSIZE: ::c_int = 256; pub const TCIOFF: ::c_int = 0x0002; pub const TCION: ::c_int = 0x0003; diff --git a/src/unix/redox/mod.rs b/src/unix/redox/mod.rs index cd219a777288f..a0ead95e98c12 100644 --- a/src/unix/redox/mod.rs +++ b/src/unix/redox/mod.rs @@ -116,7 +116,7 @@ s! { } pub struct fd_set { - fds_bits: [::c_ulong; ::FD_SETSIZE / ULONG_SIZE], + fds_bits: [::c_ulong; ::FD_SETSIZE as usize / ULONG_SIZE], } pub struct in_addr { @@ -758,7 +758,7 @@ pub const MS_INVALIDATE: ::c_int = 0x0002; pub const MS_SYNC: ::c_int = 0x0004; // sys/select.h -pub const FD_SETSIZE: usize = 1024; +pub const FD_SETSIZE: ::c_int = 1024; // sys/socket.h pub const AF_INET: ::c_int = 2; diff --git a/src/unix/solarish/mod.rs b/src/unix/solarish/mod.rs index a3fa56a65a67e..ccaa012088b2d 100644 --- a/src/unix/solarish/mod.rs +++ b/src/unix/solarish/mod.rs @@ -518,9 +518,9 @@ s_no_extra_traits! { pub struct fd_set { #[cfg(target_pointer_width = "64")] - fds_bits: [i64; FD_SETSIZE / 64], + fds_bits: [i64; FD_SETSIZE as usize / 64], #[cfg(target_pointer_width = "32")] - fds_bits: [i32; FD_SETSIZE / 32], + fds_bits: [i32; FD_SETSIZE as usize / 32], } pub struct sockaddr_storage { @@ -1250,9 +1250,9 @@ pub const IPV6_V6ONLY: ::c_int = 0x27; cfg_if! { if #[cfg(target_pointer_width = "64")] { - pub const FD_SETSIZE: usize = 65536; + pub const FD_SETSIZE: ::c_int = 65536; } else { - pub const FD_SETSIZE: usize = 1024; + pub const FD_SETSIZE: ::c_int = 1024; } } diff --git a/src/wasi.rs b/src/wasi.rs index 1a855e0e0fe77..16d859ab5d8f3 100644 --- a/src/wasi.rs +++ b/src/wasi.rs @@ -206,7 +206,7 @@ pub const F_SETFD: c_int = 2; pub const F_GETFL: c_int = 3; pub const F_SETFL: c_int = 4; pub const FD_CLOEXEC: c_int = 1; -pub const FD_SETSIZE: size_t = 1024; +pub const FD_SETSIZE: c_int = 1024; pub const O_APPEND: c_int = 0x0001; pub const O_DSYNC: c_int = 0x0002; pub const O_NONBLOCK: c_int = 0x0004;