Open System Services System Calls Reference Manual (G06.29+, H06.08+, J06.03+)
System Functions (w) write(2)
RETURN VALUES
Upon successful completion, the write() function returns the number of bytes that were actually
written. Otherwise, the value -1 is returned, and errno is set to indicate the error.
ERRORS
If any of these conditions occurs, the write( ) function sets errno to the corresponding value:
[EAGAIN] One of these conditions exists:
• An attempt was made to write to a file descriptor that cannot accept data,
and the O_NONBLOCK flag is set.
• A write to a pipe (FIFO file) of PIPE_BUF bytes or less is requested,
O_NONBLOCK is set, and fewer than nbytes of free space are avail-
able.
• The O_NONBLOCK flag is set on this file, and the process would be
delayed in the write operation.
[EALREADY] Operation already in progress. An I/O operation started by a thread-aware func-
tion is in progress on a regular file and a function that is process-blocking for
regular files attempts to begin an I/O operation on the same open file.
If the write() function is thread-aware, the [EALREADY] value is not returned.
[EBADF] The filedes parameter does not specify a valid file descriptor open for writing.
[ECONNRESET]
One of these conditions occurred:
• The transport-provider process for this socket is no longer available.
• The TCP/IP subsystem for this socket is no longer available.
• The connection was forcibly closed by the peer socket.
The file descriptor specified by the filedes parameter can only be closed.
[EFAULT] The buffer parameter points to a location outside of the allocated address space
of the process.
[EFBIG] The application is attempting to write at or beyond the file offset maximum esta-
blished when the file was opened.
[EGUARDIANLOCKED]
A write() operation was attempted to a file in the Guardian file system (that is, a
file in /G) that is locked.
[EINTR] A write() operation was interrupted by a signal before any data was written.
[EINVAL] One of these conditions occurred:
• The file position pointer associated with the file specified by the filedes
parameter was negative.
• The value of the nbytes parameter is greater than SSIZE_MAX.
527186-023 Hewlett-Packard Company 10−17