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

Do not compile nofile_limit util functions on Windows #30

Merged
merged 3 commits into from
Jan 22, 2024
Merged
Changes from 1 commit
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
Next Next commit
Do not compile nofile_limit util functions on Windows
icota committed Jan 22, 2024

Verified

This commit was signed with the committer’s verified signature.
icota Igor Cota
commit bc18df47b749e44fdf9b8874ee52ae448b65a9c0
2 changes: 2 additions & 0 deletions rust/src/util.rs
Original file line number Diff line number Diff line change
@@ -4,12 +4,14 @@
use crate::error::update_last_error;

#[no_mangle]
#[cfg(not(target_os = "windows"))]
pub unsafe extern "C" fn tor_get_nofile_limit() -> u64 {
let nofile_limit = unwrap_or_return!(rlimit::getrlimit(rlimit::Resource::NOFILE), 0);
nofile_limit.0
}

#[no_mangle]
#[cfg(not(target_os = "windows"))]
pub unsafe extern "C" fn tor_set_nofile_limit(limit: u64) -> u64 {
unwrap_or_return!(rlimit::increase_nofile_limit(limit), 0)
}