1GETFSSTAT(2)                  System Calls Manual                 GETFSSTAT(2)
2
3
4

NAME

6       getfsstat - get list of all mounted filesystems
7

SYNOPSIS

9       #include <sys/param.h>
10       #include <sys/mount.h>
11
12       int
13       getfsstat(buf,bufsize,flags)
14       struct statfs *buf;
15       int bufsize;
16       int flags;
17

DESCRIPTION

19       Getfsstat()  returns information about all mounted filesystems.  Buf is
20       a pointer to statfs structures defined as follows:
21
22
23       #define MNAMELEN 90       /* length of buffer for returned name */
24
25       struct statfs {
26       short   f_type;           /* type of filesystem (see below) */
27       short   f_flags;          /* copy of mount flags */
28       short   f_bsize;          /* fundamental file system block size */
29       short   f_iosize;         /* optimal transfer block size */
30       long    f_blocks;         /* total data blocks in file system */
31       long    f_bfree;          /* free blocks in fs */
32       long    f_bavail;         /* free blocks avail to non-superuser */
33       ino_t   f_files;          /* total file nodes in file system */
34       ino_t   f_ffree;          /* free file nodes in fs */
35       u_long  f_fsid[2];        /* file system id */
36       long    f_spare[4];       /* spare for later */
37       char    f_mntonname[MNAMELEN];    /* mount point */
38       char    f_mntfromname[MNAMELEN];  /* mounted filesystem */
39       };
40       /*
41       * File system types. - Only UFS is supported so the other types are not
42       * given.
43       */
44       #define   MOUNT_NONE     0
45       #define   MOUNT_UFS 1    /* Fast Filesystem */
46
47       Fields that are undefined for a particular filesystem are  set  to  -1.
48       The  buffer  is filled with an array of fsstat structures, one for each
49       mounted filesystem up to the size specified by bufsize.
50
51       If buf is given as NULL, getfsstat() returns just the number of mounted
52       filesystems.
53
54       Normally  flags  is  currently  unused.  In 4.4BSD systems the usage is
55       specified as MNT_WAIT.  If flags is set to MNT_NOWAIT, getfsstat() will
56       return  the  information  it has available without requesting an update
57       from each filesystem.  Thus, some of the information  will  be  out  of
58       date,  but  getfsstat()  will  not block waiting for information from a
59       filesystem that is unable to respond.
60

RETURN VALUES

62       Upon  successful  completion,  the  number  of  fsstat  structures   is
63       returned.   Otherwise,  -1 is returned and the global variable errno is
64       set to indicate the error.
65

ERRORS

67       Getfsstat() fails if one or more of the following are true:
68
69
70       [EFAULT]            Buf points to an invalid address.
71
72       [EIO]               An I/O error occurred while reading from or writing
73                           to the filesystem.
74

SEE ALSO

76       statfs(2), fstab(5), mount(8)
77

HISTORY

79       The getfsstat function first appeared in 4.4BSD.
80
81
82
834.4 Berkeley Distribution      December 24, 1995                  GETFSSTAT(2)
Impressum