3 ms·
GNU wc doesn't seem to have that -c fast path. I can tell because files in /proc report 0 for st_size even though they're not empty: $ wc -c /proc/self/cm
by tavianator 6y ago
GNU wc doesn't seem to have that -c fast path. I can tell because files in /proc report 0 for st_size even though they're not empty:
$ wc -c /proc/self/cmdline
25 /proc/self/cmdline
$ stat -c '%s' /proc/self/cmdline
0
- Freaky 6y agoIt certainly has a fast path, it just mixes it up with lseek() for filesystems like /proc: https://github.com/coreutils/coreutils/blob/9de1d153f82243aeaaf19b0e5da2345f9b8652e3/src/wc.c#L262-L294 https://github.com/coreutils/coreutils/blob/9de1d153f82243ae... FreeBSD just uses fstat: https://github.com/freebsd/freebsd-src/blob/e4b8deb222278b2a12c9c67021b406625f5be301/usr.bin/wc/wc.c#L243-L261 https://github.com/freebsd/freebsd-src/blob/e4b8deb222278b2a...