Function syscall::call::write

source · []
pub fn write(fd: usize, buf: &[u8]) -> Result<usize>
Expand description

Write a buffer to a file descriptor

The kernel will attempt to write the bytes in buf to the file descriptor fd, returning either an Err, explained below, or Ok(count) where count is the number of bytes which were written.

Errors

  • EAGAIN - the file descriptor was opened with O_NONBLOCK and writing would block
  • EBADF - the file descriptor is not valid or is not open for writing
  • EFAULT - buf does not point to the process’s addressible memory
  • EIO - an I/O error occurred
  • ENOSPC - the device containing the file descriptor has no room for data
  • EPIPE - the file descriptor refers to a pipe or socket whose reading end is closed