__FPENDING(3)

NAME
__fpending, __freadahead, __freading, __freadptr, __freadptrinc, __fseterr, __fwriting - stream extension functions

SYNOPSIS
#include <stdio_ext.h>
size_t
__fpending(FILE *stream);
size_t
__freadahead(FILE *stream);
int
__freading(FILE *stream);
const char *
__freadptr(FILE *stream, size_t *sizep);
void
__freadptrinc(FILE *stream, size_t increment);
void
__fseterr(FILE *stream);
int
__fwriting(FILE *stream);

DESCRIPTION
The __fpending() function returns the number of bytes of output data currently buffered on stream.

The __freadahead() function returns the number of bytes of input data currently buffered on stream.

The __freading() function returns non-zero if stream either was opened read-only or if the last operation on the stream was a read or push-back operation.

The __freadptr() function returns either a pointer to the next byte of buffered input data on stream and stores the number of consecutive bytes of buffered data available to the location pointed to by sizep, or return NULL if there's no buffered input data. The value returned via sizep may differ from the value that would be returned by __freadahead().

The __freadptrinc() function consumes increment bytes of buffered input data on stream. This is only valid immediately after a non-NULL return from __freadptr() and increment must not be greater than the size value from that call.

The __fseterr() function sets the error indicator for stream.

The __fwriting() function returns non-zero if stream either was opened write-only or append-only or if the last operation on the stream was a write operation.

ERRORS
These functions should not fail and do not set the external variable errno.

SEE ALSO
fflush(3)

HISTORY
The __fpending(), __freadahead(), __freading(), __freadptr(), __freadptrinc(), __fseterr(), and __fwriting() functions appeared in OpenBSD 7.6.

BUGS
These functions are under-specified and non-portable. They exist to permit a particular “portability” library to function without direct manipulation of stdio structures; everyone else should either implement their own stdio layer, do the work of defining and standardizing the required functionality, or reconsider their life decisions.