Skip to content

Commit

Permalink
Change FD_SETSIZE to c_int
Browse files Browse the repository at this point in the history
  • Loading branch information
magicant committed Sep 18, 2023
1 parent 7a012b6 commit 41a44a0
Show file tree
Hide file tree
Showing 15 changed files with 27 additions and 27 deletions.
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 @@ -4053,7 +4053,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 @@ -1826,7 +1826,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 @@ -1266,7 +1266,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 @@ -1099,7 +1099,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
4 changes: 2 additions & 2 deletions src/unix/hermit/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ s_no_extra_traits! {
}

pub struct fd_set {
fds_bits: [::c_ulong; FD_SETSIZE / ULONG_SIZE],
fds_bits: [::c_ulong; FD_SETSIZE as usize / ULONG_SIZE],
}

pub struct sockaddr_storage {
Expand Down Expand Up @@ -638,7 +638,7 @@ pub const F_CNVT: ::c_int = 12;
pub const F_RSETLKW: ::c_int = 13;
pub const F_DUPFD_CLOEXEC: ::c_int = 14;

pub const FD_SETSIZE: usize = 1024;
pub const FD_SETSIZE: ::c_int = 1024;

// Dummy
pub const FIOCLEX: ::c_int = 0x5451;
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 @@ -187,7 +187,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 @@ -299,11 +299,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 @@ -123,7 +123,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 @@ -692,7 +692,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

0 comments on commit 41a44a0

Please sign in to comment.