xref: /dflybsd-src/lib/libc/sys/statvfs.2 (revision 86d7f5d305c6adaa56ff4582ece9859d73106103)
186d7f5d3SJohn Marino.\"	$OpenBSD: statvfs.3,v 1.5 2008/03/26 09:37:59 jmc Exp $
286d7f5d3SJohn Marino.\"	$NetBSD: statfs.2,v 1.10 1995/06/29 11:40:48 cgd Exp $
386d7f5d3SJohn Marino.\"	$DragonFly: src/lib/libc/sys/statvfs.2,v 1.3 2008/09/30 08:28:36 swildner Exp $
486d7f5d3SJohn Marino.\"
586d7f5d3SJohn Marino.\" Copyright (c) 1989, 1991, 1993
686d7f5d3SJohn Marino.\"	The Regents of the University of California.  All rights reserved.
786d7f5d3SJohn Marino.\"
886d7f5d3SJohn Marino.\" Redistribution and use in source and binary forms, with or without
986d7f5d3SJohn Marino.\" modification, are permitted provided that the following conditions
1086d7f5d3SJohn Marino.\" are met:
1186d7f5d3SJohn Marino.\" 1. Redistributions of source code must retain the above copyright
1286d7f5d3SJohn Marino.\"    notice, this list of conditions and the following disclaimer.
1386d7f5d3SJohn Marino.\" 2. Redistributions in binary form must reproduce the above copyright
1486d7f5d3SJohn Marino.\"    notice, this list of conditions and the following disclaimer in the
1586d7f5d3SJohn Marino.\"    documentation and/or other materials provided with the distribution.
1686d7f5d3SJohn Marino.\" 3. Neither the name of the University nor the names of its contributors
1786d7f5d3SJohn Marino.\"    may be used to endorse or promote products derived from this software
1886d7f5d3SJohn Marino.\"    without specific prior written permission.
1986d7f5d3SJohn Marino.\"
2086d7f5d3SJohn Marino.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
2186d7f5d3SJohn Marino.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
2286d7f5d3SJohn Marino.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
2386d7f5d3SJohn Marino.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
2486d7f5d3SJohn Marino.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2586d7f5d3SJohn Marino.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2686d7f5d3SJohn Marino.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2786d7f5d3SJohn Marino.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2886d7f5d3SJohn Marino.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2986d7f5d3SJohn Marino.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
3086d7f5d3SJohn Marino.\" SUCH DAMAGE.
3186d7f5d3SJohn Marino.\"
3286d7f5d3SJohn Marino.\"	@(#)statfs.2	8.3 (Berkeley) 2/11/94
3386d7f5d3SJohn Marino.\"
3486d7f5d3SJohn Marino.Dd September 28, 2008
3586d7f5d3SJohn Marino.Dt STATVFS 2
3686d7f5d3SJohn Marino.Os
3786d7f5d3SJohn Marino.Sh NAME
3886d7f5d3SJohn Marino.Nm statvfs ,
3986d7f5d3SJohn Marino.Nm fstatvfs
4086d7f5d3SJohn Marino.Nd get file system statistics
4186d7f5d3SJohn Marino.Sh LIBRARY
4286d7f5d3SJohn Marino.Lb libc
4386d7f5d3SJohn Marino.Sh SYNOPSIS
4486d7f5d3SJohn Marino.In sys/statvfs.h
4586d7f5d3SJohn Marino.Ft int
4686d7f5d3SJohn Marino.Fn statvfs "const char *path" "struct statvfs *buf"
4786d7f5d3SJohn Marino.Ft int
4886d7f5d3SJohn Marino.Fn fstatvfs "int fd" "struct statvfs *buf"
4986d7f5d3SJohn Marino.Sh DESCRIPTION
5086d7f5d3SJohn Marino.Fn statvfs
5186d7f5d3SJohn Marinoreturns information about a mounted file system.
5286d7f5d3SJohn Marino.Fa path
5386d7f5d3SJohn Marinois the path name of any file within the mounted file system.
5486d7f5d3SJohn Marino.Fa buf
5586d7f5d3SJohn Marinois a pointer to a
5686d7f5d3SJohn Marino.Nm statvfs
5786d7f5d3SJohn Marinostructure defined as follows:
5886d7f5d3SJohn Marino.Bd -literal
5986d7f5d3SJohn Marinostruct statvfs {
6086d7f5d3SJohn Marino        unsigned long f_bsize;       /* file system block size */
6186d7f5d3SJohn Marino        unsigned long f_frsize;      /* fundamental file system block size */
6286d7f5d3SJohn Marino        fsblkcnt_t    f_blocks;      /* number of blocks (unit f_frsize) */
6386d7f5d3SJohn Marino        fsblkcnt_t    f_bfree;       /* free blocks in file system */
6486d7f5d3SJohn Marino        fsblkcnt_t    f_bavail;      /* free blocks for non-root */
6586d7f5d3SJohn Marino        fsfilcnt_t    f_files;       /* total file inodes */
6686d7f5d3SJohn Marino        fsfilcnt_t    f_ffree;       /* free file inodes */
6786d7f5d3SJohn Marino        fsfilcnt_t    f_favail;      /* free file inodes for to non-root */
6886d7f5d3SJohn Marino        unsigned long f_fsid;        /* file system id */
6986d7f5d3SJohn Marino        unsigned long f_flag;        /* bit mask of f_flag values */
7086d7f5d3SJohn Marino        unsigned long f_namemax;     /* maximum filename length */
7186d7f5d3SJohn Marino        uid_t         f_owner;       /* user that mounted the filesystem */
7286d7f5d3SJohn Marino        unsigned int  f_type;        /* filesystem type */
7386d7f5d3SJohn Marino
7486d7f5d3SJohn Marino        uint64_t      f_syncreads;   /* count of sync reads since mount */
7586d7f5d3SJohn Marino        uint64_t      f_syncwrites;  /* count of sync writes since mount */
7686d7f5d3SJohn Marino
7786d7f5d3SJohn Marino        uint64_t      f_asyncreads;  /* count of async reads since mount */
7886d7f5d3SJohn Marino        uint64_t      f_asyncwrites; /* count of async writes since mount */
7986d7f5d3SJohn Marino
8086d7f5d3SJohn Marino        /*
8186d7f5d3SJohn Marino         * DragonFly extensions - full uuid FSID and owner
8286d7f5d3SJohn Marino         */
8386d7f5d3SJohn Marino        uuid_t        f_fsid_uuid;
8486d7f5d3SJohn Marino        uuid_t        f_uid_uuid;
8586d7f5d3SJohn Marino};
8686d7f5d3SJohn Marino
8786d7f5d3SJohn Marino/*
8886d7f5d3SJohn Marino * f_flag definitions
8986d7f5d3SJohn Marino */
9086d7f5d3SJohn Marino#define ST_RDONLY     0x00000001     /* fs is read-only */
9186d7f5d3SJohn Marino#define ST_NOSUID     0x00000002     /* ST_ISUID or ST_ISGID not supported */
9286d7f5d3SJohn Marino
9386d7f5d3SJohn Marino/*
9486d7f5d3SJohn Marino * DragonFly specific flags
9586d7f5d3SJohn Marino */
9686d7f5d3SJohn Marino#define ST_FSID_UUID  0x40000000     /* f_fsid_uuid field is valid */
9786d7f5d3SJohn Marino#define ST_OWNER_UUID 0x80000000     /* f_owner_uuid field is valid */
9886d7f5d3SJohn Marino.Ed
9986d7f5d3SJohn Marino.Pp
10086d7f5d3SJohn MarinoThe fields of type
10186d7f5d3SJohn Marino.Va fsblkcnt_t
10286d7f5d3SJohn Marinoare reported in units of
10386d7f5d3SJohn Marino.Va f_frsize .
10486d7f5d3SJohn Marino.Pp
10586d7f5d3SJohn Marino.Fn fstatvfs
10686d7f5d3SJohn Marinoreturns the same information about an open file referenced by descriptor
10786d7f5d3SJohn Marino.Fa fd .
10886d7f5d3SJohn Marino.Sh RETURN VALUES
10986d7f5d3SJohn Marino.Rv -std statvfs fstatvfs
11086d7f5d3SJohn Marino.Sh ERRORS
11186d7f5d3SJohn Marino.Fn statvfs
11286d7f5d3SJohn Marinofails if one or more of the following are true:
11386d7f5d3SJohn Marino.Bl -tag -width Er
11486d7f5d3SJohn Marino.It Bq Er ENOTDIR
11586d7f5d3SJohn MarinoA component of the path prefix of
11686d7f5d3SJohn Marino.Fa path
11786d7f5d3SJohn Marinois not a directory.
11886d7f5d3SJohn Marino.It Bq Er ENAMETOOLONG
11986d7f5d3SJohn MarinoThe length of a component of
12086d7f5d3SJohn Marino.Fa path
12186d7f5d3SJohn Marinoexceeds
12286d7f5d3SJohn Marino.Dv {NAME_MAX}
12386d7f5d3SJohn Marinocharacters, or the length of
12486d7f5d3SJohn Marino.Fa path
12586d7f5d3SJohn Marinoexceeds
12686d7f5d3SJohn Marino.Dv {PATH_MAX}
12786d7f5d3SJohn Marinocharacters.
12886d7f5d3SJohn Marino.It Bq Er ENOENT
12986d7f5d3SJohn MarinoThe file referred to by
13086d7f5d3SJohn Marino.Fa path
13186d7f5d3SJohn Marinodoes not exist.
13286d7f5d3SJohn Marino.It Bq Er EACCES
13386d7f5d3SJohn MarinoSearch permission is denied for a component of the path prefix of
13486d7f5d3SJohn Marino.Fa path .
13586d7f5d3SJohn Marino.It Bq Er ELOOP
13686d7f5d3SJohn MarinoToo many symbolic links were encountered in translating
13786d7f5d3SJohn Marino.Fa path .
13886d7f5d3SJohn Marino.It Bq Er EFAULT
13986d7f5d3SJohn Marino.Fa buf
14086d7f5d3SJohn Marinoor
14186d7f5d3SJohn Marino.Fa path
14286d7f5d3SJohn Marinopoints to an invalid address.
14386d7f5d3SJohn Marino.It Bq Er EIO
14486d7f5d3SJohn MarinoAn
14586d7f5d3SJohn Marino.Tn I/O
14686d7f5d3SJohn Marinoerror occurred while reading from or writing to the file system.
14786d7f5d3SJohn Marino.El
14886d7f5d3SJohn Marino.Pp
14986d7f5d3SJohn Marino.Fn fstatvfs
15086d7f5d3SJohn Marinofails if one or more of the following are true:
15186d7f5d3SJohn Marino.Bl -tag -width Er
15286d7f5d3SJohn Marino.It Bq Er EBADF
15386d7f5d3SJohn Marino.Fa fd
15486d7f5d3SJohn Marinois not a valid open file descriptor.
15586d7f5d3SJohn Marino.It Bq Er EFAULT
15686d7f5d3SJohn Marino.Fa buf
15786d7f5d3SJohn Marinopoints to an invalid address.
15886d7f5d3SJohn Marino.It Bq Er EIO
15986d7f5d3SJohn MarinoAn
16086d7f5d3SJohn Marino.Tn I/O
16186d7f5d3SJohn Marinoerror occurred while reading from or writing to the file system.
16286d7f5d3SJohn Marino.El
16386d7f5d3SJohn Marino.Sh SEE ALSO
16486d7f5d3SJohn Marino.Xr df 1 ,
16586d7f5d3SJohn Marino.Xr mount 2 ,
16686d7f5d3SJohn Marino.Xr stat 2 ,
16786d7f5d3SJohn Marino.Xr statfs 2
16886d7f5d3SJohn Marino.Sh STANDARDS
16986d7f5d3SJohn MarinoThe
17086d7f5d3SJohn Marino.Fn statvfs
17186d7f5d3SJohn Marinoand
17286d7f5d3SJohn Marino.Fn fstatvfs
17386d7f5d3SJohn Marinosystem calls conform to
17486d7f5d3SJohn Marino.St -p1003.1-2001 .
17586d7f5d3SJohn Marino.Sh HISTORY
17686d7f5d3SJohn MarinoThe
17786d7f5d3SJohn Marino.Fn statvfs
17886d7f5d3SJohn Marinoand
17986d7f5d3SJohn Marino.Fn fstatvfs
18086d7f5d3SJohn Marinofunctions first appeared in
18186d7f5d3SJohn Marino.Dx 1.13 .
182