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);
int tor_fd_seekend(int fd)
off_t tor_fd_getpos(int fd)
int write_all_to_fd_minimal(int fd, const char *buf, size_t count)
int tor_ftruncate(int fd)
int tor_fd_setpos(int fd, off_t pos)
Integer definitions used throughout Tor.