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

spt_writevz(2) OSS System Calls Reference Manual
When attempting to write to a socket with no space available for data:
If the O_NONBLOCK flag is not set, the spt_writevz() function blocks until space
becomes available or an error occurs.
If the O_NONBLOCK flag is set, the spt_writevz() function returns the value -1 and
sets errno to [EWOULDBLOCK].
Upon successful completion, the spt_writevz() 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 spt_writevz() 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 spt_writevz() 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
spt_writevz() function to return -1 and set errno to [EGUARDIANLOCKED].
NOTES
For file descriptors for non-regular files, the spt_writevz() function behaves exactly the same as
spt_writevx(). For file descriptors for regular files, this is a thread-aware function: if this func-
tion must wait for an I/O operation to complete on an open file, this function blocks the thread
that called it (instead of the entire process), while it waits for the I/O operation to complete.
This function serializes file operations on an open file. If a thread calls spt_writevz() to access a
file that already has a file operation in progress by a different thread, this thread is blocked until
the prior file operation is complete.
For C applications, a macro to map writev() to spt_writevz() is available when you use the
#define SPT_THREAD_AWARE_XNONBLOCK preprocessor directive before including
spthread.h or when you use an equivalent compiler command option to compile the application.
For C++ applications, an alias to map writev( ) to spt_writevz() is available when you use the
#define SPT_THREAD_AWARE_PRAGMA_XNONBLOCK preprocessor directive before
including spthread.h or when you use an equivalent compiler command option to compile the
application.
To use this function in a threaded application that uses the Standard POSIX Threads library on
systems running J06.10 or later RVUs or H06.21 or later RVUs, you must perform all of the fol-
lowing tasks:
Include the spthread.h header file in the application.
Compile the application using the _SPT_MODEL_ feature test macro or equivalent
compiler command option in addition to any other feature test macros in use.
Link the application to the zsptdll library (/G/system/zdllnnn/zsptdll).
RETURN VALUES
Upon successful completion, the spt_writevz() function returns the number of bytes that were
actually written. Otherwise, the value -1 is returned, and errno is set to indicate the error.
7474 Hewlett-Packard Company 527186-023