Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

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


It certainly has a fast path, it just mixes it up with lseek() for filesystems like /proc: https://github.com/coreutils/coreutils/blob/9de1d153f82243ae...

FreeBSD just uses fstat: https://github.com/freebsd/freebsd-src/blob/e4b8deb222278b2a...




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: