Available on crate feature
fs
only.Expand description
Filesystem operations.
Structs
*_OK
constants for use withaccessat
.DIR*
struct dirent
FALLOC_FL_*
constants for use withfallocate
.MFD_*
constants for use withmemfd_create
.MS_*
constants for use withmount
.MS_*
constants for use with [change_mount
][crate::fs::mount::change_mount].O_*
constants for use withopenat
.- A directory iterator implemented with getdents.
- A raw directory entry, similar to
std::fs::DirEntry
. RENAME_*
constants for use withrenameat_with
.RESOLVE_*
constants for use withopenat2
.ST_*
constants for use withStatVfs
.STATX_*
constants for use withstatx
.
Enums
Constants
- The filesystem magic number for NFS.
- The filesystem magic number for procfs.
UTIME_NOW
for use withutimensat
.UTIME_OMIT
for use withutimensat
.
Traits
- Re-export types common to POSIX-ish platforms. Unix-specific extension methods for
fs::DirEntry
. - Re-export types common to POSIX-ish platforms. Unix-specific extensions to
fs::File
. - Re-export types common to POSIX-ish platforms. Unix-specific extensions for
fs::FileType
. - Re-export types common to POSIX-ish platforms. Unix-specific extensions to
fs::Metadata
. - Re-export types common to POSIX-ish platforms. Unix-specific extensions to
fs::OpenOptions
.
Functions
faccessat(dirfd, path, access, flags)
—Tests permissions for a file or directory.mount(source, target, null, MS_BIND, null)
mount(null, target, null, mountflags, null)
fchmodat(dirfd, path, mode, 0)
—Sets file or directory permissions.fchownat(dirfd, path, owner, group, flags)
—Sets file or directory ownership.copy_file_range(fd_in, off_in, fd_out, off_out, len, 0)
—Copies data from one file to another.AT_FDCWD
—Returns a handle representing the current working directory.posix_fadvise(fd, offset, len, advice)
—Declares an expected access pattern for a file.fallocate(fd, mode, offset, len)
—Adjusts file allocation.fchmod(fd)
—Sets open file or directory permissions.fchown(fd)
—Sets open file or directory ownership.fcntl(fd, F_ADD_SEALS)
fcntl(fd, F_DUPFD_CLOEXEC)
—Creates a newOwnedFd
instance, with value at leastmin
, that hasO_CLOEXEC
set and that shares the same underlying [file description] asfd
.fcntl(fd, F_GET_SEALS)
fcntl(fd, F_GETFD)
—Returns a file descriptor’s flags.fcntl(fd, F_GETFL)
—Returns a file descriptor’s access mode and status.fcntl(fd, F_SETFD, flags)
—Sets a file descriptor’s flags.fcntl(fd, F_SETFL, flags)
—Sets a file descriptor’s status.fdatasync(fd)
—Ensures that file data is written to the underlying storage device.flock(fd, operation)
—Acquire or release an advisory lock on an open file.fstat(fd)
—Queries metadata for an open file or directory.fstatfs(fd)
—Queries filesystem statistics for an open file or directory.fstatvfs(fd)
—Queries filesystem statistics for an open file or directory, POSIX version.fsync(fd)
—Ensures that file data and metadata is written to the underlying storage device.ftruncate(fd, length)
—Sets the length of a file.futimens(fd, times)
—Sets timestamps for an open file or directory.fcntl(fd, F_GETFL) & O_ACCMODE
linkat(old_dirfd, old_path, new_dirfd, new_path, flags)
—Creates a hard link.major(dev)
makedev(maj, min)
memfd_create(path, flags)
minor(dev)
mkdirat(fd, path, mode)
—Creates a directory.mknodat(dirfd, path, mode, dev)
—Creates special or normal files.mount(source, target, filesystemtype, mountflags, data)
mount(source, target, null, MS_MOVE, null)
openat(dirfd, path, oflags, mode)
—Opens a file.openat2(dirfd, path, OpenHow { oflags, mode, resolve }, sizeof(OpenHow))
readlinkat(fd, path)
—Reads the contents of a symlink.mount(source, target, null, MS_BIND | MS_REC, null)
mount(null, target, null, MS_REMOUNT | mountflags, data)
renameat(old_dirfd, old_path, new_dirfd, new_path)
—Renames a file or directory.renameat2(old_dirfd, old_path, new_dirfd, new_path, flags)
—Renames a file or directory.lseek(fd, offset, whence)
—Repositions a file descriptor within a file.sendfile(out_fd, in_fd, offset, count)
fstatat(dirfd, path, flags)
—Queries metadata for a file or directory.statfs
—Queries filesystem metadata.statvfs
—Queries filesystem metadata, POSIX version.statx(dirfd, path, flags, mask, statxbuf)
symlinkat(old_path, new_dirfd, new_path)
—Creates a symlink.lseek(fd, 0, SEEK_CUR)
—Returns the current position within a file.unlinkat(fd, path, flags)
—Unlinks a file or remove a directory.utimensat(dirfd, path, times, flags)
—Sets file or directory timestamps.