Skip to main content

SYS_FACCESSAT

Constant SYS_FACCESSAT 

Source
pub const SYS_FACCESSAT: usize = 468;
Expand description

Check file accessibility relative to a directory FD.

  • dirfd: directory file descriptor (or AT_FDCWD)
  • path_ptr: pointer to the path string
  • path_len: length of the path
  • mode: accessibility check (R_OK=4, W_OK=2, X_OK=1, F_OK=0)
  • flags: flags (currently unused, pass 0)

Returns 0 if the file is accessible, -EACCES or -ENOENT otherwise. This is the preferred way to check file access : it avoids TOCTOU races that SYS_ACCESS can have when paths are resolved relative to CWD.