nc 0.9.8

Access system calls directly
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
/// Get name and information about current kernel.
///
/// # Examples
///
/// ```
/// let mut buf = nc::utsname_t::default();
/// let ret = unsafe { nc::uname(&mut buf) };
/// assert!(ret.is_ok());
/// assert!(!buf.sysname.is_empty());
/// assert!(!buf.machine.is_empty());
/// ```
pub unsafe fn uname(buf: &mut utsname_t) -> Result<(), Errno> {
    let buf_ptr = core::ptr::from_mut(buf) as usize;
    unsafe { syscall1(SYS_UNAME, buf_ptr).map(drop) }
}