From 69852817b4f2553b2d725ebcaabc14e81d0285e6 Mon Sep 17 00:00:00 2001 From: WATANABE Yuki Date: Fri, 10 Nov 2023 23:40:49 +0900 Subject: [PATCH] Change FD_SETSIZE to c_int --- src/fuchsia/mod.rs | 4 ++-- src/unix/aix/mod.rs | 2 +- src/unix/bsd/apple/mod.rs | 2 +- src/unix/bsd/freebsdlike/mod.rs | 2 +- src/unix/bsd/mod.rs | 4 ++-- src/unix/bsd/netbsdlike/netbsd/mod.rs | 2 +- src/unix/bsd/netbsdlike/openbsd/mod.rs | 2 +- src/unix/haiku/mod.rs | 2 +- src/unix/hurd/mod.rs | 8 ++++---- src/unix/linux_like/mod.rs | 4 ++-- src/unix/newlib/mod.rs | 8 ++++---- src/unix/nto/mod.rs | 4 ++-- src/unix/redox/mod.rs | 4 ++-- src/unix/solarish/mod.rs | 8 ++++---- src/wasi.rs | 2 +- 15 files changed, 29 insertions(+), 29 deletions(-) diff --git a/src/fuchsia/mod.rs b/src/fuchsia/mod.rs index 5c57dccfa7f62..35991e463669b 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 7cefcae5026f9..a1ab1d4dfb36a 100644 --- a/src/unix/aix/mod.rs +++ b/src/unix/aix/mod.rs @@ -2118,7 +2118,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 8231c2e33c966..b475c4b6797fb 100644 --- a/src/unix/bsd/apple/mod.rs +++ b/src/unix/bsd/apple/mod.rs @@ -4384,7 +4384,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 d0524e44c7fda..79de969c8be6b 100644 --- a/src/unix/bsd/freebsdlike/mod.rs +++ b/src/unix/bsd/freebsdlike/mod.rs @@ -1193,7 +1193,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 9a2e6c463d36b..435ffc39cd8d2 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 9724cde29288b..2f383bfb9b9e9 100644 --- a/src/unix/bsd/netbsdlike/netbsd/mod.rs +++ b/src/unix/bsd/netbsdlike/netbsd/mod.rs @@ -1847,7 +1847,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 e584c80202b2b..145f46d0ba0f2 100644 --- a/src/unix/bsd/netbsdlike/openbsd/mod.rs +++ b/src/unix/bsd/netbsdlike/openbsd/mod.rs @@ -1422,7 +1422,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 e7b0f34dd371a..50ed271d65e15 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 2fbd0cbc1c724..d780e22f78e7b 100644 --- a/src/unix/hurd/mod.rs +++ b/src/unix/hurd/mod.rs @@ -1211,7 +1211,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; @@ -1256,7 +1256,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; @@ -1588,8 +1588,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 0c8c32adb20e2..103559df0a53d 100644 --- a/src/unix/linux_like/mod.rs +++ b/src/unix/linux_like/mod.rs @@ -92,7 +92,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 { @@ -1072,7 +1072,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: u32 = 0x1; pub const EPOLLPRI: u32 = 0x2; diff --git a/src/unix/newlib/mod.rs b/src/unix/newlib/mod.rs index 43ddd06347c42..ed787e01868d4 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 @@ -280,11 +280,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 9eef23458d14a..bfb5c2ee5716d 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 19315c3872c88..e219695107d7b 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 { @@ -759,7 +759,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 cb89a686dc24b..d710c7f60b1bb 100644 --- a/src/unix/solarish/mod.rs +++ b/src/unix/solarish/mod.rs @@ -514,9 +514,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 { @@ -1236,9 +1236,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 ae490bf94d7a2..39d6949146405 100644 --- a/src/wasi.rs +++ b/src/wasi.rs @@ -207,7 +207,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;