UNISTDX_FS_FILE_STATUS
using uid_type = ::uid_t

Alias for uid_t. Alias to uid_t system type.

using stat_type = struct ::stat

Alias to stat system type.

using gid_type = ::gid_t

Alias for gid_t. Alias to gid_t system type.

using device_type = ::dev_t

Alias to dev_t system type.

using offset_type = ::off_t

Alias to off_t system type.

class sys::file_status

File status class that wraps stat system type.

Base classes
  • public stat_type
Types
  • using nlink_type = ::nlink_t

    Hard link count type (integer).

  • using block_count_type = ::blkcnt_t

    Block count type (integer).

  • using block_size_type = ::blksize_t

    Block size type (integer).

  • using time_point = clock_type::time_point

    Clock time point type.

  • using clock_type = std::chrono::system_clock

    Clock type used in the methods of this class.

Methods
  • last_status_changed() const -> time_point

    Get time of last status change.

  • last_modified() const -> time_point

    Get time of last modification.

  • last_accessed() const -> time_point

    Get time of last access.

  • update(fd_type fd) -> file_status &

    Get file status for file descriptor fd.

    bad_call

    Return
    reference to this object
    See
    stat(2)
  • update(const char * filename, path_flag flags = path_flag(0)) -> file_status &

    Get file status for file filename.

    bad_call

    • Throws exception, if the file does not exist.
    • Use path_flag::no_follow to not throw exception on dangling symbolic links.

    Return
    reference to this object
    See
    stat(2)
    See
    std::errc
  • update(fd_type dir, const char * filename, path_flag flags = path_flag(0)) -> file_status &

    Get file status for file filename located in directory specified by file descriptor dir.

    bad_call

    • Throws exception, if the file does not exist.
    • Use path_flag::no_follow to not throw exception on dangling symbolic links.

    Return
    reference to this object
    See
    stat(2)
    See
    std::errc
  • exists() const -> bool

    Return true, if the file exists.

  • group() const -> gid_type

    Get ID of the group that owns the file.

  • owner() const -> uid_type

    Get ID of the user that owns the file.

  • mode() const -> file_mode

    Get file mode bits.

  • num_links() const -> nlink_type

    Get the number of hard links.

  • this_device() const -> device_type

    Get device ID (if the file is a device).

  • device() const -> device_type

    Get ID of the device that contains the file.

  • num_blocks() const -> block_count_type

    Get the number of 512 byte blocks allocated for the file.

  • preferred_block_size() const -> block_size_type

    Get preferred block size in bytes.

  • block_size() const -> block_size_type

    Get file block size in bytes.

  • size() const -> offset_type

    Get file size in bytes.

  • is_pipe() const -> bool

    Returns true, if file is a pipe.

  • is_character_device() const -> bool

    Returns true, if file is a character device.

  • is_directory() const -> bool

    Returns true, if file is a directory.

  • is_block_device() const -> bool

    Returns true, if file is a block device.

  • is_symbolic_link() const -> bool

    Returns true, if file is a symbolic link.

  • is_socket() const -> bool

    Returns true, if file is a unix domain socket.

  • is_regular() const -> bool

    Returns true, if file is regular.

  • type() const -> file_type

    Get file type.

  • file_status(fd_type fd)explicit

    Construct file status for file descriptor fd.

  • file_status(fd_type dir, const char * filename, path_flag flags = path_flag(0))

    Construct file status for file filename located in directory specified by file descriptor dir.

  • file_status(const char * filename, path_flag flags = path_flag(0))explicit

    Construct file status for file filename.

  • file_status()
Friends
  • operator<<

    Print file status for debugging (the format is similar to ls(1)).

operator<<(std::ostream & out, const file_status & rhs) -> std::ostream &

Print file status for debugging (the format is similar to ls(1)).