-
Notifications
You must be signed in to change notification settings - Fork 675
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of #478 - conradev:sys-control, r=fiveop
Add support for system control sockets for XNU I added support for macOS and iOS system sockets, which can be used to control the kernel as described [here](https://developer.apple.com/library/content/documentation/Darwin/Conceptual/NKEConceptual/control/control.html). To do this, I had to add in support for `ioctl` on those platforms, so I added in `ioctl` support for all BSD-based platforms. The API seems to be the same between [xnu](https://opensource.apple.com/source/xnu/xnu-3248.60.10/bsd/sys/ioccom.h.auto.html), [FreeBSD](https://github.com/freebsd/freebsd/blob/master/sys/sys/ioccom.h), [NetBSD](https://ftp.netbsd.org/pub/NetBSD/NetBSD-current/src/sys/sys/ioccom.h), [OpenBSD](http://cvsweb.openbsd.org/cgi-bin/cvsweb/src/sys/sys/ioccom.h?rev=1.5&content-type=text/x-cvsweb-markup) and [Dragonfly BSD](http://gitweb.dragonflybsd.org/dragonfly.git/blob/HEAD:/sys/sys/ioccom.h). I added a test that runs on macOS and iOS for the functionality. Let me know if I need to make any changes!
- Loading branch information
Showing
16 changed files
with
387 additions
and
160 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
mod consts { | ||
pub const VOID: u32 = 0x20000000; | ||
pub const OUT: u32 = 0x40000000; | ||
pub const IN: u32 = 0x80000000; | ||
pub const INOUT: u32 = (IN|OUT); | ||
pub const IOCPARM_MASK: u32 = 0x1fff; | ||
} | ||
|
||
pub use self::consts::*; | ||
|
||
#[macro_export] | ||
macro_rules! ioc { | ||
($inout:expr, $group:expr, $num:expr, $len:expr) => ( | ||
$inout | (($len as u32 & $crate::sys::ioctl::IOCPARM_MASK) << 16) | (($group as u32) << 8) | ($num as u32) | ||
) | ||
} | ||
|
||
#[macro_export] | ||
macro_rules! io { | ||
($g:expr, $n:expr) => (ioc!($crate::sys::ioctl::VOID, $g, $n, 0)) | ||
} | ||
|
||
#[macro_export] | ||
macro_rules! ior { | ||
($g:expr, $n:expr, $len:expr) => (ioc!($crate::sys::ioctl::OUT, $g, $n, $len)) | ||
} | ||
|
||
#[macro_export] | ||
macro_rules! iow { | ||
($g:expr, $n:expr, $len:expr) => (ioc!($crate::sys::ioctl::IN, $g, $n, $len)) | ||
} | ||
|
||
#[macro_export] | ||
macro_rules! iorw { | ||
($g:expr, $n:expr, $len:expr) => (ioc!($crate::sys::ioctl::INOUT, $g, $n, $len)) | ||
} |
Empty file.
Empty file.
Empty file.
Oops, something went wrong.