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

change SIOCGIFMTU type to i32 (musl ioctl) #47

Closed
wants to merge 1 commit into from
Closed

change SIOCGIFMTU type to i32 (musl ioctl) #47

wants to merge 1 commit into from

Conversation

thyrc
Copy link

@thyrc thyrc commented Mar 28, 2019

ioctl function signature differs on glibc and musl libc.
extern int ioctl (int __fd, unsigned long int __request, ...) __THROW;
vs.
int ioctl (int, int, ...);

To avoid mismatched types errors on musl I shamelessly copied tun_darwin.rs' definition of SIOCGIFMTU.

@@ -45,6 +45,9 @@ pub struct ifreq {
ifr_ifru: IfrIfru,
}

#[cfg(target_env = "musl")]
const SIOCGIFMTU: int32_t = 0x8921;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the best way to handle it is to cast using 'as _' wherever SIOCGIFMTU is used.

@thyrc
Copy link
Author

thyrc commented Mar 29, 2019

Actually this is something the libc crate should handle, IMHO.

But as soon as I find out how to cast 'as i32' on musl only in an elegant way I will try that, thanks!

@Lekensteyn
Copy link

So indeed musl defines the ioctl parameter as an int, and apparently that is what POSIX specifies according to https://bugs.freedesktop.org/show_bug.cgi?id=85319.

@vkrasnov vkrasnov closed this in #60 Apr 2, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants