codyps / ioctl

Helpers for binding ioctls in Rust
https://docs.rs/ioctl-sys
Apache License 2.0
4 stars 14 forks source link

Add MacOS support #3

Closed faern closed 7 years ago

faern commented 7 years ago

As discussed on IRC, it would be nice to support ioctl calls on MacOS. I have successfully enabled/disabled the PF firewall and queried it for status using this change.

I have not tested it very extensively at all beyond what I just wrote. Maybe you could test that I didn't break it on Linux if you suspect that (I have verified that it builds at least.)

The cfg addition to pub use platform::*; was needed in order for the error message to actually contain this_platform_not_supported. Otherwise it just printed:

7 | pub use platform::*;
  |         ^^^^^^^^^^^^ Maybe a missing `extern crate platform;`?
codyps commented 7 years ago

This worked for me in some basic smoke testing of io-block (I really need to get some basic automated tests together). Thanks for the PR.