Subject: stat(2) st_size of directory
To: None <netbsd-help@netbsd.org>
From: Jeremy C. Reed <reed@reedmedia.net>
List: netbsd-help
Date: 10/18/2001 08:42:28
What does stat(2) st_size of directory represent?
i.e.:
$ ./stat_size /home/kian /home/reed
/home/kian 512
/home/reed 6144
$ ls -ld /home/kian /home/reed
drwxr-xr-x 3 kian users 512 Jan 19 2001 /home/kian
drwxr-xr-x 75 reed staff 6144 Oct 18 04:47 /home/reed
How does it figure out the 512 or 6144 (for a directory)?
This is the total number of 1K blocks used by files in the directory:
$ BLOCKSIZE=1024 ls -la /home/kian
total 9
...snip...
$ BLOCKSIZE=1024 ls -la /home/reed
total 128436
...snip...
This is the total for all 1K blocks in the directory (kian has no
sub-directories):
$ BLOCKSIZE=1024 du -s /home/kian
11 /home/kian
$ BLOCKSIZE=1024 du -s /home/reed
868105 /home/reed
What does stat(2)'s st_size of a directory entry represent?
Thanks,
Jeremy C. Reed
http://bsd.reedmedia.net/