[][src]Macro sunrise_libuser::capabilities

macro_rules! capabilities {
    ($ident:ident = Capabilities {
        $($item:tt : [$($itemval:expr),* $(,)*]),* $(,)*
    }) => { ... };
    (@handle_item $ident:ident, curcount=$count:expr, svcs=[], rawcaps=[$($rawcaps:expr),*],
      svcs: [$($svcs:expr),*], $($next:tt : [$($nextval:expr),*],)*) => { ... };
    (@handle_item $ident:ident, curcount=$count:expr, svcs=[$($svcs:expr),*], rawcaps=[],
      raw_caps: [$($raw_caps:expr),*], $($next:tt : [$($nextval:expr),*],)*) => { ... };
    (@handle_item $ident:ident, curcount=$count:expr, svcs=[$($svcs:expr),*], rawcaps=[$($raw_caps:expr),*],) => { ... };
    (@generate_svc $kac_svcs:ident, [$($svc:expr),*]) => { ... };
    (@count_elems) => { ... };
    (@count_elems $val:expr, $($vals:expr,)*) => { ... };
}

Define the capabilities array in the .kernel_caps section. Has the following syntax:

extern crate sunrise_libuser;
use sunrise_libuser::{syscalls, caps, capabilities};
capabilities!(CAPABILITIES = Capabilities {
    svcs: [
        // Array of syscall numbers.
        syscalls::nr::SetHeapSize,
        syscalls::nr::ExitProcess,
    ],
    raw_caps: [
         // Array of raw kernel capabilities.
         caps::ioport(0x60), caps::irq_pair(1, 0x3FF)
    ]
});

The order of the capabilities member is not important, and trailing comas are allowed.