statfs(2)

Dan Nelson dnelson at allantgroup.com
Fri Apr 18 16:39:08 UTC 2014


In the last episode (Apr 18), Sergey Matveychuk said:
> Hi.
> 
> Tell me please, why f_bfree is unsigned and f_bavail is signed?
> 
> struct statfs {
>   ...
>   uint64_t f_bfree;             /* free blocks in filesystem */
>   int64_t  f_bavail;            /* free blocks avail to non-superuser */
>   ...

f_bavail may become negative on UFS, due to space reserved to the root user
(minfree in the newfs and tunefs manpages).  When the free space becomes
less than minree, f_bavail isn't clamped at zero, but just goes negative.

-- 
	Dan Nelson
	dnelson at allantgroup.com


More information about the freebsd-hackers mailing list