Skip to content

Commit

Permalink
debugging
Browse files Browse the repository at this point in the history
  • Loading branch information
sunfishcode committed Sep 24, 2024
1 parent d9150b0 commit 06bc6e7
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions tests/event/select.rs
Original file line number Diff line number Diff line change
Expand Up @@ -298,12 +298,35 @@ fn test_select_with_maxfd_sockets() {
setrlimit(Resource::Nofile, rlimit).unwrap();

dbg!("hello");
dbg!(fd_limit);
// Renumber the fds to the maximum possible values.
unsafe {
dbg!(libc::fcntl(fd_limit as RawFd - 1, libc::F_GETFD));
}
let great_fd = unsafe { libc::dup2(reader.as_raw_fd(), fd_limit as RawFd - 1) };
dbg!("hello");
dbg!(great_fd);
dbg!(fd_limit as RawFd - 1);
unsafe {
dbg!(libc::fcntl(fd_limit as RawFd - 1, libc::F_GETFD));
}
let reader = unsafe { OwnedFd::from_raw_fd(great_fd) };
dbg!("hello");
dbg!(&reader);
unsafe {
dbg!(libc::fcntl(fd_limit as RawFd - 2, libc::F_GETFD));
}
let great_fd = unsafe { libc::dup2(writer.as_raw_fd(), fd_limit as RawFd - 2) };
dbg!("hello");
dbg!(great_fd);
dbg!(fd_limit as RawFd - 2);
unsafe {
dbg!(libc::fcntl(fd_limit as RawFd - 2, libc::F_GETFD));
}
let writer = unsafe { OwnedFd::from_raw_fd(great_fd) };
dbg!("hello");
dbg!(&writer);
assert!(false);

let nfds = max(reader.as_raw_fd(), writer.as_raw_fd()) + 1;

Expand Down

0 comments on commit 06bc6e7

Please sign in to comment.