20 #ifdef HAVE_SYS_TYPES_H
21 #include <sys/types.h>
51 return (off_t) _lseeki64(fd, 0, SEEK_CUR);
53 return (off_t) lseek(fd, 0, SEEK_CUR);
64 return _lseeki64(fd, 0, SEEK_END) < 0 ? -1 : 0;
66 off_t rc = lseek(fd, 0, SEEK_END) < 0 ? -1 : 0;
70 if (rc < 0 && errno == ESPIPE)
73 return (rc < 0) ? -1 : 0;
83 return _lseeki64(fd, pos, SEEK_SET) < 0 ? -1 : 0;
85 return lseek(fd, pos, SEEK_SET) < 0 ? -1 : 0;
100 return _chsize(fd, 0);
102 return ftruncate(fd, 0);
111 raw_assert(count < SSIZE_MAX);
113 while (written < count) {
114 ssize_t result = write(fd, buf+written, count-written);