Open System Services System Calls Reference Manual (G06.29+, H06.08+, J06.03+)
write64_(2) OSS System Calls Reference Manual
When attempting to write to a socket and with no space available for data:
• If the O_NONBLOCK flag is not set, the write64_() function blocks until space
becomes available or an error occurs.
• If the O_NONBLOCK flag is set, the write64_() function returns the value -1 and sets
errno to [EWOULDBLOCK].
Upon successful completion, the write64_() function marks the st_ctime and st_mtime fields of
the file for update and clears the set-user-ID and set-group-ID attributes if the file is a regular file.
The fcntl() function provides more information about record locks.
If the write64_() function is interrupted by a signal before it writes any data, it returns the value
-1 with errno set to [EINTR]. If the write64_() function is interrupted by a signal after it has
successfully written some data, it returns the number of bytes that it has written.
Use on Guardian Objects
Attempting to write to a Guardian file (that is, a file in /G) that is locked causes the write64_()
function to return -1 and set errno to [EGUARDIANLOCKED].
NOTES
For detailed information about writing multi-threaded and 64-bit applications for the Open Sys-
tem Services environment, see the Open System Services Programmer’s Guide.
RETURN VALUES
Upon successful completion, the write64_() function returns the number of bytes that were actu-
ally written. Otherwise, the value -1 is returned, and errno is set to indicate the error.
ERRORS
If any of these conditions occurs, the write64_() 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 (such as spt_writez())is in progress on a regular file and a function that is
process-blocking for regular files (such as read(), spt_read(),orspt_readx())
attempts to begin an I/O operation on the same open file.
[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.
10−22 Hewlett-Packard Company 527186-023