4 ms·
It doesn't need to hunt for the directory entry, just needs to call `fstat()` on the stdin file descriptor.
by kam 10y ago
It doesn't need to hunt for the directory entry, just needs to call `fstat()` on the stdin file descriptor.
- angry_octet 10y agoOops you're right, has size in the inode.
- rwmj 10y agoUnless the input file is a device, and then you need to call: ioctl(STDIN_FILENO, BLKGETSIZE64, &size)
- ithkuil 10y agoBut I guess this is orthogonal to where the file descriptor comes from (i.e. stdin or opening a file whose name is passed in the args)
- rwmj 10y agoIt's an orthogonal issue, yes, but calling stat or fstat on any block device whether from stdin or argv will return .st_size == 0, so your progress bar won't display the correct answers (or could display better answers if it used the ioctl).
- deleted 10y ago[deleted]