mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-06-27 14:58:30 +00:00
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:
parent
a9ea949df8
commit
3e4fd4b0ad
271 changed files with 5706 additions and 1365 deletions
|
@ -45,7 +45,6 @@ static struct StdioFlush g_fflush;
|
|||
*
|
||||
* @param f is the stream handle
|
||||
* @return number of bytes written or -1 on error
|
||||
* @see fwritebuf
|
||||
*/
|
||||
int fflush(FILE *f) {
|
||||
size_t i;
|
||||
|
@ -62,19 +61,14 @@ int fflush(FILE *f) {
|
|||
}
|
||||
}
|
||||
}
|
||||
} else if (f->fd != -1 && (f->iomode & O_WRONLY)) {
|
||||
if (!f->state) {
|
||||
while (f->beg != f->end) {
|
||||
if ((wrote = fwritebuf(f)) != -1) {
|
||||
res += wrote;
|
||||
} else {
|
||||
res = -1;
|
||||
break;
|
||||
}
|
||||
} else if (f->fd != -1) {
|
||||
while (!f->state && f->beg && !f->end) {
|
||||
if ((wrote = __fwritebuf(f)) != -1) {
|
||||
res += wrote;
|
||||
}
|
||||
} else if (f->state != -1) {
|
||||
res = fseterr(f, f->state);
|
||||
}
|
||||
} else if (f->beg && f->beg < f->size) {
|
||||
f->buf[f->beg] = 0;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue