Open System Services System Calls Reference Manual (G06.29+, H06.08+, J06.03+)
System Functions (w) writev(2)
• If the O_NONBLOCK flag is clear, the writev() function blocks until the data can be
accepted or an error occurs.
• If the O_NONBLOCK flag is set, the writev( ) function returns the value -1 and errno is
set to [EAGAIN].
When attempting to write to a socket with no space available for data:
• If the O_NONBLOCK flag is not set, the writev( ) function blocks until space becomes
available or an error occurs.
• If the O_NONBLOCK flag is set, the writev( ) function returns the value -1 and sets
errno to [EWOULDBLOCK].
Upon successful completion, the writev() 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 it is interrupted by a signal before it writes any data, the writev() function returns the value -1
with errno set to [EINTR]. If it is interrupted by a signal after it has successfully written some
data, the writev() function 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 writev( )
function to return -1 and set errno to [EGUARDIANLOCKED].
Use From a Threaded Application
The thread-aware writev( ) function behaves exactly the same as spt_writevz() in the Standard
POSIX Threads library. For file descriptors for regular files, if this thread-aware writev( ) func-
tion must wait for an I/O operation to complete on an open file, this function blocks the thread
(instead of the entire process) that called it, while it waits for the I/O operation to complete.
NOTES
To use the writev() functionality in a threaded application that uses the Standard POSIX Threads
library, see spt_writevz(2).
To use this function in a threaded application that uses the POSIX User Thread Model library on
systems running H06.21 or later RVUs or J06.10 or later RVUs, you must perform all of the fol-
lowing tasks to make the function thread-aware in a multi-threaded application:
• Compile the application using the _PUT_MODEL_ feature test macro or equivalent
compiler command option.
• Link the application to the zputdll library (/G/system/zdllnnn/zputdll).
On systems running H06.24 or later H-series RVUs or J06.13 or later J-series RVUs, you can use
this function with 32-bit or 64-bit OSS applications.
To use this function in a 32-bit threaded application on systems running H06.24 or later RVUs or
J06.13 or later RVUs, perform the same tasks (described above) used to make the function
thread-aware in a multi-threaded application on systems running H06.21/J06.10 or later RVUs.
To use this function in a 64-bit threaded application on systems running H06.24 or later RVUs or
J06.13 or later RVUs, you must perform all of the following tasks to make the function thread-
aware in a multi-threaded application:
• Compile the application using the _PUT_MODEL_ feature test macro or equivalent
compiler command option.
527186-023 Hewlett-Packard Company 10−27