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

libc::sysctl is missing #1248

Open
al8n opened this issue Jan 1, 2025 · 2 comments
Open

libc::sysctl is missing #1248

al8n opened this issue Jan 1, 2025 · 2 comments
Labels
enhancement New feature or request

Comments

@al8n
Copy link
Contributor

al8n commented Jan 1, 2025

Hi, sysctl is missing. I am using this function to get the MTU of the interface. May I ask to add this function?

@sunfishcode
Copy link
Member

Are you using Linux? If so, the sysctl function is deprecated, and the Linux maintainers suggest you use the /proc/sys interface instead.

@al8n
Copy link
Contributor Author

al8n commented Jan 2, 2025

Are you using Linux? If so, the sysctl function is deprecated, and the Linux maintainers suggest you use the /proc/sys interface instead.

I am using MacOS, and I need something like

    let mut mib = [CTL_NET, AF_ROUTE, 0, AF_UNSPEC, NET_RT_IFLIST, idx as i32];

    let mut len: size_t = 0;
    if rustix::sysctl(mib.as_mut_ptr(), 6, null_mut(), &mut len, null_mut(), 0) < 0 {
      return Err(io::Error::last_os_error());
    }

@sunfishcode sunfishcode added the enhancement New feature or request label Jan 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants