The history behind the undocumented NetBSD stat syscalls?

Garrett Cooper yanegomi at
Sun Feb 13 21:39:51 UTC 2011

Hi FS folks,
    I was poking through vfs_syscalls.c and I noticed that there was a
syscall called nlstat, and nstat, and a kernel-public only helper
function called cvtnstat:
    These aren't used anywhere in our source tree (I trimmed out the
false positives -- i.e. connstat and instat), minus their declarations
in kern/vfs_syscalls.c, etc:

$ svngrep -Er 'nl?stat\(' /usr/src/
/usr/src/sys/kern/kern_descrip.c:		cvtnstat(&ub, &nub);
/usr/src/sys/kern/syscalls.master:278	AUE_STAT	STD	{ int nstat(char
*path, struct nstat *ub); }
/usr/src/sys/kern/syscalls.master:280	AUE_LSTAT	STD	{ int nlstat(char
*path, struct nstat *ub); }
/usr/src/sys/kern/vfs_syscalls.c:cvtnstat(sb, nsb)
/usr/src/sys/kern/vfs_syscalls.c:nstat(td, uap)
/usr/src/sys/kern/vfs_syscalls.c:	cvtnstat(&sb, &nsb);
/usr/src/sys/kern/vfs_syscalls.c:nlstat(td, uap)
/usr/src/sys/kern/vfs_syscalls.c:	cvtnstat(&sb, &nsb);
/usr/src/sys/compat/freebsd32/syscalls.master:278	AUE_STAT	NOPROTO{
int nstat(char *path, struct nstat *ub); }
/usr/src/sys/compat/freebsd32/syscalls.master:280	AUE_LSTAT	NOPROTO{
int nlstat(char *path, struct nstat *ub); }
/usr/src/sys/sys/vnode.h:void	cvtnstat(struct stat *sb, struct nstat *nsb);
/usr/src/sys/sys/sysproto.h:int	nstat(struct thread *, struct nstat_args *);
/usr/src/sys/sys/sysproto.h:int	nlstat(struct thread *, struct nlstat_args *);

    And seems like it should be superseded by lstat, et all, which
were introduced a little earlier on [1].
    Do they serve a real purpose of some kind today? It was introduced
in the revision seen in SVN here [2], and looking back in time there
isn't reference to a NetBSD compat layer in sys/conf/options [3], etc,
so I was a bit curious why there are dangling undocumented (but
publicly visible via sysproto.h) VFS-related syscalls entries hanging
around (in particular because the syscalls aren't declared that way in
NetBSD either).


More information about the freebsd-fs mailing list