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

spt_fgets(2) OSS System Calls Reference Manual
NAME
spt_fgets - Initiates thread-aware fgets( ) function
LIBRARY
G-series native OSS processes: /G/system/sysnn/zsptsrl
H-series OSS processes: /G/system/zdllnnn/zsptdll
SYNOPSIS
#include <spthread.h>
char *spt_fgets(
char *string,
int n,
FILE *stream);
PARAMETERS
See the fgets(3) reference page either online or in the Guardian C Native Library Calls Refer-
ence Manual.
DESCRIPTION
This is a thread-aware version of the fgets() function. The file descriptor underlying the stream
must be nonblocking for this function to be thread aware.
The following macro maps spt_fgets() to fgets( ) and has been defined in spthread.h:
#define fgets(string, n, stream) spt_fgets(string, n, stream)
This macro is available only when SPT_THREAD_AWARE has been defined before including
spthread.h, as follows:
#define SPT_THREAD_AWARE
RETURN VALUES
See the fgets(3) reference page. The following also applies:
Value errno is never set to [EAGAIN] or [EWOULDBLOCK].
If the file descriptor underlying stream becomes invalid (is closed by another thread),
NULL is returned with an errno of [EBADF].
If a signal is received via pthread_kill(2) and is not blocked, ignored, or handled, NULL
is returned with an errno of [EINTR].
STANDARDS CONFORMANCE
This function is an extension to the XPG4 Version 2 specification. Interfaces documented on this
reference page conform to the following industry standards:
IEEE Std 1003.1c-1995, POSIX System Application Program Interface
The use of the header file spthread.h is an HP exception to the POSIX standard.
7182 Hewlett-Packard Company 527186-023