devela::all

Function linux_sys_write

Source
pub unsafe fn linux_sys_write(fd: c_int, buf: *const u8, count: usize) -> isize 
Available on crate features unsafe_syscall and linux only.
Expand description

Performs a write syscall.

Writes count bytes from a buffer buf into a file descriptor fd.

Returns the syscall return value.

§Info

§Example

use devela::{LINUX_FILENO, linux_sys_write};

let buf = "Hello\n".as_bytes();
let bytes_written: isize = unsafe {
    linux_sys_write(LINUX_FILENO::STDOUT, buf.as_ptr(), buf.len())
};
assert![bytes_written > 0];

§Safety

TODO