du(1) that comes with FreeBSD does not understand the -b argument, and these is no way to achieve such functionality using the BLOCKSIZE environment variable. As far as I know, this option is not required by POSIX, but it's trivially implemented using a different member of the stat(2) structure and an if to separate block counts from byte counts. The only issue that I can see is for filesystems containing files that sum up to more than 8 exabytes in size -- in this case, the 64-bit integer used to store the byte count will overflow. Multiply this by 512 for the maximum size for block-based counting. If it becomes an issue, a check can be put in to compare the addition and, if the result is less than the additive value, throw an error. Fix: Patch attached with submission follows:
For bugs matching the following criteria: Status: In Progress Changed: (is less than) 2014-06-01 Reset to default assignee and clear in-progress tags. Mail being skipped
Keyword: patch or patch-ready – in lieu of summary line prefix: [patch] * bulk change for the keyword * summary lines may be edited manually (not in bulk). Keyword descriptions and search interface: <https://bugs.freebsd.org/bugzilla/describekeywords.cgi>