Saturday, October 11, 2014

Linux write()

Unlike read, write will write out the whole buffer before returning unless it encountered error.  Therefore, there is no need to code a write loop.

EDADF, EFAILT, EINVAL and EIO has meaning similar to read().

EFBIG - the file size limit is exceeded
ENOSPC - the filesystem runs out of space
EPIPE - the reading end of the pipe the fd assicates with has closed.  Normally a SIGPIPE will send to the process attempts to write in such situation.  If the signal is not handled,the process would be terminated.  If the signal is handled, the write() system call will return this errno.

No comments: