Subject: Re: stat(1)
To: None <current-users@netbsd.org>
From: Geoff Adams <gadams@avernus.com>
List: current-users
Date: 12/28/2001 14:58:24
On Friday, December 28, 2001, at 01:06 PM, Geoff Adams wrote:
> On Friday, December 28, 2001, at 10:03 AM, Martin Weber wrote:
>
>> b) wth is st_gen about ? I think I only see files with st_gen of
>> 0 ... ?
>
> I believe this is the inode generation number. If yours are all zero,
> then that just indicates that you haven't run fsirand(8):
Actually, I think I need to take that back.
After reading the tech-security message that mouss referred to, I
decided to have a look at the NetBSD vn_stat() function in
src/sys/kern/vfs_vnops.c. It appears that we *always* return zero for
the st_gen field, not just in the case of non-superuser calls, as the
advisory included in the tech-security message suggests be done. Here
are the last few lines of vn_stat():
sb->st_blksize = va.va_blocksize;
sb->st_flags = va.va_flags;
sb->st_gen = 0;
sb->st_blocks = va.va_bytes / S_BLKSIZE;
return (0);
}
(This has been the case since version 1.22 of that file, committed in
March of 1997 -- a couple weeks after that mail message.)
So, I submit that in any stat(1) that various people have mentioned
writing, there is no use in printing out the st_gen field at all, at
least on NetBSD. It'll always be returned as zero by stat(2). (This
makes one wonder why it's in struct stat. Compatibility, I presume.)
- Geoff