use num_enum::TryFromPrimitive;
pub const AT_FDCWD: isize = -100;
pub const AT_SYMLINK_NOFOLLOW: u32 = 0x100;
pub const AT_REMOVEDIR: u32 = 0x200;
pub const AT_SYMLINK_FOLLOW: u32 = 0x400;
pub const AT_EACCESS: u32 = 0x200;
#[repr(u32)]
#[derive(Debug, Clone, PartialEq, TryFromPrimitive)]
pub enum FcntlCmd {
DUPFD = 0,
GETFD = 1,
SETFD = 2,
GETFL = 3,
SETFL = 4,
GETLK = 5,
SETLK = 6,
SETLKW = 7,
DUPFDCLOEXEC = 0x406,
}
#[cfg(any(
target_arch = "riscv64",
target_arch = "loongarch64",
target_arch = "x86_64"
))]
bitflags! {
#[derive(Debug, Clone, Copy)]
pub struct OpenFlags: usize {
const RDONLY = 0;
const WRONLY = 1;
const RDWR = 2;
const ACCMODE = 3;
const CREAT = 0o100;
const EXCL = 0o200;
const NOCTTY = 0o400;
const TRUNC = 0o1000;
const APPEND = 0o2000;
const NONBLOCK = 0o4000;
const DSYNC = 0o10000;
const SYNC = 0o4010000;
const RSYNC = 0o4010000;
const DIRECTORY = 0o200000;
const NOFOLLOW = 0o400000;
const CLOEXEC = 0o2000000;
const ASYNC = 0o20000;
const DIRECT = 0o40000;
const LARGEFILE = 0o100000;
const NOATIME = 0o1000000;
const PATH = 0o10000000;
const TMPFILE = 0o20200000;
}
}
#[cfg(target_arch = "aarch64")]
bitflags! {
#[derive(Debug, Clone, Copy)]
pub struct OpenFlags: usize {
const RDONLY = 0;
const WRONLY = 1;
const RDWR = 2;
const ACCMODE = 3;
const CREAT = 0o100;
const EXCL = 0o200;
const NOCTTY = 0o400;
const TRUNC = 0o1000;
const APPEND = 0o2000;
const NONBLOCK = 0o4000;
const DSYNC = 0o10000;
const SYNC = 0o4010000;
const RSYNC = 0o4010000;
const DIRECTORY = 0o40000;
const NOFOLLOW = 0o100000;
const CLOEXEC = 0o2000000;
const ASYNC = 0o20000;
const DIRECT = 0o200000;
const LARGEFILE = 0o400000;
const NOATIME = 0o1000000;
const PATH = 0o10000000;
const TMPFILE = 0o20040000;
}
}