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 withO_NONBLOCK
and writing would blockEBADF
- the file descriptor is not valid or is not open for writingEFAULT
-buf
does not point to the process’s addressible memoryEIO
- an I/O error occurredENOSPC
- the device containing the file descriptor has no room for dataEPIPE
- the file descriptor refers to a pipe or socket whose reading end is closed