Guardian Native C Library Calls Reference Manual (G06.29+, H06.08+, J06.03+)
Guardian Native C Library Calls (g - i) getchar_unlocked(3)
NAME
getchar_unlocked - Gets a character from the standard input stream but does not lock the stream
LIBRARY
H-series and J-series native Guardian processes: $SYSTEM.ZDLLnnn.ZCRTLDLL
32-bit H-series and J-series OSS processes: /G/system/zdllnnn/zcrtldll
64-bit H-series and J-series OSS processes: /G/system/zdllnnn/ycrtldll
SYNOPSIS
#include <stdio.h>
int getchar_unlocked(void);
PARAMETERS
None.
DESCRIPTION
The getchar_unlocked( ) function returns the next character (byte) from the standard input
stream and moves the file pointer, if defined, ahead one character (byte). The
getchar_unlocked( ) function is functionally equivalent to the getchar( ) function except that it
does not perform any internal locking of the stream.
The getchar_unlocked( ) function should only be used by multi-threaded applications that have
already used the flockfile( ) flockfile() or ftrylockfile() function to acquire a mutual exclusion
lock for the stream.
NOTES
The getchar_unlocked( ) function might be a macro (depending on the compile-time definitions
used in the source). Consequently, you cannot use this interface where a function is necessary;
for example, a subroutine pointer cannot point to it.
When a function is necessary, use the fgetc() function instead.
RETURN VALUES
If successful, the getchar_unlocked() function and macro returns the next character (byte) in the
standard input stream. If the stream is at end-of-file, the end-of-file indicator for the stream is set
and the integer constant EOF is returned. If this function or macro fails or a read error occurs, the
error indicator for the stream is set, the integer constant EOF is returned, and errno is set to indi-
cate the error.
ERRORS
If any of the following conditions occur, the getchar_unlocked() function sets errno to the
corresponding value:
[EAGAIN] The O_NONBLOCK flag is set for the underlying input stream and the process
would be delayed by the read operation.
[EBADF] The file descriptor underlying the input stream is not a valid file descriptor or is
not open for reading.
[EINTR] The read operation was interrupted by a signal which was caught and no data
was transferred.
[EIO] The call is attempting to read from the process’s controlling terminal and either
the process is ignoring or blocking the SIGTTIN signal or the process group is
orphaned.
527192-018 Hewlett-Packard Company 3−15