Add epoll and do more release readiness changes

This change also pays off some of the remaining technical debt with
stdio, file descriptors, and memory managemnt polyfills.
This commit is contained in:
Justine Tunney 2020-11-28 12:01:51 -08:00
parent a9ea949df8
commit 3e4fd4b0ad
271 changed files with 5706 additions and 1365 deletions

View file

@ -24,7 +24,8 @@ int vsprintf(char *, const char *, va_list)
paramsnonnull((2)) nothrow nocallback frownedupon(vsnprintf);
int sscanf(const char *, const char *, ...) scanfesque(2);
int vsscanf(const char *, const char *, va_list);
int vcscanf(int callback(void *), void *, const char *, va_list);
int vcscanf(int (*)(void *), int (*)(int, void *), void *, const char *,
va_list);
char *strerror(int) returnsnonnull nothrow nocallback;
int strerror_r(int, char *, size_t) nothrow nocallback;
int palandprintf(void *, void *, const char *, va_list) hidden;

View file

@ -44,7 +44,8 @@
* @param va points to the variadic argument state
* @see libc/fmt/pflink.h (dynamic memory is not a requirement)
*/
int vcscanf(int callback(void *), void *arg, const char *fmt, va_list va) {
int vcscanf(int callback(void *), int unget(int, void *), void *arg,
const char *fmt, va_list va) {
struct FreeMe {
struct FreeMe *next;
void *ptr;
@ -56,13 +57,18 @@ int vcscanf(int callback(void *), void *arg, const char *fmt, va_list va) {
while (c != -1) {
switch (p[i++]) {
case '\0':
return items;
if (c != -1 && unget) {
unget(c, arg);
}
goto Done;
case ' ':
case '\t':
case '\n':
case '\r':
case '\v':
while (isspace(c)) c = callback(arg);
while (isspace(c)) {
c = callback(arg);
}
break;
case '%': {
uintmax_t number;

View file

@ -47,5 +47,5 @@ static int vsscanfcb(void *arg) {
*/
int(vsscanf)(const char *str, const char *fmt, va_list va) {
struct StringScannerState state = {(const unsigned char *)str, 0};
return vcscanf(vsscanfcb, &state, fmt, va);
return vcscanf(vsscanfcb, NULL, &state, fmt, va);
}