Skip to content

Commit 9f554bf

Browse files
committed
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.
1 parent 8764410 commit 9f554bf

File tree

8 files changed

+8
-8
lines changed

8 files changed

+8
-8
lines changed

src/fuchsia/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -3139,7 +3139,7 @@ f! {
31393139
return
31403140
}
31413141

3142-
pub fn FD_ISSET(fd: ::c_int, set: *mut fd_set) -> bool {
3142+
pub fn FD_ISSET(fd: ::c_int, set: *const fd_set) -> bool {
31433143
let fd = fd as usize;
31443144
let size = ::mem::size_of_val(&(*set).fds_bits[0]) * 8;
31453145
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
@@ -466,7 +466,7 @@ f! {
466466
return
467467
}
468468

469-
pub fn FD_ISSET(fd: ::c_int, set: *mut fd_set) -> bool {
469+
pub fn FD_ISSET(fd: ::c_int, set: *const fd_set) -> bool {
470470
let bits = ::mem::size_of_val(&(*set).fds_bits[0]) * 8;
471471
let fd = fd as usize;
472472
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
@@ -1214,7 +1214,7 @@ f! {
12141214
return
12151215
}
12161216

1217-
pub fn FD_ISSET(fd: ::c_int, set: *mut fd_set) -> bool {
1217+
pub fn FD_ISSET(fd: ::c_int, set: *const fd_set) -> bool {
12181218
let fd = fd as usize;
12191219
let size = ::mem::size_of_val(&(*set).fds_bits[0]) * 8;
12201220
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
@@ -1244,7 +1244,7 @@ f! {
12441244
return
12451245
}
12461246

1247-
pub fn FD_ISSET(fd: ::c_int, set: *mut fd_set) -> bool {
1247+
pub fn FD_ISSET(fd: ::c_int, set: *const fd_set) -> bool {
12481248
let fd = fd as usize;
12491249
let size = ::mem::size_of_val(&(*set).fds_bits[0]) * 8;
12501250
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
@@ -555,7 +555,7 @@ f! {
555555
return
556556
}
557557

558-
pub fn FD_ISSET(fd: ::c_int, set: *mut fd_set) -> bool {
558+
pub fn FD_ISSET(fd: ::c_int, set: *const fd_set) -> bool {
559559
let bits = ::mem::size_of_val(&(*set).fds_bits[0]) * 8;
560560
let fd = fd as usize;
561561
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
@@ -847,7 +847,7 @@ f! {
847847
return
848848
}
849849

850-
pub fn FD_ISSET(fd: ::c_int, set: *mut fd_set) -> bool {
850+
pub fn FD_ISSET(fd: ::c_int, set: *const fd_set) -> bool {
851851
let fd = fd as usize;
852852
let size = ::mem::size_of_val(&(*set).fds_bits[0]) * 8;
853853
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
@@ -2054,7 +2054,7 @@ f! {
20542054
return
20552055
}
20562056

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

src/unix/uclibc/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1511,7 +1511,7 @@ f! {
15111511
return
15121512
}
15131513

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

0 commit comments

Comments
 (0)