File System Type (statfs, sysfs)

Roger J. Noe rjnoe at uniq.UUCP
Sun May 29 08:56:59 AEST 1988


The following pertains to UNIX System V Release 3.1.1 Version 3 for the AT&T
3B2 computer.  Perhaps I have misunderstood the purpose of the statfs(2)
system call, but when I use it on remote file systems (RFS), I always get
the same file system type as local (non-RFS) file systems.  The following
program illustrates my point:

#include <stdio.h>
#include <sys/types.h>
#include <sys/fstyp.h>
#include <sys/statfs.h>

extern void perror();

main(argc, argv)
int	argc;
char	*argv[];
{
	char fs_name[FSTYPSZ+1];
	struct statfs fs;

	for (++argv, --argc; argc > 0; ++argv, --argc) {
		if (statfs(*argv, &fs, sizeof fs, 0) < 0) {
			perror("statfs");
			continue;
		}
		if (sysfs(GETFSTYP, fs.f_fstyp, fs_name) < 0) {
			perror("sysfs");
			continue;
		}
		printf("%s: fstype=%d (%s)\n", *argv, fs.f_fstyp, fs_name);
	}
	return 0;
}

No matter what real, mounted files I give this program as arguments, the answer
is always the same, i.e. S51K.  There appears to be no way to get statfs(2) to
return a f_fstyp corresponding to dufstyp (in the kernel) so that it maps
(through the kernel fsinfo[] table) to DUFST.  I realize that on the remote
system (the server of the mounted resource), the file system IS local, and the
type is S51K, but shouldn't my machine change the f_fstyp to dufstyp before
the system call returns, if it is in fact a remote file system?

Is there no PORTABLE way for a program to tell if a file (system) is remote
or not?
--
	Roger Noe			ihnp4!att!uniq!rjnoe
	Fox Valley Software		ihnp4!nwuxf!rjnoe
	Uniq Digital Technologies	+1 312 510 2105
	Batavia, Illinois  60510	41:50:56 N.  88:18:35 W.



More information about the Comp.unix.wizards mailing list