POSIX_FALLOCATE(3)         POSIX Programmer's Manual        POSIX_FALLOCATE(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
       posix_fallocate -- file space control (AADDVVAANNCCEEDD RREEAALLTTIIMMEE)

SSYYNNOOPPSSIISS
       #include <fcntl.h>

       int posix_fallocate(int _f_d, off_t _o_f_f_s_e_t, off_t _l_e_n);

DDEESSCCRRIIPPTTIIOONN
       The _p_o_s_i_x___f_a_l_l_o_c_a_t_e() function shall ensure that any required storage
       for regular file data starting at _o_f_f_s_e_t and continuing for _l_e_n bytes
       is allocated on the file system storage media. If _p_o_s_i_x___f_a_l_l_o_c_a_t_e()
       returns successfully, subsequent writes to the specified file data
       shall not fail due to the lack of free space on the file system storage
       media.

       If the _o_f_f_s_e_t+_l_e_n is beyond the current file size, then
       _p_o_s_i_x___f_a_l_l_o_c_a_t_e() shall adjust the file size to _o_f_f_s_e_t+_l_e_n.  Otherwise,
       the file size shall not be changed.

       It is implementation-defined whether a previous _p_o_s_i_x___f_a_d_v_i_s_e() call
       influences allocation strategy.

       Space allocated via _p_o_s_i_x___f_a_l_l_o_c_a_t_e() shall be freed by a successful
       call to _c_r_e_a_t() or _o_p_e_n() that truncates the size of the file. Space
       allocated via _p_o_s_i_x___f_a_l_l_o_c_a_t_e() may be freed by a successful call to
       _f_t_r_u_n_c_a_t_e() that reduces the file size to a size smaller than
       _o_f_f_s_e_t+_l_e_n.

RREETTUURRNN VVAALLUUEE
       Upon successful completion, _p_o_s_i_x___f_a_l_l_o_c_a_t_e() shall return zero;
       otherwise, an error number shall be returned to indicate the error.

EERRRROORRSS
       The _p_o_s_i_x___f_a_l_l_o_c_a_t_e() function shall fail if:

       EEBBAADDFF  The _f_d argument is not a valid file descriptor.

       EEBBAADDFF  The _f_d argument references a file that was opened without write
              permission.

       EEFFBBIIGG  The value of _o_f_f_s_e_t+_l_e_n is greater than the maximum file size.

       EEIINNTTRR  A signal was caught during execution.

       EEIINNVVAALL The _l_e_n argument is less than zero, or the _o_f_f_s_e_t argument is
              less than zero, or the underlying file system does not support
              this operation.

       EEIIOO    An I/O error occurred while reading from or writing to a file
              system.

       EENNOODDEEVV The _f_d argument does not refer to a regular file.

       EENNOOSSPPCC There is insufficient free space remaining on the file system
              storage media.

       EESSPPIIPPEE The _f_d argument is associated with a pipe or FIFO.

       The _p_o_s_i_x___f_a_l_l_o_c_a_t_e() function may fail if:

       EEIINNVVAALL The _l_e_n argument is zero.

       _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
       None.

AAPPPPLLIICCAATTIIOONN UUSSAAGGEE
       The _p_o_s_i_x___f_a_l_l_o_c_a_t_e() function is part of the Advisory Information
       option and need not be provided on all implementations.

RRAATTIIOONNAALLEE
       None.

FFUUTTUURREE DDIIRREECCTTIIOONNSS
       None.

SSEEEE AALLSSOO
       _c_r_e_a_t(), _f_t_r_u_n_c_a_t_e(), _o_p_e_n(), _u_n_l_i_n_k()

       The Base Definitions volume of POSIX.1-2008, <<ffccnnttll..hh>>

CCOOPPYYRRIIGGHHTT
       Portions of this text are reprinted and reproduced in electronic form
       from IEEE Std 1003.1, 2013 Edition, Standard for Information Technology
       -- Portable Operating System Interface (POSIX), The Open Group Base
       Specifications Issue 7, Copyright (C) 2013 by the Institute of
       Electrical and Electronics Engineers, Inc and The Open Group.  (This is
       POSIX.1-2008 with the 2013 Technical Corrigendum 1 applied.) 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.unix.org/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                  2013                   POSIX_FALLOCATE(3)
