c899feb774
Linux's variant uses the syscall as intended. Redox's variant uses fpath to build a path to pass to fstat from the file descriptor plus the file name. Unlike the syscall, this isn't atomic so the liminal space between fpath/getcwd and fstat is subject to TOCTOU. Beyond fstatat, I moved the stat test to its correct location and added an assert since the output of the test is unchecked. I also added AT_FDCWD which seems to be -100 across Unixes. The other AT_* constants are unimplemented for now.
28 lines
863 B
Rust
28 lines
863 B
Rust
use crate::platform::types::*;
|
|
|
|
pub const O_RDONLY: c_int = 0x0000;
|
|
pub const O_WRONLY: c_int = 0x0001;
|
|
pub const O_RDWR: c_int = 0x0002;
|
|
pub const O_ACCMODE: c_int = 0x0003;
|
|
pub const O_CREAT: c_int = 0x0040;
|
|
pub const O_EXCL: c_int = 0x0080;
|
|
pub const O_NOCTTY: c_int = 0x0100;
|
|
pub const O_TRUNC: c_int = 0x0200;
|
|
pub const O_APPEND: c_int = 0x0400;
|
|
pub const O_NONBLOCK: c_int = 0x0800;
|
|
pub const O_DIRECTORY: c_int = 0x1_0000;
|
|
pub const O_NOFOLLOW: c_int = 0x2_0000;
|
|
pub const O_CLOEXEC: c_int = 0x8_0000;
|
|
pub const O_PATH: c_int = 0x20_0000;
|
|
|
|
pub const FD_CLOEXEC: c_int = 0x8_0000;
|
|
|
|
// Defined for compatibility
|
|
pub const O_NDELAY: c_int = O_NONBLOCK;
|
|
|
|
// Flags for capability based "at" functions
|
|
pub const AT_FDCWD: c_int = -100;
|
|
pub const AT_SYMLINK_NOFOLLOW: c_int = 0x100;
|
|
pub const AT_REMOVEDIR: c_int = 0x200;
|
|
pub const AT_EMPTY_PATH: c_int = 0x1000;
|