Module rustix::fs

source · []
Available on crate feature fs only.
Expand description

Filesystem operations.

Structs

*_OK constants for use with accessat.

AT_* constants for use with openat, statat, and other *at functions.

CLONE_* constants for use with fclonefileat.

COPYFILE_* constants.

DIR*

struct dirent

FALLOC_FL_* constants for use with fallocate.

FD_* constants for use with fcntl_getfd and fcntl_setfd.

S_I* constants for use with openat, chmodat, and fchmod.

O_* constants for use with openat.

Timestamps used by utimensat and futimens.

copyfile_state_t—State for use with fcopyfile.

Enums

S_IF* constants for use with mknodat and Stat’s st_mode field.

LOCK_* constants for use with flock

Constants

UTIME_NOW for use with utimensat.

UTIME_OMIT for use with utimensat.

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.

fchmodat(dirfd, path, mode, 0)—Sets file or directory permissions.

fchownat(dirfd, path, owner, group, flags)—Sets file or directory ownership.

copyfile_state_alloc()

copyfile_state_free(state)

copyfile_state_get(state, flags, dst)

copyfile_state_get(state, COPYFILE_STATE_COPIED)

AT_FDCWD—Returns a handle representing the current working directory.

fallocate(fd, mode, offset, len)—Adjusts file allocation.

fchmod(fd)—Sets open file or directory permissions.

fchown(fd)—Sets open file or directory ownership.

fclonefileat(src, dst_dir, dst, flags)—Efficiently copies between files.

fcntl(fd, F_DUPFD_CLOEXEC)—Creates a new OwnedFd instance, with value at least min, that has O_CLOEXEC set and that shares the same underlying [file description] as fd.

fcntl(fd, F_FULLFSYNC)

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_RDADVISE, radvisory { offset, len })

fcntl(fd, F_SETFD, flags)—Sets a file descriptor’s flags.

fcntl(fd, F_SETFL, flags)—Sets a file descriptor’s status.

fcopyfile(from, to, state, flags)

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.

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_GETPATH)

fcntl(fd, F_GETFL) & O_ACCMODE

linkat(old_dirfd, old_path, new_dirfd, new_path, flags)—Creates a hard link.

mkdirat(fd, path, mode)—Creates a directory.

openat(dirfd, path, oflags, mode)—Opens a file.

readlinkat(fd, path)—Reads the contents of a symlink.

renameat(old_dirfd, old_path, new_dirfd, new_path)—Renames a file or directory.

lseek(fd, offset, whence)—Repositions a file descriptor within a file.

fstatat(dirfd, path, flags)—Queries metadata for a file or directory.

statfs—Queries filesystem metadata.

symlinkat(old_dirfd, 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.

Type Definitions

dev_t

A type for the tv_nsec field of Timespec.

mode_t

A type for the tv_sec field of Timespec.

struct stat for use with statat and fstat.

struct statfs for use with fstatfs.

struct timespec