X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=src%2Fstdio%2F__stdio_write.c;h=d2d89475b0f9429dca8b538b689f97c27bbe5fee;hb=59b64ff686cef2a87e9552658b2c8d2531f87176;hp=cef7bbdc37238cbc8607a0e09e68f1551567d1e5;hpb=3f25354e624361f40011b242c492c2118184cc44;p=musl diff --git a/src/stdio/__stdio_write.c b/src/stdio/__stdio_write.c index cef7bbdc..d2d89475 100644 --- a/src/stdio/__stdio_write.c +++ b/src/stdio/__stdio_write.c @@ -1,11 +1,5 @@ #include "stdio_impl.h" -#include - -static void cleanup(void *p) -{ - FILE *f = p; - if (!f->lockcount) __unlockfile(f); -} +#include size_t __stdio_write(FILE *f, const unsigned char *buf, size_t len) { @@ -18,13 +12,7 @@ size_t __stdio_write(FILE *f, const unsigned char *buf, size_t len) int iovcnt = 2; ssize_t cnt; for (;;) { - if (libc.main_thread) { - pthread_cleanup_push(cleanup, f); - cnt = syscall_cp(SYS_writev, f->fd, iov, iovcnt); - pthread_cleanup_pop(0); - } else { - cnt = syscall(SYS_writev, f->fd, iov, iovcnt); - } + cnt = syscall(SYS_writev, f->fd, iov, iovcnt); if (cnt == rem) { f->wend = f->buf + f->buf_size; f->wpos = f->wbase = f->buf; @@ -37,11 +25,8 @@ size_t __stdio_write(FILE *f, const unsigned char *buf, size_t len) } rem -= cnt; if (cnt > iov[0].iov_len) { - f->wpos = f->wbase = f->buf; cnt -= iov[0].iov_len; iov++; iovcnt--; - } else if (iovcnt == 2) { - f->wbase += cnt; } iov[0].iov_base = (char *)iov[0].iov_base + cnt; iov[0].iov_len -= cnt;