FSTATVFS(3)                POSIX Programmer's Manual               FSTATVFS(3)



PPRROOLLOOGG
       This manual page is part of the POSIX Programmer's Manual.  The OS
       implementation of this interface may differ (consult the corresponding
       OS manual page for details of OS behavior), or the interface may not be
       implemented on OS.

NNAAMMEE
       fstatvfs, statvfs -- get file system information

SSYYNNOOPPSSIISS
       #include <sys/statvfs.h>

       int fstatvfs(int _f_i_l_d_e_s, struct statvfs *_b_u_f);
       int statvfs(const char *restrict _p_a_t_h, struct statvfs *restrict _b_u_f);

DDEESSCCRRIIPPTTIIOONN
       The _f_s_t_a_t_v_f_s() function shall obtain information about the file system
       containing the file referenced by _f_i_l_d_e_s.

       The _s_t_a_t_v_f_s() function shall obtain information about the file system
       containing the file named by _p_a_t_h.

       For both functions, the _b_u_f argument is a pointer to a ssttaattvvffss
       structure that shall be filled. Read, write, or execute permission of
       the named file is not required.

       The following flags can be returned in the _f___f_l_a_g member:

       ST_RDONLY   Read-only file system.

       ST_NOSUID   Setuid/setgid bits ignored by _e_x_e_c.

       It is unspecified whether all members of the ssttaattvvffss structure have
       meaningful values on all file systems.

RREETTUURRNN VVAALLUUEE
       Upon successful completion, _s_t_a_t_v_f_s() shall return 0. Otherwise, it
       shall return -1 and set _e_r_r_n_o to indicate the error.

EERRRROORRSS
       The _f_s_t_a_t_v_f_s() and _s_t_a_t_v_f_s() functions shall fail if:

       EEIIOO    An I/O error occurred while reading the file system.

       EEIINNTTRR  A signal was caught during execution of the function.

       EEOOVVEERRFFLLOOWW
              One of the values to be returned cannot be represented correctly
              in the structure pointed to by _b_u_f.

       The _f_s_t_a_t_v_f_s() function shall fail if:

       EEBBAADDFF  The _f_i_l_d_e_s argument is not an open file descriptor.

       The _s_t_a_t_v_f_s() function shall fail if:

       EEAACCCCEESS Search permission is denied on a component of the path prefix.

       EELLOOOOPP  A loop exists in symbolic links encountered during resolution of
              the _p_a_t_h argument.

       EENNAAMMEETTOOOOLLOONNGG
              The length of a component of a pathname is longer than
              {NAME_MAX}.

       EENNOOEENNTT A component of _p_a_t_h does not name an existing file or _p_a_t_h is an
              empty string.

       EENNOOTTDDIIRR
              A component of the path prefix names an existing file that is
              neither a directory nor a symbolic link to a directory, or the
              _p_a_t_h argument contains at least one non-<slash> character and
              ends with one or more trailing <slash> characters and the last
              pathname component names an existing file that is neither a
              directory nor a symbolic link to a directory.

       The _s_t_a_t_v_f_s() function may fail if:

       EELLOOOOPP  More than {SYMLOOP_MAX} symbolic links were encountered during
              resolution of the _p_a_t_h argument.

       EENNAAMMEETTOOOOLLOONNGG
              The length of a pathname exceeds {PATH_MAX}, or pathname
              resolution of a symbolic link produced an intermediate result
              with a length that exceeds {PATH_MAX}.

       _T_h_e _f_o_l_l_o_w_i_n_g _s_e_c_t_i_o_n_s _a_r_e _i_n_f_o_r_m_a_t_i_v_e_.

EEXXAAMMPPLLEESS
   OObbttaaiinniinngg FFiillee SSyysstteemm IInnffoorrmmaattiioonn UUssiinngg ffssttaattvvffss(())
       The following example shows how to obtain file system information for
       the file system upon which the file named //hhoommee//ccnndd//mmoodd11 resides, using
       the _f_s_t_a_t_v_f_s() function. The //hhoommee//ccnndd//mmoodd11 file is opened with
       read/write privileges and the open file descriptor is passed to the
       _f_s_t_a_t_v_f_s() function.


           #include <sys/statvfs.h>
           #include <fcntl.h>

           struct statvfs buffer;
           int            status;
           ...
           fildes = open("/home/cnd/mod1", O_RDWR);
           status  = fstatvfs(fildes, &buffer);

   OObbttaaiinniinngg FFiillee SSyysstteemm IInnffoorrmmaattiioonn UUssiinngg ssttaattvvffss(())
       The following example shows how to obtain file system information for
       the file system upon which the file named //hhoommee//ccnndd//mmoodd11 resides, using
       the _s_t_a_t_v_f_s() function.


           #include <sys/statvfs.h>

           struct statvfs buffer;
           int            status;
           ...
           status = statvfs("/home/cnd/mod1", &buffer);

AAPPPPLLIICCAATTIIOONN UUSSAAGGEE
       None.

RRAATTIIOONNAALLEE
       None.

FFUUTTUURREE DDIIRREECCTTIIOONNSS
       None.

SSEEEE AALLSSOO
       _c_h_m_o_d(), _c_h_o_w_n(), _c_r_e_a_t(), _d_u_p(), _e_x_e_c, _f_c_n_t_l(), _l_i_n_k(), _m_k_n_o_d(),
       _o_p_e_n(), _p_i_p_e(), _r_e_a_d(), _t_i_m_e(), _u_n_l_i_n_k(), _u_t_i_m_e(), _w_r_i_t_e()

       The Base Definitions volume of POSIX.1-2017, <<ssyyss__ssttaattvvffss..hh>>

CCOOPPYYRRIIGGHHTT
       Portions of this text are reprinted and reproduced in electronic form
       from IEEE Std 1003.1-2017, Standard for Information Technology --
       Portable Operating System Interface (POSIX), The Open Group Base
       Specifications Issue 7, 2018 Edition, Copyright (C) 2018 by the
       Institute of Electrical and Electronics Engineers, Inc and The Open
       Group.  In the event of any discrepancy between this version and the
       original IEEE and The Open Group Standard, the original IEEE and The
       Open Group Standard is the referee document. The original Standard can
       be obtained online at http://www.opengroup.org/unix/online.html .

       Any typographical or formatting errors that appear in this page are
       most likely to have been introduced during the conversion of the source
       files to man page format. To report such errors, see
       https://www.kernel.org/doc/man-pages/reporting_bugs.html .



IEEE/The Open Group                  2017                          FSTATVFS(3)
