docs

你正在阅读 v0.1.2 的文档。Nabi 0.1.2 已不再提供支持。 最新版本:v0.1.3 →

std::os::unix::fs

本页内容

API 参考只有英文版,由标准库源代码中的英文文档注释生成。

the Unix side of the cross-platform fs types: permission bits, the open functions' os records, and openat(2) itself with its O_* flags.

Structs

OsOpenFlagsSource

pub struct OsOpenFlags

Unix knobs of Dir::open / File::open (OpenFlags.os).

  • pub custom_flags: i32 = 0§

    Source

    More O_* flags for open(2): O_NOATIME, O_DIRECT, O_SYNC, O_NONBLOCK, ... The bits the open function decides (access, O_CREAT, O_EXCL, O_TRUNC, O_APPEND, O_DIRECTORY, O_NOFOLLOW) are InvalidInput.

OsCreateFlagsSource

pub struct OsCreateFlags

Unix knobs of the functions that may create the file (CreateFlags.os); the create mode is CreateFlags.permissions.

  • pub custom_flags: i32 = 0§

    Source

    As OsOpenFlags.custom_flags.

Traits

PermissionsExtSource

pub trait PermissionsExt

The Unix permission bits of a Permissions.

  • fn from_mode(mode: u32) -> Self§

    Source

    Permissions with bits mode (0o644; bits past 0o7777 are dropped).

  • fn mode(self) -> u32§

    Source

    The permission bits.

  • fn set_mode(ref self, mode: u32)§

    Source

    Set the bits to mode (as from_mode).

DirExtSource

pub trait DirExt

open(2) as the OS has it, for what the typed functions leave out (truncating an existing file only, O_TMPFILE, O_PATH, ...).

  • fn open_at<P: AsPath>(self, path: P, oflag: i32, mode: u32 = 0o666u32) throws (IoError) -> File§

    Source

    openat(2) under this directory with oflag as given (O_CLOEXEC is always added) and mode for a created file; nothing else is checked. Dir::root() is AT_FDCWD.

Constants

O_RDONLYSource

pub const O_RDONLY: i32 = 0

Open for reading only.

O_WRONLYSource

pub const O_WRONLY: i32 = 1

Open for writing only.

O_RDWRSource

pub const O_RDWR: i32 = 2

Open for reading and writing.

O_ACCMODESource

pub const O_ACCMODE: i32 = 3

The mask of the access mode bits.

O_CREATSource

pub const O_CREAT: i32 = 0x40

Create the file when missing.

O_EXCLSource

pub const O_EXCL: i32 = 0x80

With O_CREAT, fail when the file exists.

O_NOCTTYSource

pub const O_NOCTTY: i32 = 0x100

Do not make a terminal the controlling one.

O_TRUNCSource

pub const O_TRUNC: i32 = 0x200

Empty the file on open.

O_APPENDSource

pub const O_APPEND: i32 = 0x400

Every write goes to the end.

O_NONBLOCKSource

pub const O_NONBLOCK: i32 = 0x800

Non-blocking open and I/O.

O_DSYNCSource

pub const O_DSYNC: i32 = 0x1000

Writes wait for the data to reach the device.

O_SYNCSource

pub const O_SYNC: i32 = 0x101000

Writes wait for data and metadata to reach the device.

O_NOATIMESource

pub const O_NOATIME: i32 = 0x40000

Do not update the access time.

O_CLOEXECSource

pub const O_CLOEXEC: i32 = 0x80000

Close the descriptor on exec.

O_PATHSource

pub const O_PATH: i32 = 0x200000

A descriptor for the path only, no I/O.

O_TMPFILESource

pub const O_TMPFILE: i32 = 0x400000 | O_DIRECTORY

An unnamed temporary file in the directory given.

O_DIRECTORYSource

pub const O_DIRECTORY: i32 = 0x4000

Fail unless the path is a directory.

O_NOFOLLOWSource

pub const O_NOFOLLOW: i32 = 0x8000

Fail when the last component is a symbolic link.

O_DIRECTSource

pub const O_DIRECT: i32 = 0x10000

Bypass the page cache.

O_DIRECTSource

pub const O_DIRECT: i32 = 0x20000

Bypass the page cache.

O_DIRECTORYSource

pub const O_DIRECTORY: i32 = 0x10000

Fail unless the path is a directory.

O_NOFOLLOWSource

pub const O_NOFOLLOW: i32 = 0x20000

Fail when the last component is a symbolic link.

O_DIRECTSource

pub const O_DIRECT: i32 = 0x4000

Bypass the page cache.

O_NONBLOCKSource

pub const O_NONBLOCK: i32 = 0x4

Non-blocking open and I/O.

O_APPENDSource

pub const O_APPEND: i32 = 0x8

Every write goes to the end.

O_SYNCSource

pub const O_SYNC: i32 = 0x80

Writes wait for data and metadata to reach the device.

O_NOFOLLOWSource

pub const O_NOFOLLOW: i32 = 0x100

Fail when the last component is a symbolic link.

O_CREATSource

pub const O_CREAT: i32 = 0x200

Create the file when missing.

O_TRUNCSource

pub const O_TRUNC: i32 = 0x400

Empty the file on open.

O_EXCLSource

pub const O_EXCL: i32 = 0x800

With O_CREAT, fail when the file exists.

O_NOCTTYSource

pub const O_NOCTTY: i32 = 0x20000

Do not make a terminal the controlling one.

O_DIRECTORYSource

pub const O_DIRECTORY: i32 = 0x100000

Fail unless the path is a directory.

O_DSYNCSource

pub const O_DSYNC: i32 = 0x400000

Writes wait for the data to reach the device.

O_CLOEXECSource

pub const O_CLOEXEC: i32 = 0x1000000

Close the descriptor on exec.

O_NOCTTYSource

pub const O_NOCTTY: i32 = 0x8000

Do not make a terminal the controlling one.

O_DIRECTSource

pub const O_DIRECT: i32 = 0x10000

Bypass the page cache.

O_DIRECTORYSource

pub const O_DIRECTORY: i32 = 0x20000

Fail unless the path is a directory.

O_CLOEXECSource

pub const O_CLOEXEC: i32 = 0x100000

Close the descriptor on exec.

O_PATHSource

pub const O_PATH: i32 = 0x400000

A descriptor for the path only, no I/O.

O_DSYNCSource

pub const O_DSYNC: i32 = 0x1000000

Writes wait for the data to reach the device.