diff options
Diffstat (limited to 'src/sys')
-rw-r--r-- | src/sys/epoll.rs | 34 | ||||
-rw-r--r-- | src/sys/event.rs | 82 | ||||
-rw-r--r-- | src/sys/mman.rs | 94 | ||||
-rw-r--r-- | src/sys/quota.rs | 24 | ||||
-rw-r--r-- | src/sys/signal.rs | 16 | ||||
-rw-r--r-- | src/sys/signalfd.rs | 6 | ||||
-rw-r--r-- | src/sys/stat.rs | 18 | ||||
-rw-r--r-- | src/sys/wait.rs | 24 |
8 files changed, 149 insertions, 149 deletions
diff --git a/src/sys/epoll.rs b/src/sys/epoll.rs index 62ad4319..54e2eead 100644 --- a/src/sys/epoll.rs +++ b/src/sys/epoll.rs @@ -7,22 +7,22 @@ use ::Error; bitflags!( #[repr(C)] - pub flags EpollFlags: u32 { - const EPOLLIN = 0x001, - const EPOLLPRI = 0x002, - const EPOLLOUT = 0x004, - const EPOLLRDNORM = 0x040, - const EPOLLRDBAND = 0x080, - const EPOLLWRNORM = 0x100, - const EPOLLWRBAND = 0x200, - const EPOLLMSG = 0x400, - const EPOLLERR = 0x008, - const EPOLLHUP = 0x010, - const EPOLLRDHUP = 0x2000, + pub flags EpollFlags: libc::c_int { + const EPOLLIN = libc::EPOLLIN, + const EPOLLPRI = libc::EPOLLPRI, + const EPOLLOUT = libc::EPOLLOUT, + const EPOLLRDNORM = libc::EPOLLRDNORM, + const EPOLLRDBAND = libc::EPOLLRDBAND, + const EPOLLWRNORM = libc::EPOLLWRNORM, + const EPOLLWRBAND = libc::EPOLLWRBAND, + const EPOLLMSG = libc::EPOLLMSG, + const EPOLLERR = libc::EPOLLERR, + const EPOLLHUP = libc::EPOLLHUP, + const EPOLLRDHUP = libc::EPOLLRDHUP, const EPOLLEXCLUSIVE = 1 << 28, - const EPOLLWAKEUP = 1 << 29, - const EPOLLONESHOT = 1 << 30, - const EPOLLET = 1 << 31 + const EPOLLWAKEUP = libc::EPOLLWAKEUP, + const EPOLLONESHOT = libc::EPOLLONESHOT, + const EPOLLET = libc::EPOLLET, } ); @@ -48,7 +48,7 @@ pub struct EpollEvent { impl EpollEvent { pub fn new(events: EpollFlags, data: u64) -> Self { - EpollEvent { event: libc::epoll_event { events: events.bits(), u64: data } } + EpollEvent { event: libc::epoll_event { events: events.bits() as u32, u64: data } } } pub fn empty() -> Self { @@ -56,7 +56,7 @@ impl EpollEvent { } pub fn events(&self) -> EpollFlags { - EpollFlags::from_bits(self.event.events).unwrap() + EpollFlags::from_bits(self.event.events as libc::c_int).unwrap() } pub fn data(&self) -> u64 { diff --git a/src/sys/event.rs b/src/sys/event.rs index f1ba1f4c..3e2a6d43 100644 --- a/src/sys/event.rs +++ b/src/sys/event.rs @@ -105,93 +105,93 @@ libc_bitflags!{ } } -bitflags!( +libc_bitflags!( pub flags FilterFlag: u32 { #[cfg(any(target_os = "macos", target_os = "ios"))] - const NOTE_ABSOLUTE = libc::NOTE_ABSOLUTE, - const NOTE_ATTRIB = libc::NOTE_ATTRIB, - const NOTE_CHILD = libc::NOTE_CHILD, - const NOTE_DELETE = libc::NOTE_DELETE, + NOTE_ABSOLUTE, + NOTE_ATTRIB, + NOTE_CHILD, + NOTE_DELETE, #[cfg(target_os = "openbsd")] - const NOTE_EOF = libc::NOTE_EOF, - const NOTE_EXEC = libc::NOTE_EXEC, - const NOTE_EXIT = libc::NOTE_EXIT, + NOTE_EOF, + NOTE_EXEC, + NOTE_EXIT, #[cfg(any(target_os = "macos", target_os = "ios"))] - const NOTE_EXIT_REPARENTED = libc::NOTE_EXIT_REPARENTED, + NOTE_EXIT_REPARENTED, #[cfg(any(target_os = "macos", target_os = "ios"))] - const NOTE_EXITSTATUS = libc::NOTE_EXITSTATUS, - const NOTE_EXTEND = libc::NOTE_EXTEND, + NOTE_EXITSTATUS, + NOTE_EXTEND, #[cfg(any(target_os = "macos", target_os = "ios", target_os = "freebsd", target_os = "dragonfly"))] - const NOTE_FFAND = libc::NOTE_FFAND, + NOTE_FFAND, #[cfg(any(target_os = "macos", target_os = "ios", target_os = "freebsd", target_os = "dragonfly"))] - const NOTE_FFCOPY = libc::NOTE_FFCOPY, + NOTE_FFCOPY, #[cfg(any(target_os = "macos", target_os = "ios", target_os = "freebsd", target_os = "dragonfly"))] - const NOTE_FFCTRLMASK = libc::NOTE_FFCTRLMASK, + NOTE_FFCTRLMASK, #[cfg(any(target_os = "macos", target_os = "ios", target_os = "freebsd", target_os = "dragonfly"))] - const NOTE_FFLAGSMASK = libc::NOTE_FFLAGSMASK, + NOTE_FFLAGSMASK, #[cfg(any(target_os = "macos", target_os = "ios", target_os = "freebsd", target_os = "dragonfly"))] - const NOTE_FFNOP = libc::NOTE_FFNOP, + NOTE_FFNOP, #[cfg(any(target_os = "macos", target_os = "ios", target_os = "freebsd", target_os = "dragonfly"))] - const NOTE_FFOR = libc::NOTE_FFOR, - const NOTE_FORK = libc::NOTE_FORK, - const NOTE_LINK = libc::NOTE_LINK, - const NOTE_LOWAT = libc::NOTE_LOWAT, + NOTE_FFOR, + NOTE_FORK, + NOTE_LINK, + NOTE_LOWAT, #[cfg(target_os = "freebsd")] - const NOTE_MSECONDS = libc::NOTE_MSECONDS, + NOTE_MSECONDS, #[cfg(any(target_os = "macos", target_os = "ios"))] - const NOTE_NONE = libc::NOTE_NONE, + NOTE_NONE, #[cfg(any(target_os = "macos", target_os = "ios", target_os = "freebsd"))] - const NOTE_NSECONDS = libc::NOTE_NSECONDS, + NOTE_NSECONDS, #[cfg(target_os = "dragonfly")] - const NOTE_OOB = libc::NOTE_OOB, - const NOTE_PCTRLMASK = libc::NOTE_PCTRLMASK, - const NOTE_PDATAMASK = libc::NOTE_PDATAMASK, + NOTE_OOB, + NOTE_PCTRLMASK, + NOTE_PDATAMASK, #[cfg(any(target_os = "macos", target_os = "ios"))] - const NOTE_REAP = libc::NOTE_REAP, - const NOTE_RENAME = libc::NOTE_RENAME, - const NOTE_REVOKE = libc::NOTE_REVOKE, + NOTE_REAP, + NOTE_RENAME, + NOTE_REVOKE, #[cfg(any(target_os = "macos", target_os = "ios", target_os = "freebsd"))] - const NOTE_SECONDS = libc::NOTE_SECONDS, + NOTE_SECONDS, #[cfg(any(target_os = "macos", target_os = "ios"))] - const NOTE_SIGNAL = libc::NOTE_SIGNAL, - const NOTE_TRACK = libc::NOTE_TRACK, - const NOTE_TRACKERR = libc::NOTE_TRACKERR, + NOTE_SIGNAL, + NOTE_TRACK, + NOTE_TRACKERR, #[cfg(any(target_os = "macos", target_os = "ios", target_os = "freebsd", target_os = "dragonfly"))] - const NOTE_TRIGGER = libc::NOTE_TRIGGER, + NOTE_TRIGGER, #[cfg(target_os = "openbsd")] - const NOTE_TRUNCATE = libc::NOTE_TRUNCATE, + NOTE_TRUNCATE, #[cfg(any(target_os = "macos", target_os = "ios", target_os = "freebsd"))] - const NOTE_USECONDS = libc::NOTE_USECONDS, + NOTE_USECONDS, #[cfg(any(target_os = "macos", target_os = "ios"))] - const NOTE_VM_ERROR = libc::NOTE_VM_ERROR, + NOTE_VM_ERROR, #[cfg(any(target_os = "macos", target_os = "ios"))] - const NOTE_VM_PRESSURE = libc::NOTE_VM_PRESSURE, + NOTE_VM_PRESSURE, #[cfg(any(target_os = "macos", target_os = "ios"))] - const NOTE_VM_PRESSURE_SUDDEN_TERMINATE = libc::NOTE_VM_PRESSURE_SUDDEN_TERMINATE, + NOTE_VM_PRESSURE_SUDDEN_TERMINATE, #[cfg(any(target_os = "macos", target_os = "ios"))] - const NOTE_VM_PRESSURE_TERMINATE = libc::NOTE_VM_PRESSURE_TERMINATE, - const NOTE_WRITE = libc::NOTE_WRITE, + NOTE_VM_PRESSURE_TERMINATE, + NOTE_WRITE, } ); diff --git a/src/sys/mman.rs b/src/sys/mman.rs index d0099541..c1d45b6b 100644 --- a/src/sys/mman.rs +++ b/src/sys/mman.rs @@ -23,25 +23,25 @@ libc_bitflags!{ mod consts { use libc::{self, c_int}; - bitflags!{ + libc_bitflags!{ pub flags MapFlags: c_int { - const MAP_FILE = libc::MAP_FILE, - const MAP_SHARED = libc::MAP_SHARED, - const MAP_PRIVATE = libc::MAP_PRIVATE, - const MAP_FIXED = libc::MAP_FIXED, - const MAP_ANON = libc::MAP_ANON, - const MAP_ANONYMOUS = libc::MAP_ANON, + MAP_FILE, + MAP_SHARED, + MAP_PRIVATE, + MAP_FIXED, + MAP_ANON, + MAP_ANONYMOUS, #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] - const MAP_32BIT = libc::MAP_32BIT, - const MAP_GROWSDOWN = libc::MAP_GROWSDOWN, - const MAP_DENYWRITE = libc::MAP_DENYWRITE, - const MAP_EXECUTABLE = libc::MAP_EXECUTABLE, - const MAP_LOCKED = libc::MAP_LOCKED, - const MAP_NORESERVE = libc::MAP_NORESERVE, - const MAP_POPULATE = libc::MAP_POPULATE, - const MAP_NONBLOCK = libc::MAP_NONBLOCK, - const MAP_STACK = libc::MAP_STACK, - const MAP_HUGETLB = libc::MAP_HUGETLB, + MAP_32BIT, + MAP_GROWSDOWN, + MAP_DENYWRITE, + MAP_EXECUTABLE, + MAP_LOCKED, + MAP_NORESERVE, + MAP_POPULATE, + MAP_NONBLOCK, + MAP_STACK, + MAP_HUGETLB, } } @@ -64,11 +64,11 @@ mod consts { pub const MADV_HWPOISON : MmapAdvise = 100; /* Poison a page for testing. */ - bitflags!{ + libc_bitflags!{ pub flags MsFlags: c_int { - const MS_ASYNC = libc::MS_ASYNC, - const MS_INVALIDATE = libc::MS_INVALIDATE, - const MS_SYNC = libc::MS_SYNC, + MS_ASYNC, + MS_INVALIDATE, + MS_SYNC, } } @@ -80,15 +80,15 @@ mod consts { mod consts { use libc::{self, c_int}; - bitflags!{ + libc_bitflags!{ pub flags MapFlags: c_int { - const MAP_FILE = libc::MAP_FILE, - const MAP_SHARED = libc::MAP_SHARED, - const MAP_PRIVATE = libc::MAP_PRIVATE, - const MAP_FIXED = libc::MAP_FIXED, - const MAP_ANON = libc::MAP_ANON, - const MAP_NOCACHE = libc::MAP_NOCACHE, - const MAP_JIT = libc::MAP_JIT, + MAP_FILE, + MAP_SHARED, + MAP_PRIVATE, + MAP_FIXED, + MAP_ANON, + MAP_NOCACHE, + MAP_JIT, } } @@ -105,13 +105,13 @@ mod consts { pub const MADV_FREE_REUSE : MmapAdvise = 8; /* caller wants to reuse those pages */ pub const MADV_CAN_REUSE : MmapAdvise = 9; - bitflags!{ + libc_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 */ - const MS_KILLPAGES = libc::MS_KILLPAGES, /* invalidate pages, leave mapped */ - const MS_DEACTIVATE = libc::MS_DEACTIVATE, /* deactivate pages, leave mapped */ - const MS_SYNC = libc::MS_SYNC, /* [MF|SIO] msync synchronously */ + MS_ASYNC, /* [MF|SIO] return immediately */ + MS_INVALIDATE, /* [MF|SIO] invalidate all cached data */ + MS_KILLPAGES, /* invalidate pages, leave mapped */ + MS_DEACTIVATE, /* deactivate pages, leave mapped */ + MS_SYNC, /* [MF|SIO] msync synchronously */ } } @@ -122,22 +122,22 @@ mod consts { mod consts { use libc::{self, c_int}; - bitflags!{ + libc_bitflags!{ pub flags MapFlags: c_int { - const MAP_FILE = libc::MAP_FILE, - const MAP_SHARED = libc::MAP_SHARED, - const MAP_PRIVATE = libc::MAP_PRIVATE, - const MAP_FIXED = libc::MAP_FIXED, - const MAP_RENAME = libc::MAP_RENAME, - const MAP_NORESERVE = libc::MAP_NORESERVE, - const MAP_HASSEMAPHORE = libc::MAP_HASSEMAPHORE, + MAP_FILE, + MAP_SHARED, + MAP_PRIVATE, + MAP_FIXED, + MAP_RENAME, + MAP_NORESERVE, + MAP_HASSEMAPHORE, #[cfg(not(any(target_os = "openbsd", target_os = "netbsd")))] - const MAP_STACK = libc::MAP_STACK, + MAP_STACK, #[cfg(target_os = "netbsd")] - const MAP_WIRED = libc::MAP_WIRED, + MAP_WIRED, #[cfg(any(target_os = "freebsd", target_os = "dragonfly"))] - const MAP_NOSYNC = libc::MAP_NOSYNC, - const MAP_ANON = libc::MAP_ANON, + MAP_NOSYNC, + MAP_ANON, } } diff --git a/src/sys/quota.rs b/src/sys/quota.rs index 321156ec..b66d558d 100644 --- a/src/sys/quota.rs +++ b/src/sys/quota.rs @@ -7,7 +7,7 @@ use libc::{c_int, c_char}; target_arch = "arm")), )] pub mod quota { - use libc::c_int; + use libc::{self, c_int}; pub struct QuotaCmd(pub QuotaSubCmd, pub QuotaType); pub type QuotaSubCmd = c_int; @@ -39,19 +39,19 @@ pub mod quota { pub const QFMT_VFS_V0: QuotaFmt = 2; pub const QFMT_VFS_V1: QuotaFmt = 4; - bitflags!( + libc_bitflags!( #[derive(Default)] pub flags QuotaValidFlags: u32 { - const QIF_BLIMITS = 1, - const QIF_SPACE = 2, - const QIF_ILIMITS = 4, - const QIF_INODES = 8, - const QIF_BTIME = 16, - const QIF_ITIME = 32, - const QIF_LIMITS = QIF_BLIMITS.bits | QIF_ILIMITS.bits, - const QIF_USAGE = QIF_SPACE.bits | QIF_INODES.bits, - const QIF_TIMES = QIF_BTIME.bits | QIF_ITIME.bits, - const QIF_ALL = QIF_LIMITS.bits | QIF_USAGE.bits | QIF_TIMES.bits + QIF_BLIMITS, + QIF_SPACE, + QIF_ILIMITS, + QIF_INODES, + QIF_BTIME, + QIF_ITIME, + QIF_LIMITS, + QIF_USAGE, + QIF_TIMES, + QIF_ALL, } ); diff --git a/src/sys/signal.rs b/src/sys/signal.rs index 208a5ccc..a82722dd 100644 --- a/src/sys/signal.rs +++ b/src/sys/signal.rs @@ -196,15 +196,15 @@ pub const SIGIOT : Signal = SIGABRT; pub const SIGPOLL : Signal = SIGIO; pub const SIGUNUSED : Signal = SIGSYS; -bitflags!{ +libc_bitflags!{ pub flags SaFlags: libc::c_int { - const SA_NOCLDSTOP = libc::SA_NOCLDSTOP, - const SA_NOCLDWAIT = libc::SA_NOCLDWAIT, - const SA_NODEFER = libc::SA_NODEFER, - const SA_ONSTACK = libc::SA_ONSTACK, - const SA_RESETHAND = libc::SA_RESETHAND, - const SA_RESTART = libc::SA_RESTART, - const SA_SIGINFO = libc::SA_SIGINFO, + SA_NOCLDSTOP, + SA_NOCLDWAIT, + SA_NODEFER, + SA_ONSTACK, + SA_RESETHAND, + SA_RESTART, + SA_SIGINFO, } } diff --git a/src/sys/signalfd.rs b/src/sys/signalfd.rs index e11a0b9a..a3dfb6be 100644 --- a/src/sys/signalfd.rs +++ b/src/sys/signalfd.rs @@ -25,10 +25,10 @@ use std::os::unix::io::{RawFd, AsRawFd}; use std::mem; -bitflags!{ +libc_bitflags!{ pub flags SfdFlags: libc::c_int { - const SFD_NONBLOCK = libc::SFD_NONBLOCK, - const SFD_CLOEXEC = libc::SFD_CLOEXEC, + SFD_NONBLOCK, + SFD_CLOEXEC, } } diff --git a/src/sys/stat.rs b/src/sys/stat.rs index 4bb4927a..1ff35923 100644 --- a/src/sys/stat.rs +++ b/src/sys/stat.rs @@ -16,16 +16,16 @@ mod ffi { } } -bitflags!( +libc_bitflags!( pub flags SFlag: mode_t { - const S_IFIFO = libc::S_IFIFO, - const S_IFCHR = libc::S_IFCHR, - const S_IFDIR = libc::S_IFDIR, - const S_IFBLK = libc::S_IFBLK, - const S_IFREG = libc::S_IFREG, - const S_IFLNK = libc::S_IFLNK, - const S_IFSOCK = libc::S_IFSOCK, - const S_IFMT = libc::S_IFMT, + S_IFIFO, + S_IFCHR, + S_IFDIR, + S_IFBLK, + S_IFREG, + S_IFLNK, + S_IFSOCK, + S_IFMT, } ); diff --git a/src/sys/wait.rs b/src/sys/wait.rs index bd3e6187..35b94790 100644 --- a/src/sys/wait.rs +++ b/src/sys/wait.rs @@ -13,25 +13,25 @@ mod ffi { #[cfg(not(any(target_os = "linux", target_os = "android")))] -bitflags!( +libc_bitflags!( pub flags WaitPidFlag: c_int { - const WNOHANG = libc::WNOHANG, - const WUNTRACED = libc::WUNTRACED, + WNOHANG, + WUNTRACED, } ); #[cfg(any(target_os = "linux", target_os = "android"))] -bitflags!( +libc_bitflags!( pub flags WaitPidFlag: c_int { - const WNOHANG = libc::WNOHANG, - const WUNTRACED = libc::WUNTRACED, - const WEXITED = libc::WEXITED, - const WCONTINUED = libc::WCONTINUED, - const WNOWAIT = libc::WNOWAIT, // Don't reap, just poll status. - const __WNOTHREAD = libc::__WNOTHREAD, // Don't wait on children of other threads in this group - const __WALL = libc::__WALL, // Wait on all children, regardless of type - const __WCLONE = libc::__WCLONE, + WNOHANG, + WUNTRACED, + WEXITED, + WCONTINUED, + WNOWAIT, // Don't reap, just poll status. + __WNOTHREAD, // Don't wait on children of other threads in this group + __WALL, // Wait on all children, regardless of type + __WCLONE, } ); |