diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/fcntl.rs | 250 | ||||
-rw-r--r-- | src/macros.rs | 6 | ||||
-rw-r--r-- | src/mount.rs | 64 | ||||
-rw-r--r-- | src/sys/memfd.rs | 6 | ||||
-rw-r--r-- | src/sys/mman.rs | 12 | ||||
-rw-r--r-- | src/sys/socket/consts.rs | 40 | ||||
-rw-r--r-- | src/sys/socket/mod.rs | 6 | ||||
-rw-r--r-- | src/sys/stat.rs | 38 | ||||
-rw-r--r-- | src/sys/statvfs.rs | 26 | ||||
-rw-r--r-- | src/sys/termios.rs | 212 |
10 files changed, 330 insertions, 330 deletions
diff --git a/src/fcntl.rs b/src/fcntl.rs index 5d37e500..ee441df8 100644 --- a/src/fcntl.rs +++ b/src/fcntl.rs @@ -33,9 +33,9 @@ libc_bitflags!{ #[cfg(any(target_os = "ios", target_os = "macos"))] bitflags!( - pub flags AtFlags: c_int { + pub struct AtFlags: c_int { // hack because bitflags require one entry - const EMPTY = 0x0 + const EMPTY = 0x0; } ); @@ -213,43 +213,43 @@ mod consts { } bitflags!( - pub flags OFlag: c_int { - const O_ACCMODE = libc::O_ACCMODE, - const O_RDONLY = libc::O_RDONLY, - const O_WRONLY = libc::O_WRONLY, - const O_RDWR = libc::O_RDWR, - const O_CREAT = libc::O_CREAT, - const O_EXCL = libc::O_EXCL, - const O_NOCTTY = libc::O_NOCTTY, - const O_TRUNC = libc::O_TRUNC, - const O_APPEND = libc::O_APPEND, - const O_NONBLOCK = libc::O_NONBLOCK, - const O_DSYNC = libc::O_DSYNC, - const O_DIRECT = libc::O_DIRECT, - const O_LARGEFILE = 0o00100000, - const O_DIRECTORY = libc::O_DIRECTORY, - const O_NOFOLLOW = libc::O_NOFOLLOW, - const O_NOATIME = 0o01000000, - const O_CLOEXEC = libc::O_CLOEXEC, - const O_SYNC = libc::O_SYNC, - const O_PATH = 0o10000000, - const O_TMPFILE = libc::O_TMPFILE, - const O_NDELAY = libc::O_NDELAY, + pub struct OFlag: c_int { + const O_ACCMODE = libc::O_ACCMODE; + const O_RDONLY = libc::O_RDONLY; + const O_WRONLY = libc::O_WRONLY; + const O_RDWR = libc::O_RDWR; + const O_CREAT = libc::O_CREAT; + const O_EXCL = libc::O_EXCL; + const O_NOCTTY = libc::O_NOCTTY; + const O_TRUNC = libc::O_TRUNC; + const O_APPEND = libc::O_APPEND; + const O_NONBLOCK = libc::O_NONBLOCK; + const O_DSYNC = libc::O_DSYNC; + const O_DIRECT = libc::O_DIRECT; + const O_LARGEFILE = 0o00100000; + const O_DIRECTORY = libc::O_DIRECTORY; + const O_NOFOLLOW = libc::O_NOFOLLOW; + const O_NOATIME = 0o01000000; + const O_CLOEXEC = libc::O_CLOEXEC; + const O_SYNC = libc::O_SYNC; + const O_PATH = 0o10000000; + const O_TMPFILE = libc::O_TMPFILE; + const O_NDELAY = libc::O_NDELAY; } ); bitflags!( - pub flags FdFlag: c_int { - const FD_CLOEXEC = 1 + pub struct FdFlag: c_int { + const FD_CLOEXEC = 1; } ); bitflags!( - pub flags SealFlag: c_int { - const F_SEAL_SEAL = 1, - const F_SEAL_SHRINK = 2, - const F_SEAL_GROW = 4, - const F_SEAL_WRITE = 8, + pub struct SealFlag: c_int { + const F_SEAL_SEAL = 1; + const F_SEAL_SHRINK = 2; + const F_SEAL_GROW = 4; + const F_SEAL_WRITE = 8; } ); @@ -260,30 +260,30 @@ mod consts { use libc::{self, c_int}; bitflags!( - pub flags OFlag: c_int { - const O_ACCMODE = libc::O_ACCMODE, - const O_RDONLY = libc::O_RDONLY, - const O_WRONLY = libc::O_WRONLY, - const O_RDWR = libc::O_RDWR, - const O_CREAT = libc::O_CREAT, - const O_EXCL = libc::O_EXCL, - const O_NOCTTY = libc::O_NOCTTY, - const O_TRUNC = libc::O_TRUNC, - const O_APPEND = libc::O_APPEND, - const O_NONBLOCK = libc::O_NONBLOCK, - const O_DSYNC = libc::O_DSYNC, - const O_DIRECTORY = libc::O_DIRECTORY, - const O_NOFOLLOW = libc::O_NOFOLLOW, - const O_CLOEXEC = libc::O_CLOEXEC, - const O_SYNC = libc::O_SYNC, - const O_NDELAY = O_NONBLOCK.bits, - const O_FSYNC = libc::O_FSYNC, + pub struct OFlag: c_int { + const O_ACCMODE = libc::O_ACCMODE; + const O_RDONLY = libc::O_RDONLY; + const O_WRONLY = libc::O_WRONLY; + const O_RDWR = libc::O_RDWR; + const O_CREAT = libc::O_CREAT; + const O_EXCL = libc::O_EXCL; + const O_NOCTTY = libc::O_NOCTTY; + const O_TRUNC = libc::O_TRUNC; + const O_APPEND = libc::O_APPEND; + const O_NONBLOCK = libc::O_NONBLOCK; + const O_DSYNC = libc::O_DSYNC; + const O_DIRECTORY = libc::O_DIRECTORY; + const O_NOFOLLOW = libc::O_NOFOLLOW; + const O_CLOEXEC = libc::O_CLOEXEC; + const O_SYNC = libc::O_SYNC; + const O_NDELAY = O_NONBLOCK.bits; + const O_FSYNC = libc::O_FSYNC; } ); bitflags!( - pub flags FdFlag: c_int { - const FD_CLOEXEC = 1 + pub struct FdFlag: c_int { + const FD_CLOEXEC = 1; } ); } @@ -293,34 +293,34 @@ mod consts { use libc::{self, c_int}; bitflags!( - pub flags OFlag: c_int { - const O_ACCMODE = libc::O_ACCMODE, - const O_RDONLY = libc::O_RDONLY, - const O_WRONLY = libc::O_WRONLY, - const O_RDWR = libc::O_RDWR, - const O_CREAT = libc::O_CREAT, - const O_EXCL = libc::O_EXCL, - const O_NOCTTY = libc::O_NOCTTY, - const O_TRUNC = libc::O_TRUNC, - const O_APPEND = libc::O_APPEND, - const O_NONBLOCK = libc::O_NONBLOCK, - const O_DIRECTORY = 0x0020000, - const O_NOFOLLOW = libc::O_NOFOLLOW, - const O_CLOEXEC = libc::O_CLOEXEC, - const O_SYNC = libc::O_SYNC, - const O_NDELAY = libc::O_NDELAY, - const O_FSYNC = libc::O_FSYNC, - const O_SHLOCK = 0x0000080, - const O_EXLOCK = 0x0000020, - const O_DIRECT = 0x0010000, - const O_EXEC = 0x0040000, - const O_TTY_INIT = 0x0080000 + pub struct OFlag: c_int { + const O_ACCMODE = libc::O_ACCMODE; + const O_RDONLY = libc::O_RDONLY; + const O_WRONLY = libc::O_WRONLY; + const O_RDWR = libc::O_RDWR; + const O_CREAT = libc::O_CREAT; + const O_EXCL = libc::O_EXCL; + const O_NOCTTY = libc::O_NOCTTY; + const O_TRUNC = libc::O_TRUNC; + const O_APPEND = libc::O_APPEND; + const O_NONBLOCK = libc::O_NONBLOCK; + const O_DIRECTORY = 0x0020000; + const O_NOFOLLOW = libc::O_NOFOLLOW; + const O_CLOEXEC = libc::O_CLOEXEC; + const O_SYNC = libc::O_SYNC; + const O_NDELAY = libc::O_NDELAY; + const O_FSYNC = libc::O_FSYNC; + const O_SHLOCK = 0x0000080; + const O_EXLOCK = 0x0000020; + const O_DIRECT = 0x0010000; + const O_EXEC = 0x0040000; + const O_TTY_INIT = 0x0080000; } ); bitflags!( - pub flags FdFlag: c_int { - const FD_CLOEXEC = 1 + pub struct FdFlag: c_int { + const FD_CLOEXEC = 1; } ); } @@ -364,38 +364,38 @@ mod consts { use libc::c_int; bitflags!( - pub flags OFlag: c_int { - const O_ACCMODE = 0x0000003, - const O_RDONLY = 0x0000000, - const O_WRONLY = 0x0000001, - const O_RDWR = 0x0000002, - const O_NONBLOCK = 0x0000004, - const O_APPEND = 0x0000008, - const O_SHLOCK = 0x0000010, - const O_EXLOCK = 0x0000020, - const O_ASYNC = 0x0000040, - const O_SYNC = 0x0000080, - const O_NOFOLLOW = 0x0000100, - const O_CREAT = 0x0000200, - const O_TRUNC = 0x0000400, - const O_EXCL = 0x0000800, - const O_NOCTTY = 0x0008000, - const O_DSYNC = 0x0010000, - const O_RSYNC = 0x0020000, - const O_ALT_IO = 0x0040000, - const O_DIRECT = 0x0080000, - const O_NOSIGPIPE = 0x0100000, - const O_DIRECTORY = 0x0200000, - const O_CLOEXEC = 0x0400000, - const O_SEARCH = 0x0800000, - const O_FSYNC = O_SYNC.bits, - const O_NDELAY = O_NONBLOCK.bits, + pub struct OFlag: c_int { + const O_ACCMODE = 0x0000003; + const O_RDONLY = 0x0000000; + const O_WRONLY = 0x0000001; + const O_RDWR = 0x0000002; + const O_NONBLOCK = 0x0000004; + const O_APPEND = 0x0000008; + const O_SHLOCK = 0x0000010; + const O_EXLOCK = 0x0000020; + const O_ASYNC = 0x0000040; + const O_SYNC = 0x0000080; + const O_NOFOLLOW = 0x0000100; + const O_CREAT = 0x0000200; + const O_TRUNC = 0x0000400; + const O_EXCL = 0x0000800; + const O_NOCTTY = 0x0008000; + const O_DSYNC = 0x0010000; + const O_RSYNC = 0x0020000; + const O_ALT_IO = 0x0040000; + const O_DIRECT = 0x0080000; + const O_NOSIGPIPE = 0x0100000; + const O_DIRECTORY = 0x0200000; + const O_CLOEXEC = 0x0400000; + const O_SEARCH = 0x0800000; + const O_FSYNC = O_SYNC.bits; + const O_NDELAY = O_NONBLOCK.bits; } ); bitflags!( - pub flags FdFlag: c_int { - const FD_CLOEXEC = 1 + pub struct FdFlag: c_int { + const FD_CLOEXEC = 1; } ); } @@ -405,32 +405,32 @@ mod consts { use libc::c_int; bitflags!( - pub flags OFlag: c_int { - const O_ACCMODE = 0x0000003, - const O_RDONLY = 0x0000000, - const O_WRONLY = 0x0000001, - const O_RDWR = 0x0000002, - const O_CREAT = 0x0000200, - const O_EXCL = 0x0000800, - const O_NOCTTY = 0x0008000, - const O_TRUNC = 0x0000400, - const O_APPEND = 0x0000008, - const O_NONBLOCK = 0x0000004, - const O_DIRECTORY = 0x8000000, // different from FreeBSD! - const O_NOFOLLOW = 0x0000100, - const O_CLOEXEC = 0x0020000, // different from FreeBSD! - const O_SYNC = 0x0000080, - const O_NDELAY = O_NONBLOCK.bits, - const O_FSYNC = O_SYNC.bits, - const O_SHLOCK = 0x0000010, // different from FreeBSD! - const O_EXLOCK = 0x0000020, - const O_DIRECT = 0x0010000, + pub struct OFlag: c_int { + const O_ACCMODE = 0x0000003; + const O_RDONLY = 0x0000000; + const O_WRONLY = 0x0000001; + const O_RDWR = 0x0000002; + const O_CREAT = 0x0000200; + const O_EXCL = 0x0000800; + const O_NOCTTY = 0x0008000; + const O_TRUNC = 0x0000400; + const O_APPEND = 0x0000008; + const O_NONBLOCK = 0x0000004; + const O_DIRECTORY = 0x8000000; // different from FreeBSD! + const O_NOFOLLOW = 0x0000100; + const O_CLOEXEC = 0x0020000; // different from FreeBSD! + const O_SYNC = 0x0000080; + const O_NDELAY = O_NONBLOCK.bits; + const O_FSYNC = O_SYNC.bits; + const O_SHLOCK = 0x0000010; // different from FreeBSD! + const O_EXLOCK = 0x0000020; + const O_DIRECT = 0x0010000; } ); bitflags!( - pub flags FdFlag: c_int { - const FD_CLOEXEC = 1 + pub struct FdFlag: c_int { + const FD_CLOEXEC = 1; } ); } diff --git a/src/macros.rs b/src/macros.rs index 9d0613ad..046077f9 100644 --- a/src/macros.rs +++ b/src/macros.rs @@ -49,7 +49,7 @@ macro_rules! libc_bitflags { ) => { bitflags! { $($attrs)* - pub flags $BitFlags: $T { + pub struct $BitFlags: $T { $($flags)* } } @@ -125,7 +125,7 @@ macro_rules! libc_bitflags { $prefix, [ $($flags)* - const $flag = libc::$flag, + const $flag = libc::$flag; ]; } }; @@ -141,7 +141,7 @@ macro_rules! libc_bitflags { $prefix, [ $($flags)* - const $flag = libc::$flag, + const $flag = libc::$flag; ]; $($tail)* } diff --git a/src/mount.rs b/src/mount.rs index a948ff0b..75e918c6 100644 --- a/src/mount.rs +++ b/src/mount.rs @@ -3,38 +3,38 @@ use libc; use {Errno, Result, NixPath}; bitflags!( - pub flags MsFlags: c_ulong { - const MS_RDONLY = libc::MS_RDONLY, // Mount read-only - const MS_NOSUID = libc::MS_NOSUID, // Ignore suid and sgid bits - const MS_NODEV = libc::MS_NODEV, // Disallow access to device special files - const MS_NOEXEC = libc::MS_NOEXEC, // Disallow program execution - const MS_SYNCHRONOUS = libc::MS_SYNCHRONOUS, // Writes are synced at once - const MS_REMOUNT = libc::MS_REMOUNT, // Alter flags of a mounted FS - const MS_MANDLOCK = libc::MS_MANDLOCK, // Allow mandatory locks on a FS - const MS_DIRSYNC = libc::MS_DIRSYNC, // Directory modifications are synchronous - const MS_NOATIME = libc::MS_NOATIME, // Do not update access times - const MS_NODIRATIME = libc::MS_NODIRATIME, // Do not update directory access times - const MS_BIND = libc::MS_BIND, // Linux 2.4.0 - Bind directory at different place - const MS_MOVE = libc::MS_MOVE, - const MS_REC = libc::MS_REC, - const MS_VERBOSE = 1 << 15, // Deprecated - const MS_SILENT = libc::MS_SILENT, - const MS_POSIXACL = libc::MS_POSIXACL, - const MS_UNBINDABLE = libc::MS_UNBINDABLE, - const MS_PRIVATE = libc::MS_PRIVATE, - const MS_SLAVE = libc::MS_SLAVE, - const MS_SHARED = libc::MS_SHARED, - const MS_RELATIME = libc::MS_RELATIME, - const MS_KERNMOUNT = libc::MS_KERNMOUNT, - const MS_I_VERSION = libc::MS_I_VERSION, - const MS_STRICTATIME = libc::MS_STRICTATIME, - const MS_NOSEC = 1 << 28, - const MS_BORN = 1 << 29, - const MS_ACTIVE = libc::MS_ACTIVE, - const MS_NOUSER = libc::MS_NOUSER, - const MS_RMT_MASK = libc::MS_RMT_MASK, - const MS_MGC_VAL = libc::MS_MGC_VAL, - const MS_MGC_MSK = libc::MS_MGC_MSK, + pub struct MsFlags: c_ulong { + const MS_RDONLY = libc::MS_RDONLY; // Mount read-only + const MS_NOSUID = libc::MS_NOSUID; // Ignore suid and sgid bits + const MS_NODEV = libc::MS_NODEV; // Disallow access to device special files + const MS_NOEXEC = libc::MS_NOEXEC; // Disallow program execution + const MS_SYNCHRONOUS = libc::MS_SYNCHRONOUS; // Writes are synced at once + const MS_REMOUNT = libc::MS_REMOUNT; // Alter flags of a mounted FS + const MS_MANDLOCK = libc::MS_MANDLOCK; // Allow mandatory locks on a FS + const MS_DIRSYNC = libc::MS_DIRSYNC; // Directory modifications are synchronous + const MS_NOATIME = libc::MS_NOATIME; // Do not update access times + const MS_NODIRATIME = libc::MS_NODIRATIME; // Do not update directory access times + const MS_BIND = libc::MS_BIND; // Linux 2.4.0 - Bind directory at different place + const MS_MOVE = libc::MS_MOVE; + const MS_REC = libc::MS_REC; + const MS_VERBOSE = 1 << 15; // Deprecated + const MS_SILENT = libc::MS_SILENT; + const MS_POSIXACL = libc::MS_POSIXACL; + const MS_UNBINDABLE = libc::MS_UNBINDABLE; + const MS_PRIVATE = libc::MS_PRIVATE; + const MS_SLAVE = libc::MS_SLAVE; + const MS_SHARED = libc::MS_SHARED; + const MS_RELATIME = libc::MS_RELATIME; + const MS_KERNMOUNT = libc::MS_KERNMOUNT; + const MS_I_VERSION = libc::MS_I_VERSION; + const MS_STRICTATIME = libc::MS_STRICTATIME; + const MS_NOSEC = 1 << 28; + const MS_BORN = 1 << 29; + const MS_ACTIVE = libc::MS_ACTIVE; + const MS_NOUSER = libc::MS_NOUSER; + const MS_RMT_MASK = libc::MS_RMT_MASK; + const MS_MGC_VAL = libc::MS_MGC_VAL; + const MS_MGC_MSK = libc::MS_MGC_MSK; } ); diff --git a/src/sys/memfd.rs b/src/sys/memfd.rs index b0735009..b9812943 100644 --- a/src/sys/memfd.rs +++ b/src/sys/memfd.rs @@ -4,9 +4,9 @@ use {Errno, Result}; use std::ffi::CStr; bitflags!( - pub flags MemFdCreateFlag: libc::c_uint { - const MFD_CLOEXEC = 0x0001, - const MFD_ALLOW_SEALING = 0x0002, + pub struct MemFdCreateFlag: libc::c_uint { + const MFD_CLOEXEC = 0x0001; + const MFD_ALLOW_SEALING = 0x0002; } ); diff --git a/src/sys/mman.rs b/src/sys/mman.rs index 0e97225a..4e422953 100644 --- a/src/sys/mman.rs +++ b/src/sys/mman.rs @@ -161,14 +161,14 @@ mod consts { pub const MADV_SETMAP : MmapAdvise = 11; /* set page table directory page for map */ bitflags!{ - pub flags MsFlags: c_int { - const MS_ASYNC = libc::MS_ASYNC, /* [MF|SIO] return immediately */ - const MS_INVALIDATE = libc::MS_INVALIDATE, /* [MF|SIO] invalidate all cached data */ + pub struct MsFlags: c_int { + const MS_ASYNC = libc::MS_ASYNC; /* [MF|SIO] return immediately */ + const MS_INVALIDATE = libc::MS_INVALIDATE; /* [MF|SIO] invalidate all cached data */ #[cfg(not(target_os = "dragonfly"))] - const MS_KILLPAGES = 0x0004, /* invalidate pages, leave mapped */ + const MS_KILLPAGES = 0x0004; /* invalidate pages, leave mapped */ #[cfg(not(target_os = "dragonfly"))] - const MS_DEACTIVATE = 0x0004, /* deactivate pages, leave mapped */ - const MS_SYNC = libc::MS_SYNC, /* [MF|SIO] msync synchronously */ + const MS_DEACTIVATE = 0x0004; /* deactivate pages, leave mapped */ + const MS_SYNC = libc::MS_SYNC; /* [MF|SIO] msync synchronously */ } } diff --git a/src/sys/socket/consts.rs b/src/sys/socket/consts.rs index 54213ef1..44b4a564 100644 --- a/src/sys/socket/consts.rs +++ b/src/sys/socket/consts.rs @@ -93,15 +93,15 @@ mod os { // Flags for send/recv and their relatives bitflags!{ - pub flags MsgFlags: libc::c_int { - const MSG_OOB = 0x0001, - const MSG_PEEK = 0x0002, - const MSG_CTRUNC = 0x0008, - const MSG_TRUNC = 0x0020, - const MSG_DONTWAIT = 0x0040, - const MSG_EOR = 0x0080, - const MSG_ERRQUEUE = 0x2000, - const MSG_CMSG_CLOEXEC = 0x40000000, + pub struct MsgFlags: libc::c_int { + const MSG_OOB = 0x0001; + const MSG_PEEK = 0x0002; + const MSG_CTRUNC = 0x0008; + const MSG_TRUNC = 0x0020; + const MSG_DONTWAIT = 0x0040; + const MSG_EOR = 0x0080; + const MSG_ERRQUEUE = 0x2000; + const MSG_CMSG_CLOEXEC = 0x40000000; } } @@ -235,13 +235,13 @@ mod os { // Flags for send/recv and their relatives bitflags!{ - pub flags MsgFlags: libc::c_int { - const MSG_OOB = 0x01, - const MSG_PEEK = 0x02, - const MSG_EOR = 0x08, - const MSG_TRUNC = 0x10, - const MSG_CTRUNC = 0x20, - const MSG_DONTWAIT = 0x80, + pub struct MsgFlags: libc::c_int { + const MSG_OOB = 0x01; + const MSG_PEEK = 0x02; + const MSG_EOR = 0x08; + const MSG_TRUNC = 0x10; + const MSG_CTRUNC = 0x20; + const MSG_DONTWAIT = 0x80; } } @@ -321,10 +321,10 @@ mod os { // Flags for send/recv and their relatives bitflags!{ - pub flags MsgFlags: libc::c_int { - const MSG_OOB = 0x01, - const MSG_PEEK = 0x02, - const MSG_DONTWAIT = 0x80, + pub struct MsgFlags: libc::c_int { + const MSG_OOB = 0x01; + const MSG_PEEK = 0x02; + const MSG_DONTWAIT = 0x80; } } diff --git a/src/sys/socket/mod.rs b/src/sys/socket/mod.rs index 69b05d71..73cab9d5 100644 --- a/src/sys/socket/mod.rs +++ b/src/sys/socket/mod.rs @@ -64,9 +64,9 @@ pub enum SockType { // Extra flags - Supported by Linux 2.6.27, normalized on other platforms bitflags!( - pub flags SockFlag: c_int { - const SOCK_NONBLOCK = 0o0004000, - const SOCK_CLOEXEC = 0o2000000 + pub struct SockFlag: c_int { + const SOCK_NONBLOCK = 0o0004000; + const SOCK_CLOEXEC = 0o2000000; } ); diff --git a/src/sys/stat.rs b/src/sys/stat.rs index 054aedc1..f51d9bb8 100644 --- a/src/sys/stat.rs +++ b/src/sys/stat.rs @@ -31,25 +31,25 @@ libc_bitflags!( ); bitflags! { - pub flags Mode: mode_t { - const S_IRWXU = libc::S_IRWXU, - const S_IRUSR = libc::S_IRUSR, - const S_IWUSR = libc::S_IWUSR, - const S_IXUSR = libc::S_IXUSR, - - const S_IRWXG = libc::S_IRWXG, - const S_IRGRP = libc::S_IRGRP, - const S_IWGRP = libc::S_IWGRP, - const S_IXGRP = libc::S_IXGRP, - - const S_IRWXO = libc::S_IRWXO, - const S_IROTH = libc::S_IROTH, - const S_IWOTH = libc::S_IWOTH, - const S_IXOTH = libc::S_IXOTH, - - const S_ISUID = libc::S_ISUID as mode_t, - const S_ISGID = libc::S_ISGID as mode_t, - const S_ISVTX = libc::S_ISVTX as mode_t, + pub struct Mode: mode_t { + const S_IRWXU = libc::S_IRWXU; + const S_IRUSR = libc::S_IRUSR; + const S_IWUSR = libc::S_IWUSR; + const S_IXUSR = libc::S_IXUSR; + + const S_IRWXG = libc::S_IRWXG; + const S_IRGRP = libc::S_IRGRP; + const S_IWGRP = libc::S_IWGRP; + const S_IXGRP = libc::S_IXGRP; + + const S_IRWXO = libc::S_IRWXO; + const S_IROTH = libc::S_IROTH; + const S_IWOTH = libc::S_IWOTH; + const S_IXOTH = libc::S_IXOTH; + + const S_ISUID = libc::S_ISUID as mode_t; + const S_ISGID = libc::S_ISGID as mode_t; + const S_ISVTX = libc::S_ISVTX as mode_t; } } diff --git a/src/sys/statvfs.rs b/src/sys/statvfs.rs index 21067bd6..e45863f8 100644 --- a/src/sys/statvfs.rs +++ b/src/sys/statvfs.rs @@ -21,28 +21,28 @@ pub mod vfs { /// Mount Flags #[repr(C)] #[derive(Default)] - pub flags FsFlags: c_ulong { + pub struct FsFlags: c_ulong { /// Read Only - const RDONLY = 1, + const RDONLY = 1; /// Do not allow the set-uid bits to have an effect - const NOSUID = 2, + const NOSUID = 2; /// Do not interpret character or block-special devices - const NODEV = 4, + const NODEV = 4; /// Do not allow execution of binaries on the filesystem - const NOEXEC = 8, + const NOEXEC = 8; /// All IO should be done synchronously - const SYNCHRONOUS = 16, + const SYNCHRONOUS = 16; /// Allow mandatory locks on the filesystem - const MANDLOCK = 64, - const WRITE = 128, - const APPEND = 256, - const IMMUTABLE = 512, + const MANDLOCK = 64; + const WRITE = 128; + const APPEND = 256; + const IMMUTABLE = 512; /// Do not update access times on files - const NOATIME = 1024, + const NOATIME = 1024; /// Do not update access times on files - const NODIRATIME = 2048, + const NODIRATIME = 2048; /// Update access time relative to modify/change time - const RELATIME = 4096, + const RELATIME = 4096; } ); diff --git a/src/sys/termios.rs b/src/sys/termios.rs index 126d149c..65e7c01c 100644 --- a/src/sys/termios.rs +++ b/src/sys/termios.rs @@ -215,77 +215,77 @@ mod ffi { pub const NCCS: usize = 20; bitflags! { - pub flags InputFlags: tcflag_t { - const IGNBRK = 0x00000001, - const BRKINT = 0x00000002, - const IGNPAR = 0x00000004, - const PARMRK = 0x00000008, - const INPCK = 0x00000010, - const ISTRIP = 0x00000020, - const INLCR = 0x00000040, - const IGNCR = 0x00000080, - const ICRNL = 0x00000100, - const IXON = 0x00000200, - const IXOFF = 0x00000400, - const IXANY = 0x00000800, - const IMAXBEL = 0x00002000, + pub struct InputFlags: tcflag_t { + const IGNBRK = 0x00000001; + const BRKINT = 0x00000002; + const IGNPAR = 0x00000004; + const PARMRK = 0x00000008; + const INPCK = 0x00000010; + const ISTRIP = 0x00000020; + const INLCR = 0x00000040; + const IGNCR = 0x00000080; + const ICRNL = 0x00000100; + const IXON = 0x00000200; + const IXOFF = 0x00000400; + const IXANY = 0x00000800; + const IMAXBEL = 0x00002000; #[cfg(not(target_os = "dragonfly"))] - const IUTF8 = 0x00004000, + const IUTF8 = 0x00004000; } } bitflags! { - pub flags OutputFlags: tcflag_t { - const OPOST = 0x00000001, - const ONLCR = 0x00000002, - const OXTABS = 0x00000004, - const ONOEOT = 0x00000008, + pub struct OutputFlags: tcflag_t { + const OPOST = 0x00000001; + const ONLCR = 0x00000002; + const OXTABS = 0x00000004; + const ONOEOT = 0x00000008; } } bitflags! { - pub flags ControlFlags: tcflag_t { - const CIGNORE = 0x00000001, - const CSIZE = 0x00000300, - const CS5 = 0x00000000, - const CS6 = 0x00000100, - const CS7 = 0x00000200, - const CS8 = 0x00000300, - const CSTOPB = 0x00000400, - const CREAD = 0x00000800, - const PARENB = 0x00001000, - const PARODD = 0x00002000, - const HUPCL = 0x00004000, - const CLOCAL = 0x00008000, - const CCTS_OFLOW = 0x00010000, - const CRTSCTS = 0x00030000, - const CRTS_IFLOW = 0x00020000, - const CDTR_IFLOW = 0x00040000, - const CDSR_OFLOW = 0x00080000, - const CCAR_OFLOW = 0x00100000, - const MDMBUF = 0x00100000, + pub struct ControlFlags: tcflag_t { + const CIGNORE = 0x00000001; + const CSIZE = 0x00000300; + const CS5 = 0x00000000; + const CS6 = 0x00000100; + const CS7 = 0x00000200; + const CS8 = 0x00000300; + const CSTOPB = 0x00000400; + const CREAD = 0x00000800; + const PARENB = 0x00001000; + const PARODD = 0x00002000; + const HUPCL = 0x00004000; + const CLOCAL = 0x00008000; + const CCTS_OFLOW = 0x00010000; + const CRTSCTS = 0x00030000; + const CRTS_IFLOW = 0x00020000; + const CDTR_IFLOW = 0x00040000; + const CDSR_OFLOW = 0x00080000; + const CCAR_OFLOW = 0x00100000; + const MDMBUF = 0x00100000; } } bitflags! { - pub flags LocalFlags: tcflag_t { - const ECHOKE = 0x00000001, - const ECHOE = 0x00000002, - const ECHOK = 0x00000004, - const ECHO = 0x00000008, - const ECHONL = 0x00000010, - const ECHOPRT = 0x00000020, - const ECHOCTL = 0x00000040, - const ISIG = 0x00000080, - const ICANON = 0x00000100, - const ALTWERASE = 0x00000200, - const IEXTEN = 0x00000400, - const EXTPROC = 0x00000800, - const TOSTOP = 0x00400000, - const FLUSHO = 0x00800000, - const NOKERNINFO = 0x02000000, - const PENDIN = 0x20000000, - const NOFLSH = 0x80000000, + pub struct LocalFlags: tcflag_t { + const ECHOKE = 0x00000001; + const ECHOE = 0x00000002; + const ECHOK = 0x00000004; + const ECHO = 0x00000008; + const ECHONL = 0x00000010; + const ECHOPRT = 0x00000020; + const ECHOCTL = 0x00000040; + const ISIG = 0x00000080; + const ICANON = 0x00000100; + const ALTWERASE = 0x00000200; + const IEXTEN = 0x00000400; + const EXTPROC = 0x00000800; + const TOSTOP = 0x00400000; + const FLUSHO = 0x00800000; + const NOKERNINFO = 0x02000000; + const PENDIN = 0x20000000; + const NOFLSH = 0x80000000; } } @@ -465,67 +465,67 @@ mod ffi { pub const NCCS: usize = 32; bitflags! { - pub flags InputFlags: tcflag_t { - const IGNBRK = 0x00000001, - const BRKINT = 0x00000002, - const IGNPAR = 0x00000004, - const PARMRK = 0x00000008, - const INPCK = 0x00000010, - const ISTRIP = 0x00000020, - const INLCR = 0x00000040, - const IGNCR = 0x00000080, - const ICRNL = 0x00000100, - const IXON = 0x00000400, - const IXOFF = 0x00001000, - const IXANY = 0x00000800, - const IMAXBEL = 0x00002000, - const IUTF8 = 0x00004000, + pub struct InputFlags: tcflag_t { + const IGNBRK = 0x00000001; + const BRKINT = 0x00000002; + const IGNPAR = 0x00000004; + const PARMRK = 0x00000008; + const INPCK = 0x00000010; + const ISTRIP = 0x00000020; + const INLCR = 0x00000040; + const IGNCR = 0x00000080; + const ICRNL = 0x00000100; + const IXON = 0x00000400; + const IXOFF = 0x00001000; + const IXANY = 0x00000800; + const IMAXBEL = 0x00002000; + const IUTF8 = 0x00004000; } } bitflags! { - pub flags OutputFlags: tcflag_t { - const OPOST = 0x00000001, - const ONLCR = 0x00000004, + pub struct OutputFlags: tcflag_t { + const OPOST = 0x00000001; + const ONLCR = 0x00000004; } } bitflags! { - pub flags ControlFlags: tcflag_t { - const CSIZE = 0x00000030, - const CS5 = 0x00000000, - const CS6 = 0x00000010, - const CS7 = 0x00000020, - const CS8 = 0x00000030, - const CSTOPB = 0x00000040, - const CREAD = 0x00000080, - const PARENB = 0x00000100, - const PARODD = 0x00000200, - const HUPCL = 0x00000400, - const CLOCAL = 0x00000800, - const CRTSCTS = 0x80000000, + pub struct ControlFlags: tcflag_t { + const CSIZE = 0x00000030; + const CS5 = 0x00000000; + const CS6 = 0x00000010; + const CS7 = 0x00000020; + const CS8 = 0x00000030; + const CSTOPB = 0x00000040; + const CREAD = 0x00000080; + const PARENB = 0x00000100; + const PARODD = 0x00000200; + const HUPCL = 0x00000400; + const CLOCAL = 0x00000800; + const CRTSCTS = 0x80000000; #[cfg(target_os = "android")] - const CBAUD = 0o0010017, + const CBAUD = 0o0010017; } } bitflags! { - pub flags LocalFlags: tcflag_t { - const ECHOKE = 0x00000800, - const ECHOE = 0x00000010, - const ECHOK = 0x00000020, - const ECHO = 0x00000008, - const ECHONL = 0x00000040, - const ECHOPRT = 0x00000400, - const ECHOCTL = 0x00000200, - const ISIG = 0x00000001, - const ICANON = 0x00000002, - const IEXTEN = 0x00008000, - const EXTPROC = 0x00010000, - const TOSTOP = 0x00000100, - const FLUSHO = 0x00001000, - const PENDIN = 0x00004000, - const NOFLSH = 0x00000080, + pub struct LocalFlags: tcflag_t { + const ECHOKE = 0x00000800; + const ECHOE = 0x00000010; + const ECHOK = 0x00000020; + const ECHO = 0x00000008; + const ECHONL = 0x00000040; + const ECHOPRT = 0x00000400; + const ECHOCTL = 0x00000200; + const ISIG = 0x00000001; + const ICANON = 0x00000002; + const IEXTEN = 0x00008000; + const EXTPROC = 0x00010000; + const TOSTOP = 0x00000100; + const FLUSHO = 0x00001000; + const PENDIN = 0x00004000; + const NOFLSH = 0x00000080; } } |