#include <sys/uio.h>
#include <wordexp.h>
#include <sys/timerfd.h>
+#include <sys/stat.h>
#include <glib.h>
uint16_t mtu[2];
char *filename;
int fd;
+ struct stat stat;
struct io *io;
uint32_t seq;
struct io *timer_io;
for (i = 0; i < num; i++, transport->seq++) {
ssize_t ret;
int secs = 0, nsecs = 0;
+ off_t offset;
ret = read(fd, buf, transport->mtu[1]);
if (ret <= 0) {
elapsed_time(!transport->seq, &secs, &nsecs);
- bt_shell_echo("[seq %d %d.%03ds] send: %zd bytes ",
+ if (!transport->seq && fstat(fd, &transport->stat) < 0) {
+ bt_shell_printf("fstat failed: %s (%d)",
+ strerror(errno), errno);
+ free(buf);
+ return -errno;
+ }
+
+ offset = lseek(fd, 0, SEEK_CUR);
+
+ bt_shell_echo("[seq %d %d.%03ds] send: %lld/%lld bytes",
transport->seq, secs,
(nsecs + 500000) / 1000000,
- ret);
+ offset, transport->stat.st_size);
}
free(buf);