Skip to main content

fallocate

Function fallocate 

Source
pub fn fallocate(
    fd: BorrowedFd<'_>,
    mode: FallocateMode,
    offset: i64,
    length: i64,
) -> Result<(), Errno>
Expand description

Pré-alloue ou manipule l’espace d’un fichier.

§Errors

  • EOPNOTSUPP : opération non supportée par le filesystem.
  • ENOSPC : espace insuffisant.

§Examples

use air_sys_syscall::fs::fallocate;
use air_sys_types::fs::FallocateMode;
use air_sys_types::fd::BorrowedFd;

// Pré-allouer 1 Mo sans modifier la taille visible
fallocate(fd, FallocateMode::KEEP_SIZE, 0, 1_048_576).expect("fallocate");