Open System Services System Calls Reference Manual (G06.28+, H06.05+)

spt_writex(2) OSS System Calls Reference Manual
NAME
spt_writex - Writes to a le (thread-aware version)
LIBRARY
G-series native OSS processes: /G/system/sysnn/zsptsrl
H-series OSS processes: /G/system/zdllnnn/zsptdll
SYNOPSIS
[#include <sys/types.h>]
[#include <unistd.h>]
#include <spthread.h>
ssize_t spt_writex (
int ledes,
void *buffer,
size_t nbytes
);
PARAMETERS
filedes Species an open le descriptor obtained from a successful call
to the spt_acceptx(), creat(), dup(), spt_dup2x(),
spt_fcntlx( ), open(), pipe( ), socket(),orsocketpair() function.
buffer Identies the buffer containing the data to be written.
nbytes Species the number of bytes to write.
DESCRIPTION
The spt_writex() function is the thread-aware version of the write() function.
The spt_writex() function attempts to write nbytes of data to the le associated with the ledes
parameter from the buffer pointed to by the buffer parameter.
For all regular and nonregular les, if the value of the nbytes parameter is 0 (zero) and the value
of ledes is a valid le descriptor, the spt_writex() function returns 0 (zero).
The appropriate le time elds are updated unless nbytes is 0 (zero).
With regular les and devices capable of seeking, the actual writing of data proceeds from the
position in the le indicated by the le pointer. If this incremented le pointer is greater than the
length of the le, the length of the le is set to this le offset. Upon return from the spt_writex()
function, the le pointer is incremented by the number of bytes actually written.
With devices incapable of seeking, writing always takes place starting at the current position.
For such devices, the value of the le pointer after a call to the spt_writex() function is always 0
(zero).
Fewer bytes than requested can be written if the device does not have enough space to satisfy the
request. In this case, the number of bytes written is returned. For example, a le has space for 20
bytes more data before reaching a limit. A write request of 512 bytes returns a value of 20. The
limit can be either the end of the physical medium or the value that has been set by the ulimit()
function. The next write of a nonzero number of bytes gives a failure return (except as noted
later).
Upon successful completion, the spt_writex() function returns the number of bytes actually writ-
ten to the le associated with ledes. This number is never greater than the value of nbytes.
If the O_APPEND ag of the le status is set, the le offset is set to the end of the le before
each write operation.
7376 Hewlett-Packard Company 527186-007