Open System Services System Calls Reference Manual (G06.29+, H06.08+, J06.03+)

System Functions (w) write64_(2)
Upon successful completion, the write64_() function returns the number of bytes actually writ-
ten to the file associated with filedes. This number is never greater than the value of nbytes.
If the O_APPEND flag of the file status is set, the file offset is set to the end of the file prior to
each write.
Write requests to a pipe or a FIFO file are handled the same as writes to a regular le with these
exceptions:
No file offset is associated with a pipe; therfore, each write64_( ) request appends to the
end of the pipe.
If the size of the write64_() request is less than or equal to the value of the PIPE_BUF
system variable, the write64_() function is guaranteed to be atomic. The data is not
interleaved with data from other processes doing writes on the same pipe.
If the size of the write64_() request is greater than the value of the PIPE_BUF system
variable, the file system attempts to resize the pipe buffer from 2 * PIPE_BUF to 65,536
bytes. If the resizing is successful, the file system performs atomic writes of up to 32,768
bytes and can transfer up to 52 kilobytes of data from the pipe buffer on subsequent
read(), read64_(),orreadv() calls by the client.
If the file system cannot resize the buffer, it continues to use the existing buffer. A
second attempt at resizing occurs after approximately a minute elapses.
Writes of greater than PIPE_BUF bytes can have data interleaved, on arbitrary boun-
daries, with writes by other processes, whether or not the O_NONBLOCK flag is set.
If the O_NONBLOCK flag is not set, a write64_( ) request to a full pipe causes the pro-
cess to block until enough space becomes available to handle the entire request.
If the O_NONBLOCK flag is set, write64_( ) requests are handled differently in these
ways:
The write64_() function does block the process.
write64_() requests for PIPE_BUF or fewer bytes either succeed completely
and return the value of the nbytes parameter, or return the value -1 and set errno
to [EAGAIN].
—Awrite64_() request for greater than PIPE_BUF bytes either transfers what it
can and returns the number of bytes written, or transfers no data and returns the
value -1 with errno set to [EAGAIN]. Also, if a request is greater than
PIPE_BUF bytes and all data previously written to the pipe has been read,
write64_() transfers at least PIPE_BUF bytes.
When attempting to write to a file descriptor for a special character device (a terminal) that can-
not accept data immediately:
If the O_NONBLOCK flag is clear, the write64_() function blocks until the data can be
accepted or an error occurs.
If
the O_NONBLOCK flag is set, the write64_() function returns the value -1 and
errno is set to [EAGAIN].
527186-023 Hewlett-Packard Company 1021