- struct tm tm;
- time_t t = wim_timestamp_to_unix(timestamp);
- gmtime_r(&t, &tm);
- tstrftime(buf, len, T("%a %b %d %H:%M:%S %Y UTC"), &tm);
+ size_t total_bytes_written = 0;
+ while (iovcnt > 0) {
+ ssize_t bytes_written;
+
+ bytes_written = writev(fd, iov, iovcnt);
+ if (bytes_written < 0) {
+ if (errno == EINTR)
+ continue;
+ break;
+ }
+ total_bytes_written += bytes_written;
+ while (bytes_written) {
+ if (bytes_written >= iov[0].iov_len) {
+ bytes_written -= iov[0].iov_len;
+ iov++;
+ iovcnt--;
+ } else {
+ iov[0].iov_base += bytes_written;
+ iov[0].iov_len -= bytes_written;
+ bytes_written = 0;
+ }
+ }
+ }
+ return total_bytes_written;
+}
+
+off_t
+filedes_offset(int fd)
+{
+ return lseek(fd, 0, SEEK_CUR);