** New Features
+ od --skip-bytes now can use lseek even if the input is not a regular
+ file, greatly improving performance in some cases.
+
stat(1) now uses the statx() system call where available, which can
operate more efficiently by only retrieving requested attributes.
stat(1) also supports a new --cached= option to control cache
if (fstat (fileno (in_stream), &file_stats) == 0)
{
+ bool usable_size = usable_st_size (&file_stats);
+
/* The st_size field is valid for regular files.
If the number of bytes left to skip is larger than
the size of the current file, we can decrement n_skip
when st_size is no greater than the block size, because
some kernels report nonsense small file sizes for
proc-like file systems. */
- if (usable_st_size (&file_stats)
- && ST_BLKSIZE (file_stats) < file_stats.st_size)
+ if (usable_size && ST_BLKSIZE (file_stats) < file_stats.st_size)
{
if ((uintmax_t) file_stats.st_size < n_skip)
n_skip -= file_stats.st_size;
}
}
+ else if (!usable_size && fseeko (in_stream, n_skip, SEEK_CUR) == 0)
+ n_skip = 0;
+
/* If it's not a regular file with nonnegative size,
or if it's so small that it might be in a proc-like file system,
position the file pointer by reading. */