Skip to content

<newlib_compat.h>

POSIX declarations this newlib build leaves out.

Force-included into every tier-2 (newlib) translation unit; see -include in scripts/Makefile.user. The definitions live in lib/posix/stubs.c.

#include <newlib_compat.h>

Functions

getline

ssize_t getline(char **lineptr, size_t *n, FILE *stream);

POSIX getline(); newlib implements it as __getline() but never declares it.

Parameter Direction Description
lineptr inout Buffer, grown with realloc() as needed; *lineptr may be NULL.
n inout Size of *lineptr.
stream in Stream to read.

Returns: Characters read, including the newline, or -1 at end of file or on error.

lstat

int lstat(const char *path, struct stat *buf);

POSIX lstat(); this build makes it an alias of stat().

Parameter Direction Description
path in Path.
buf out Result.

Returns: 0, or -1 with errno set.