Re: Definition of struct stat st_size for directories

From: raf <freebsd_at_raf.org>
Date: Sun, 13 Feb 2022 22:46:03 UTC
On Sun, Feb 13, 2022 at 05:19:06PM +0100, Christian Weisgerber <naddy@mips.inka.de> wrote:

> raf:
> 
> > The FreeBSD stat(2) manpage only defines st_size for
> > regular files and symlinks. But I've noticed that for
> > directories, it seems to always be the number of
> > entries within the directory (including . and ..). I'm
> > seeing this with 13.0-RELEASE and zfs.
> 
> Here on UFS it's some multiple of 512, e.g.
> 
> $ stat -f '%N %z' / ~
> / 1024
> /home/naddy 3584
> 
> -- 
> Christian "naddy" Weisgerber                          naddy@mips.inka.de

Thanks. That's very helpful to know.

cheers,
raf