Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change FD_SETSIZE to c_int #3356

Merged
merged 1 commit into from
Jan 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/fuchsia/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/unix/aix/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/unix/bsd/apple/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
2 changes: 1 addition & 1 deletion src/unix/bsd/freebsdlike/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
4 changes: 2 additions & 2 deletions src/unix/bsd/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion src/unix/bsd/netbsdlike/netbsd/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
2 changes: 1 addition & 1 deletion src/unix/bsd/netbsdlike/openbsd/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/unix/haiku/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
8 changes: 4 additions & 4 deletions src/unix/hurd/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions src/unix/linux_like/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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;
Expand Down
8 changes: 4 additions & 4 deletions src/unix/newlib/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions src/unix/nto/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions src/unix/redox/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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;
Expand Down
8 changes: 4 additions & 4 deletions src/unix/solarish/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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;
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/wasi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down