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

spt_freadx(2) OSS System Calls Reference Manual
NAME
spt_freadx - Reads input from a stream (thread-aware version)
LIBRARY
G-series native OSS processes: /G/system/sysnn/zsptsrl
H-series OSS processes: /G/system/zdllnnn/zsptdll
SYNOPSIS
[#include <stdio.h>]
#include <spthread.h>
size_t spt_freadx (
void pointer,
size_t size,
size_t num_items,
FILE stream
);
PARAMETERS
pointer Points to an array.
size Specifies the size of the variable type of the array pointed to by the pointer
parameter.
num_items Specifies the number of items of data.
stream Specifies the input output stream.
DESCRIPTION
The spt_freadx() function is the thread-aware version of the fread() function.
The spt_freadx() function copies num_items of data of length size from the input stream into an
array beginning at the location pointed to by the pointer parameter.
The spt_freadx() function stops copying bytes if an end-of-file or error condition is encountered
while reading from the input specified by the stream parameter, or when the number of data items
specified by the num_items parameter have been copied. It leaves the file pointer of the stream
parameter, if defined, pointing to the byte following the last byte read, if there is one. The
fspt_readx() function does not change the contents of the stream parameter.
NOTES
The macro to map fread() to spt_freadx( ) is available in C applications when
SPT_THREAD_AWARE_NONBLOCK has been defined in the following manner before
including spthread.h:
#define SPT_THREAD_AWARE_NONBLOCK
The alias to link fread() to spt_freadx( ) is available in C++ applications when
SPT_THREAD_AWARE_PRAGMA_NONBLOCK has been defined in the following manner
before including spthread.h:
#define SPT_THREAD_AWARE_PRAGMA_NONBLOCK
RETURN VALUES
Upon successful completion, the spt_freadx( ) function returns the number of items actually
transferred. If the num_items parameter is negative or 0 (zero), no characters are transferred, and
a value of 0 (zero) is returned. If a read error occurs, the error indicator for the stream is set, and
errno is set to indicate the error.
If the file descriptor underlying stream becomes invalid (is closed by another thread), EOF is
returned with an errno value of [EBADF]. If a signal is received via the pthread_kill() function
7224 Hewlett-Packard Company 527186-023