20#ifndef ZEPHYR_INCLUDE_POSIX_POSIX_STDIO_H_
21#define ZEPHYR_INCLUDE_POSIX_POSIX_STDIO_H_
23#if defined(_POSIX_C_SOURCE) || defined(__DOXYGEN__)
30#include <zephyr/toolchain.h>
60#if (_XOPEN_SOURCE >= 500) || defined(_POSIX_C_SOURCE) || defined(__DOXYGEN__)
67#define P_tmpdir "/tmp"
75#if !defined(STREAM_MAX) && defined(FOPEN_MAX)
76#define STREAM_MAX FOPEN_MAX
86#if (_XOPEN_SOURCE >= 500) || (_POSIX_C_SOURCE >= 200112L) || defined(__DOXYGEN__)
97#if (_POSIX_C_SOURCE >= 200809L) || (_XOPEN_SOURCE >= 700) || defined(__DOXYGEN__)
107int dprintf(
int fildes,
const char *ZRESTRICT format, ...);
112#if (_XOPEN_SOURCE >= 500) || (_POSIX_C_SOURCE >= 200112L) || defined(__DOXYGEN__)
140#if (_POSIX_C_SOURCE >= 200809L) || (_XOPEN_SOURCE >= 700) || defined(__DOXYGEN__)
150#if (_POSIX_C_SOURCE >= 200809L) || (_XOPEN_SOURCE >= 700) || defined(__DOXYGEN__)
160FILE *
fmemopen(
void *ZRESTRICT buf,
size_t size,
const char *ZRESTRICT mode);
172#if (_XOPEN_SOURCE >= 500) || (_POSIX_C_SOURCE >= 200112L) || defined(__DOXYGEN__)
182int fseeko(FILE *stream, off_t offset,
int whence);
188#if (_XOPEN_SOURCE >= 500) || (_POSIX_C_SOURCE >= 200112L) || defined(__DOXYGEN__)
199#if (_POSIX_C_SOURCE >= 200809L) || (_XOPEN_SOURCE >= 700) || defined(__DOXYGEN__)
222#if (_POSIX_C_SOURCE >= 200809L) || (_XOPEN_SOURCE >= 700) || defined(__DOXYGEN__)
241#if (_POSIX_C_SOURCE >= 200809L) || (_XOPEN_SOURCE >= 700) || defined(__DOXYGEN__)
253ssize_t
getdelim(
char **ZRESTRICT lineptr,
size_t *ZRESTRICT n,
int delimiter,
254 FILE *ZRESTRICT stream);
266ssize_t
getline(
char **ZRESTRICT lineptr,
size_t *ZRESTRICT n, FILE *ZRESTRICT stream);
271#if (_POSIX_C_SOURCE >= 200809L) || (_XOPEN_SOURCE >= 700) || defined(__DOXYGEN__)
283#if (_XOPEN_SOURCE >= 500) || (_POSIX_C_SOURCE >= 200112L) || defined(__DOXYGEN__)
296#if (_XOPEN_SOURCE >= 500) || (_POSIX_C_SOURCE >= 200112L) || defined(__DOXYGEN__)
305FILE *
popen(
const char *command,
const char *type);
312#if (_POSIX_C_SOURCE >= 200809L) || (_XOPEN_SOURCE >= 700) || defined(__DOXYGEN__)
337#if (_POSIX_C_SOURCE >= 200809L) || (_XOPEN_SOURCE >= 700) || defined(__DOXYGEN__)
348int renameat(
int olddirfd,
const char *oldpath,
int newdirfd,
const char *newpath);
359#if (_XOPEN_SOURCE >= 500) || defined(_POSIX_C_SOURCE) || defined(__DOXYGEN__)
368char *
tempnam(
const char *dir,
const char *pfx);
375#if (_POSIX_C_SOURCE >= 200809L) || (_XOPEN_SOURCE >= 700) || defined(__DOXYGEN__)
385int vdprintf(
int fildes,
const char *ZRESTRICT format, va_list ap);
ssize_t getline(char **ZRESTRICT lineptr, size_t *ZRESTRICT n, FILE *ZRESTRICT stream)
Read a line from a stream.
int vdprintf(int fildes, const char *ZRESTRICT format, va_list ap)
Print formatted output to a file descriptor.
FILE * fmemopen(void *ZRESTRICT buf, size_t size, const char *ZRESTRICT mode)
Open a memory-backed stream.
FILE * open_memstream(char **bufp, size_t *sizep)
Open a dynamic memory output stream.
ssize_t getdelim(char **ZRESTRICT lineptr, size_t *ZRESTRICT n, int delimiter, FILE *ZRESTRICT stream)
Read a delimited record from a stream.
int dprintf(int fildes, const char *ZRESTRICT format,...)
Print formatted output to a file descriptor.
int fileno(FILE *stream)
Return the file descriptor associated with a stream.
FILE * fdopen(int fd, const char *mode)
Associate a stream with an open file descriptor.
int renameat(int olddirfd, const char *oldpath, int newdirfd, const char *newpath)
Rename a file relative to directory file descriptors.
off_t ftello(FILE *stream)
Obtain the current file offset of a stream.
int fseeko(FILE *stream, off_t offset, int whence)
Reposition a stream to a new offset.
int putchar_unlocked(int c)
Write a byte to stdout without acquiring the stream lock.
int getc_unlocked(FILE *stream)
Read a byte from a stream without acquiring the stream lock.
int putc_unlocked(int c, FILE *stream)
Write a byte to a stream without acquiring the stream lock.
int ftrylockfile(FILE *file)
Try to acquire a stdio stream lock without blocking.
void funlockfile(FILE *file)
Release a stdio stream lock.
void flockfile(FILE *file)
Acquire a stdio stream lock.
int getchar_unlocked(void)
Read a byte from stdin without acquiring the stream lock.
char * tempnam(const char *dir, const char *pfx)
Generate a pathname for a temporary file (obsolescent).
FILE * popen(const char *command, const char *type)
Create a pipe to a process.
char * ctermid(char *s)
Maximum number of streams that one process can have open at one time.
int pclose(FILE *stream)
Close a pipe stream.
POSIX fundamental types (<sys/types.h>)