posix_fallocate(3c) 맨 페이지 - 윈디하나의 솔라나라

개요

섹션
맨 페이지 이름
검색(S)

posix_fallocate(3c)

posix_fallocate(3C)      Standard C Library Functions      posix_fallocate(3C)

NAME
       posix_fallocate - file space control

SYNOPSIS
       #include <fcntl.h>

       int posix_fallocate(int fd, off_t offset, off_t len);

DESCRIPTION
       The  posix_fallocate()  function  ensures that any required storage for
       regular file data starting at offset and continuing for  len  bytes  is
       allocated  on  the  file system storage media. If posix_fallocate() re‐
       turns successfully, subsequent writes to the specified file  data  will
       not  fail  due to the lack of free space on the file system storage me‐
       dia.


       If the offset+len is beyond the current file  size,  then  posix_fallo‐
       cate() adjusts the file size to offset+len. Otherwise, the file size is
       not changed.


       Space allocated with posix_fallocate() is freed by a successful call to
       creat(2)  or  open(2)  that truncates the size of the file. Space allo‐
       cated with posix_fallocate() may be  freed  by  a  successful  call  to
       ftruncate(3C)  that  reduces  the file size to a size smaller than off‐
       set+len.

RETURN VALUES
       Upon successful completion, posix_fallocate() returns zero.  Otherwise,
       an error number is returned to indicate the error.

ERRORS
       The posix_fallocate() function will fail if:

       EAGAIN     The  file  exists, mandatory file/record locking is set, and
                  there  are  outstanding  record  locks  on  the  file.   See
                  chmod(2).


       EBADF      The fd argument is not a valid file descriptor or references
                  a file that was opened without write permission.


       EDEADLK    The  file exists, mandatory file/record locking is set and a
                  deadlock condition was detected.


       EFBIG      The value of offset+len is greater  than  the  maximum  file
                  size.


       EINTR      A signal was caught during execution.


       EINVAL     The  len argument is less than or equal to zero, or the off‐
                  set argument is less than zero.


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


       ENODEV     The fd argument does not refer to a regular file.


       ENOLINK    The  fd  argument points to a remote machine and the link to
                  that machine is no longer active.


       ENOSPC     There is insufficient free space remaining on the file  sys‐
                  tem storage media.


       EPERM      The  file  has  one or more of the appendonly, readonly, im‐
                  mutable, or rtime system attributes set.


       ESPIPE     The fd argument is associated with a pipe or FIFO.


USAGE
       The posix_fallocate() function has a transitional interface for  64-bit
       file offsets. See lf64(7).


       Due to the copy-on-write nature of zfs(4FS), posix_fallocate() will not
       actually allocate additional space on ZFS filesystems.

ATTRIBUTES
       See attributes(7) for descriptions of the following attributes:

       tab()  box; cw(2.75i) |cw(2.75i) lw(2.75i) |lw(2.75i) ATTRIBUTE TYPEAT‐
       TRIBUTE VALUE _ Interface StabilityCommitted _ MT-LevelMT-Safe _  Stan‐
       dardSee standards(7).


SEE ALSO
       chmod(2),  creat(2), open(2), unlink(2), ftruncate(3C), spawn.h(3HEAD),
       attributes(7), standards(7), sysattr(7)

HISTORY
       The posix_fallocate() function was added in Solaris 11.0.0.

Oracle Solaris 11.4               27 Aug 2025              posix_fallocate(3C)
맨 페이지 내용의 저작권은 맨 페이지 작성자에게 있습니다.
RSS ATOM XHTML 5 CSS3