Skip to content

Commit 4a53e6d

Browse files
committed
Auto merge of #1725 - asomers:fd_isset, r=Amanieu
FD_ISSET: take a *const fd_set instead of *mut fd_set FD_ISSET does not modify its fd_set argument, so it may as well take a const pointer. AFAICT the only reason to take a *mut pointer is because the Linux man page documents it that way (though since glibc implements it as a macro, the constedness is undefined). But since libc implements it directly rather than calling a (nonexistent on most platforms) C function, we're defining the API ourselves.
2 parents c958c90 + 3eafb3b commit 4a53e6d

File tree

7 files changed

+7
-7
lines changed

7 files changed

+7
-7
lines changed

src/fuchsia/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -3158,7 +3158,7 @@ f! {
31583158
return
31593159
}
31603160

3161-
pub fn FD_ISSET(fd: ::c_int, set: *mut fd_set) -> bool {
3161+
pub fn FD_ISSET(fd: ::c_int, set: *const fd_set) -> bool {
31623162
let fd = fd as usize;
31633163
let size = ::mem::size_of_val(&(*set).fds_bits[0]) * 8;
31643164
return ((*set).fds_bits[fd / size] & (1 << (fd % size))) != 0

src/unix/bsd/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -541,7 +541,7 @@ f! {
541541
return
542542
}
543543

544-
pub fn FD_ISSET(fd: ::c_int, set: *mut fd_set) -> bool {
544+
pub fn FD_ISSET(fd: ::c_int, set: *const fd_set) -> bool {
545545
let bits = ::mem::size_of_val(&(*set).fds_bits[0]) * 8;
546546
let fd = fd as usize;
547547
return ((*set).fds_bits[fd / bits] & (1 << (fd % bits))) != 0

src/unix/haiku/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1295,7 +1295,7 @@ f! {
12951295
return
12961296
}
12971297

1298-
pub fn FD_ISSET(fd: ::c_int, set: *mut fd_set) -> bool {
1298+
pub fn FD_ISSET(fd: ::c_int, set: *const fd_set) -> bool {
12991299
let fd = fd as usize;
13001300
let size = ::mem::size_of_val(&(*set).fds_bits[0]) * 8;
13011301
return ((*set).fds_bits[fd / size] & (1 << (fd % size))) != 0

src/unix/linux_like/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1397,7 +1397,7 @@ f! {
13971397
return
13981398
}
13991399

1400-
pub fn FD_ISSET(fd: ::c_int, set: *mut fd_set) -> bool {
1400+
pub fn FD_ISSET(fd: ::c_int, set: *const fd_set) -> bool {
14011401
let fd = fd as usize;
14021402
let size = ::mem::size_of_val(&(*set).fds_bits[0]) * 8;
14031403
return ((*set).fds_bits[fd / size] & (1 << (fd % size))) != 0

src/unix/newlib/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -558,7 +558,7 @@ f! {
558558
return
559559
}
560560

561-
pub fn FD_ISSET(fd: ::c_int, set: *mut fd_set) -> bool {
561+
pub fn FD_ISSET(fd: ::c_int, set: *const fd_set) -> bool {
562562
let bits = ::mem::size_of_val(&(*set).fds_bits[0]) * 8;
563563
let fd = fd as usize;
564564
return ((*set).fds_bits[fd / bits] & (1 << (fd % bits))) != 0

src/unix/redox/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -898,7 +898,7 @@ f! {
898898
return
899899
}
900900

901-
pub fn FD_ISSET(fd: ::c_int, set: *mut fd_set) -> bool {
901+
pub fn FD_ISSET(fd: ::c_int, set: *const fd_set) -> bool {
902902
let fd = fd as usize;
903903
let size = ::mem::size_of_val(&(*set).fds_bits[0]) * 8;
904904
return ((*set).fds_bits[fd / size] & (1 << (fd % size))) != 0

src/unix/solarish/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2171,7 +2171,7 @@ f! {
21712171
return
21722172
}
21732173

2174-
pub fn FD_ISSET(fd: ::c_int, set: *mut fd_set) -> bool {
2174+
pub fn FD_ISSET(fd: ::c_int, set: *const fd_set) -> bool {
21752175
let bits = ::mem::size_of_val(&(*set).fds_bits[0]) * 8;
21762176
let fd = fd as usize;
21772177
return ((*set).fds_bits[fd / bits] & (1 << (fd % bits))) != 0

0 commit comments

Comments
 (0)