Module rustix::fs

source ·
Expand description

Filesystem operations.

Re-exports

Modules

  • abs 🔒
    POSIX-style filesystem functions which operate on bare paths.
  • at 🔒
    POSIX-style *at functions.
  • constants 🔒
    Filesystem API constants, translated into bitflags constants.
  • cwd 🔒
    The cwd function, representing the current working directory.
  • dir 🔒
    Dir and DirEntry.
  • fadvise 🔒
  • fcntl 🔒
    The Unix fcntl function is effectively lots of different functions hidden behind a single dynamic dispatch interface. In order to provide a type-safe API, rustix makes them all separate functions so that they can have dedicated static type signatures.
  • fd 🔒
    Functions which operate on file descriptors.
  • id 🔒
  • inotify support for working with inotifies
  • ioctl 🔒
    Filesystem-oriented ioctl functions.
  • makedev 🔒
  • mount 🔒
    Linux mount.
  • openat2 🔒
  • raw_dir 🔒
    RawDir and RawDirEntry.
  • seek_from 🔒
    The following is derived from Rust’s library/std/src/io/mod.rs at revision dca3f1b786efd27be3b325ed1e01e247aa589c3b.
  • sendfile 🔒
  • statx 🔒
    Linux statx.
  • sync 🔒
  • xattr 🔒

Structs

Enums

Constants

Traits

Functions

  • access(path, access)—Tests permissions for a file or directory.
  • faccessat(dirfd, path, access, flags)—Tests permissions for a file or directory.
  • chmod(path, mode)—Sets file or directory permissions.
  • fchmodat(dirfd, path, mode, flags)—Sets file or directory permissions.
  • chown(path, owner, group)—Sets open file or directory ownership.
  • 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.
  • cwdDeprecated
    Return the value of CWD.
  • ioctl(fd, EXT4_IOC_RESIZE_FS, blocks)—Resize ext4 filesystem on fd.
  • posix_fadvise(fd, offset, len, advice)—Declares an expected access pattern for a file.
  • fallocate(fd, mode, offset, len)—Adjusts file allocation.
  • fchmod(fd, mode)—Sets open file or directory permissions.
  • fchown(fd, owner, group)—Sets open file or directory ownership.
  • fcntl(fd, F_ADD_SEALS)
  • fcntl(fd, F_GET_SEALS)
  • fcntl(fd, F_GETFL)—Returns a file descriptor’s access mode and status.
  • fcntl(fd, F_SETLK)—Acquire or release an fcntl-style lock.
  • fcntl(fd, F_SETFL, flags)—Sets a file descriptor’s status.
  • fdatasync(fd)—Ensures that file data is written to the underlying storage device.
  • fgetxattr(fd, name, value.as_ptr(), value.len())—Get extended filesystem attributes on an open file descriptor.
  • flistxattr(fd, list.as_ptr(), list.len())—List extended filesystem attributes on an open file descriptor.
  • flock(fd, operation)—Acquire or release an advisory lock on an open file.
  • fremovexattr(fd, name)—Remove an extended filesystem attribute on an open file descriptor.
  • fsetxattr(fd, name, value.as_ptr(), value.len(), flags)—Set extended filesystem attributes on an open file descriptor.
  • 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.
  • getxattr(path, name, value.as_ptr(), value.len())—Get extended filesystem attributes.
  • ioctl(fd, BLKPBSZGET)—Returns the physical block size of a block device.
  • ioctl(fd, BLKSSZGET)—Returns the logical block size of a block device.
  • ioctl(fd, FICLONE, src_fd)—Share data between open files.
  • ioctl(fd, FS_IOC_GETFLAGS)—Returns the inode flags attributes
  • ioctl(fd, FS_IOC_SETFLAGS)—Modify the inode flags attributes
  • fcntl(fd, F_GETFL) & O_ACCMODE
  • lgetxattr(path, name, value.as_ptr(), value.len())—Get extended filesystem attributes, without following symlinks in the last path component.
  • link(old_path, new_path)—Creates a hard link.
  • linkat(old_dirfd, old_path, new_dirfd, new_path, flags)—Creates a hard link.
  • listxattr(path, list.as_ptr(), list.len())—List extended filesystem attributes.
  • llistxattr(path, list.as_ptr(), list.len())—List extended filesystem attributes, without following symlinks in the last path component.
  • lremovexattr(path, name)—Remove an extended filesystem attribute, without following symlinks in the last path component.
  • setxattr(path, name, value.as_ptr(), value.len(), flags)—Set extended filesystem attributes, without following symlinks in the last path component.
  • lstat(path)—Queries metadata for a file or directory, without following symlinks.
  • major(dev)
  • makedev(maj, min)
  • memfd_create(name, flags)
  • minor(dev)
  • mkdir(path, mode)—Creates a directory.
  • mkdirat(fd, path, mode)—Creates a directory.
  • mknodat(dirfd, path, mode, dev)—Creates special or normal files.
  • open(path, oflags, mode)—Opens a file.
  • openat(dirfd, path, oflags, mode)—Opens a file.
  • openat2(dirfd, path, OpenHow { oflags, mode, resolve }, sizeof(OpenHow))
  • readlink(path)—Reads the contents of a symlink.
  • readlinkat(fd, path)—Reads the contents of a symlink.
  • readlinkat(fd, path)—Reads the contents of a symlink, without allocating.
  • removexattr(path, name)—Remove an extended filesystem attribute.
  • rename(old_path, new_path)—Renames a file or directory.
  • 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.
  • rmdir(path)—Removes a directory.
  • lseek(fd, offset, whence)—Repositions a file descriptor within a file.
  • sendfile(out_fd, in_fd, offset, count)
  • setxattr(path, name, value.as_ptr(), value.len(), flags)—Set extended filesystem attributes.
  • stat(path)—Queries metadata for a file or directory.
  • 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)
  • symlink(old_path, new_path)—Creates a symlink.
  • symlinkat(old_path, new_dirfd, new_path)—Creates a symlink.
  • sync—Flush cached filesystem data for all filesystems.
  • syncfs(fd)—Flush cached filesystem data.
  • lseek(fd, 0, SEEK_CUR)—Returns the current position within a file.
  • unlink(path)—Unlinks a file.
  • unlinkat(fd, path, flags)—Unlinks a file or remove a directory.
  • utimensat(dirfd, path, times, flags)—Sets file or directory timestamps.

Type Aliases