diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/errno.rs | 12 | ||||
-rw-r--r-- | src/fcntl.rs | 116 | ||||
-rw-r--r-- | src/mount.rs | 68 | ||||
-rw-r--r-- | src/sys/epoll.rs | 28 | ||||
-rw-r--r-- | src/sys/event.rs | 114 | ||||
-rw-r--r-- | src/sys/eventfd.rs | 6 | ||||
-rw-r--r-- | src/sys/socket.rs | 184 | ||||
-rw-r--r-- | src/sys/stat.rs | 12 | ||||
-rw-r--r-- | src/sys/utsname.rs | 2 | ||||
-rw-r--r-- | src/sys/wait.rs | 2 |
10 files changed, 272 insertions, 272 deletions
diff --git a/src/errno.rs b/src/errno.rs index e49adfe5..0bdfaabf 100644 --- a/src/errno.rs +++ b/src/errno.rs @@ -555,8 +555,8 @@ mod consts { EHWPOISON = 133, } - pub static EWOULDBLOCK: Errno = EAGAIN; - pub static EDEADLOCK: Errno = EDEADLK; + pub const EWOULDBLOCK: Errno = EAGAIN; + pub const EDEADLOCK: Errno = EDEADLK; } #[cfg(any(target_os = "macos", target_os = "ios"))] @@ -672,9 +672,9 @@ mod consts { EQFULL = 106, } - pub static ELAST: Errno = EQFULL; - pub static EWOULDBLOCK: Errno = EAGAIN; - pub static EDEADLOCK: Errno = EDEADLK; + pub const ELAST: Errno = EQFULL; + pub const EWOULDBLOCK: Errno = EAGAIN; + pub const EDEADLOCK: Errno = EDEADLK; - pub static EL2NSYNC: Errno = UnknownErrno; + pub const EL2NSYNC: Errno = UnknownErrno; } diff --git a/src/fcntl.rs b/src/fcntl.rs index 68cc610b..efd09500 100644 --- a/src/fcntl.rs +++ b/src/fcntl.rs @@ -29,15 +29,15 @@ mod ffi { pub l_sysid: c_int, } - pub static F_DUPFD: c_int = 0; - pub static F_DUPFD_CLOEXEC: c_int = 1030; - pub static F_GETFD: c_int = 1; - pub static F_SETFD: c_int = 2; - pub static F_GETFL: c_int = 3; - pub static F_SETFL: c_int = 4; - pub static F_SETLK: c_int = 6; - pub static F_SETLKW: c_int = 7; - pub static F_GETLK: c_int = 5; + pub const F_DUPFD: c_int = 0; + pub const F_DUPFD_CLOEXEC: c_int = 1030; + pub const F_GETFD: c_int = 1; + pub const F_SETFD: c_int = 2; + pub const F_GETFL: c_int = 3; + pub const F_SETFL: c_int = 4; + pub const F_SETLK: c_int = 6; + pub const F_SETLKW: c_int = 7; + pub const F_GETLK: c_int = 5; } #[cfg(any(target_os = "macos", target_os = "ios"))] @@ -56,15 +56,15 @@ mod ffi { pub l_sysid: c_int, } - pub static F_DUPFD: c_int = 0; - pub static F_DUPFD_CLOEXEC: c_int = 67; - pub static F_GETFD: c_int = 1; - pub static F_SETFD: c_int = 2; - pub static F_GETFL: c_int = 3; - pub static F_SETFL: c_int = 4; - pub static F_SETLK: c_int = 8; - pub static F_SETLKW: c_int = 9; - pub static F_GETLK: c_int = 7; + pub const F_DUPFD: c_int = 0; + pub const F_DUPFD_CLOEXEC: c_int = 67; + pub const F_GETFD: c_int = 1; + pub const F_SETFD: c_int = 2; + pub const F_GETFL: c_int = 3; + pub const F_SETFL: c_int = 4; + pub const F_SETLK: c_int = 8; + pub const F_SETLKW: c_int = 9; + pub const F_GETLK: c_int = 7; } } @@ -121,33 +121,33 @@ mod consts { bitflags!( flags OFlag: c_int { - static O_ACCMODE = 0o00000003, - static O_RDONLY = 0o00000000, - static O_WRONLY = 0o00000001, - static O_RDWR = 0o00000002, - static O_CREAT = 0o00000100, - static O_EXCL = 0o00000200, - static O_NOCTTY = 0o00000400, - static O_TRUNC = 0o00001000, - static O_APPEND = 0o00002000, - static O_NONBLOCK = 0o00004000, - static O_DSYNC = 0o00010000, - static O_DIRECT = 0o00040000, - static O_LARGEFILE = 0o00100000, - static O_DIRECTORY = 0o00200000, - static O_NOFOLLOW = 0o00400000, - static O_NOATIME = 0o01000000, - static O_CLOEXEC = 0o02000000, - static O_SYNC = 0o04000000, - static O_PATH = 0o10000000, - static O_TMPFILE = 0o20000000, - static O_NDELAY = O_NONBLOCK.bits + const O_ACCMODE = 0o00000003, + const O_RDONLY = 0o00000000, + const O_WRONLY = 0o00000001, + const O_RDWR = 0o00000002, + const O_CREAT = 0o00000100, + const O_EXCL = 0o00000200, + const O_NOCTTY = 0o00000400, + const O_TRUNC = 0o00001000, + const O_APPEND = 0o00002000, + const O_NONBLOCK = 0o00004000, + const O_DSYNC = 0o00010000, + const O_DIRECT = 0o00040000, + const O_LARGEFILE = 0o00100000, + const O_DIRECTORY = 0o00200000, + const O_NOFOLLOW = 0o00400000, + const O_NOATIME = 0o01000000, + const O_CLOEXEC = 0o02000000, + const O_SYNC = 0o04000000, + const O_PATH = 0o10000000, + const O_TMPFILE = 0o20000000, + const O_NDELAY = O_NONBLOCK.bits } ) bitflags!( flags FdFlag: c_int { - static FD_CLOEXEC = 1 + const FD_CLOEXEC = 1 } ) } @@ -158,29 +158,29 @@ mod consts { bitflags!( flags OFlag: c_int { - static O_ACCMODE = 0x0000003, - static O_RDONLY = 0x0000000, - static O_WRONLY = 0x0000001, - static O_RDWR = 0x0000002, - static O_CREAT = 0x0000200, - static O_EXCL = 0x0000800, - static O_NOCTTY = 0x0020000, - static O_TRUNC = 0x0000400, - static O_APPEND = 0x0000008, - static O_NONBLOCK = 0x0000004, - static O_DSYNC = 0x0400000, - static O_DIRECTORY = 0x0100000, - static O_NOFOLLOW = 0x0000100, - static O_CLOEXEC = 0x1000000, - static O_SYNC = 0x0000080, - static O_NDELAY = O_NONBLOCK.bits, - static O_FSYNC = O_SYNC.bits + 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 = 0x0020000, + const O_TRUNC = 0x0000400, + const O_APPEND = 0x0000008, + const O_NONBLOCK = 0x0000004, + const O_DSYNC = 0x0400000, + const O_DIRECTORY = 0x0100000, + const O_NOFOLLOW = 0x0000100, + const O_CLOEXEC = 0x1000000, + const O_SYNC = 0x0000080, + const O_NDELAY = O_NONBLOCK.bits, + const O_FSYNC = O_SYNC.bits } ) bitflags!( flags FdFlag: c_int { - static FD_CLOEXEC = 1 + const FD_CLOEXEC = 1 } ) } diff --git a/src/mount.rs b/src/mount.rs index 5256b4d1..325a503c 100644 --- a/src/mount.rs +++ b/src/mount.rs @@ -5,48 +5,48 @@ use errno::{SysResult, from_ffi}; bitflags!( flags MsFlags: c_ulong { - static MS_RDONLY = 1 << 0, // Mount read-only - static MS_NOSUID = 1 << 1, // Ignore suid and sgid bits - static MS_NODEV = 1 << 2, // Disallow access to device special files - static MS_NOEXEC = 1 << 3, // Disallow program execution - static MS_SYNCHRONOUS = 1 << 4, // Writes are synced at once - static MS_REMOUNT = 1 << 5, // Alter flags of a mounted FS - static MS_MANDLOCK = 1 << 6, // Allow mandatory locks on a FS - static MS_DIRSYNC = 1 << 7, // Directory modifications are synchronous - static MS_NOATIME = 1 << 10, // Do not update access times - static MS_NODIRATIME = 1 << 11, // Do not update directory access times - static MS_BIND = 1 << 12, // Linux 2.4.0 - Bind directory at different place - static MS_MOVE = 1 << 13, - static MS_REC = 1 << 14, - static MS_VERBOSE = 1 << 15, // Deprecated - static MS_SILENT = 1 << 15, - static MS_POSIXACL = 1 << 16, - static MS_UNBINDABLE = 1 << 17, - static MS_PRIVATE = 1 << 18, - static MS_SLAVE = 1 << 19, - static MS_SHARED = 1 << 20, - static MS_RELATIME = 1 << 21, - static MS_KERNMOUNT = 1 << 22, - static MS_I_VERSION = 1 << 23, - static MS_STRICTATIME = 1 << 24, - static MS_NOSEC = 1 << 28, - static MS_BORN = 1 << 29, - static MS_ACTIVE = 1 << 30, - static MS_NOUSER = 1 << 31, - static MS_RMT_MASK = MS_RDONLY.bits + const MS_RDONLY = 1 << 0, // Mount read-only + const MS_NOSUID = 1 << 1, // Ignore suid and sgid bits + const MS_NODEV = 1 << 2, // Disallow access to device special files + const MS_NOEXEC = 1 << 3, // Disallow program execution + const MS_SYNCHRONOUS = 1 << 4, // Writes are synced at once + const MS_REMOUNT = 1 << 5, // Alter flags of a mounted FS + const MS_MANDLOCK = 1 << 6, // Allow mandatory locks on a FS + const MS_DIRSYNC = 1 << 7, // Directory modifications are synchronous + const MS_NOATIME = 1 << 10, // Do not update access times + const MS_NODIRATIME = 1 << 11, // Do not update directory access times + const MS_BIND = 1 << 12, // Linux 2.4.0 - Bind directory at different place + const MS_MOVE = 1 << 13, + const MS_REC = 1 << 14, + const MS_VERBOSE = 1 << 15, // Deprecated + const MS_SILENT = 1 << 15, + const MS_POSIXACL = 1 << 16, + const MS_UNBINDABLE = 1 << 17, + const MS_PRIVATE = 1 << 18, + const MS_SLAVE = 1 << 19, + const MS_SHARED = 1 << 20, + const MS_RELATIME = 1 << 21, + const MS_KERNMOUNT = 1 << 22, + const MS_I_VERSION = 1 << 23, + const MS_STRICTATIME = 1 << 24, + const MS_NOSEC = 1 << 28, + const MS_BORN = 1 << 29, + const MS_ACTIVE = 1 << 30, + const MS_NOUSER = 1 << 31, + const MS_RMT_MASK = MS_RDONLY.bits | MS_SYNCHRONOUS.bits | MS_MANDLOCK.bits | MS_I_VERSION.bits, - static MS_MGC_VAL = 0xC0ED0000, - static MS_MGC_MSK = 0xffff0000 + const MS_MGC_VAL = 0xC0ED0000, + const MS_MGC_MSK = 0xffff0000 } ) bitflags!( flags MntFlags: c_int { - static MNT_FORCE = 1 << 0, - static MNT_DETATCH = 1 << 1, - static MNT_EXPIRE = 1 << 2 + const MNT_FORCE = 1 << 0, + const MNT_DETATCH = 1 << 1, + const MNT_EXPIRE = 1 << 2 } ) diff --git a/src/sys/epoll.rs b/src/sys/epoll.rs index a9edb39c..db01f291 100644 --- a/src/sys/epoll.rs +++ b/src/sys/epoll.rs @@ -16,20 +16,20 @@ mod ffi { bitflags!( flags EpollEventKind: u32 { - static EPOLLIN = 0x001, - static EPOLLPRI = 0x002, - static EPOLLOUT = 0x004, - static EPOLLRDNORM = 0x040, - static EPOLLRDBAND = 0x080, - static EPOLLWRNORM = 0x100, - static EPOLLWRBAND = 0x200, - static EPOLLMSG = 0x400, - static EPOLLERR = 0x008, - static EPOLLHUP = 0x010, - static EPOLLRDHUP = 0x2000, - static EPOLLWAKEUP = 1 << 29, - static EPOLLONESHOT = 1 << 30, - static EPOLLET = 1 << 31 + 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, + const EPOLLWAKEUP = 1 << 29, + const EPOLLONESHOT = 1 << 30, + const EPOLLET = 1 << 31 } ) diff --git a/src/sys/event.rs b/src/sys/event.rs index ae57cec9..4c6e64a8 100644 --- a/src/sys/event.rs +++ b/src/sys/event.rs @@ -53,71 +53,71 @@ pub enum EventFilter { bitflags!( flags EventFlag: u16 { - static EV_ADD = 0x0001, - static EV_DELETE = 0x0002, - static EV_ENABLE = 0x0004, - static EV_DISABLE = 0x0008, - static EV_RECEIPT = 0x0040, - static EV_ONESHOT = 0x0010, - static EV_CLEAR = 0x0020, - static EV_DISPATCH = 0x0080, - static EV_SYSFLAGS = 0xF000, - static EV_FLAG0 = 0x1000, - static EV_FLAG1 = 0x2000, - static EV_EOF = 0x8000, - static EV_ERROR = 0x4000 + const EV_ADD = 0x0001, + const EV_DELETE = 0x0002, + const EV_ENABLE = 0x0004, + const EV_DISABLE = 0x0008, + const EV_RECEIPT = 0x0040, + const EV_ONESHOT = 0x0010, + const EV_CLEAR = 0x0020, + const EV_DISPATCH = 0x0080, + const EV_SYSFLAGS = 0xF000, + const EV_FLAG0 = 0x1000, + const EV_FLAG1 = 0x2000, + const EV_EOF = 0x8000, + const EV_ERROR = 0x4000 } ) bitflags!( flags FilterFlag: u32 { - static NOTE_TRIGGER = 0x01000000, - static NOTE_FFNOP = 0x00000000, - static NOTE_FFAND = 0x40000000, - static NOTE_FFOR = 0x80000000, - static NOTE_FFCOPY = 0xc0000000, - static NOTE_FFCTRLMASK = 0xc0000000, - static NOTE_FFLAGSMASK = 0x00ffffff, - static NOTE_LOWAT = 0x00000001, - static NOTE_DELETE = 0x00000001, - static NOTE_WRITE = 0x00000002, - static NOTE_EXTEND = 0x00000004, - static NOTE_ATTRIB = 0x00000008, - static NOTE_LINK = 0x00000010, - static NOTE_RENAME = 0x00000020, - static NOTE_REVOKE = 0x00000040, - static NOTE_NONE = 0x00000080, - static NOTE_EXIT = 0x80000000, - static NOTE_FORK = 0x40000000, - static NOTE_EXEC = 0x20000000, - static NOTE_REAP = 0x10000000, - static NOTE_SIGNAL = 0x08000000, - static NOTE_EXITSTATUS = 0x04000000, - static NOTE_RESOURCEEND = 0x02000000, - static NOTE_APPACTIVE = 0x00800000, - static NOTE_APPBACKGROUND = 0x00400000, - static NOTE_APPNONUI = 0x00200000, - static NOTE_APPINACTIVE = 0x00100000, - static NOTE_APPALLSTATES = 0x00f00000, - static NOTE_PDATAMASK = 0x000fffff, - static NOTE_PCTRLMASK = 0xfff00000, - static NOTE_EXIT_REPARENTED = 0x00080000, - static NOTE_VM_PRESSURE = 0x80000000, - static NOTE_VM_PRESSURE_TERMINATE = 0x40000000, - static NOTE_VM_PRESSURE_SUDDEN_TERMINATE = 0x20000000, - static NOTE_VM_ERROR = 0x10000000, - static NOTE_SECONDS = 0x00000001, - static NOTE_USECONDS = 0x00000002, - static NOTE_NSECONDS = 0x00000004, - static NOTE_ABSOLUTE = 0x00000008, - static NOTE_TRACK = 0x00000001, - static NOTE_TRACKERR = 0x00000002, - static NOTE_CHILD = 0x00000004 + const NOTE_TRIGGER = 0x01000000, + const NOTE_FFNOP = 0x00000000, + const NOTE_FFAND = 0x40000000, + const NOTE_FFOR = 0x80000000, + const NOTE_FFCOPY = 0xc0000000, + const NOTE_FFCTRLMASK = 0xc0000000, + const NOTE_FFLAGSMASK = 0x00ffffff, + const NOTE_LOWAT = 0x00000001, + const NOTE_DELETE = 0x00000001, + const NOTE_WRITE = 0x00000002, + const NOTE_EXTEND = 0x00000004, + const NOTE_ATTRIB = 0x00000008, + const NOTE_LINK = 0x00000010, + const NOTE_RENAME = 0x00000020, + const NOTE_REVOKE = 0x00000040, + const NOTE_NONE = 0x00000080, + const NOTE_EXIT = 0x80000000, + const NOTE_FORK = 0x40000000, + const NOTE_EXEC = 0x20000000, + const NOTE_REAP = 0x10000000, + const NOTE_SIGNAL = 0x08000000, + const NOTE_EXITSTATUS = 0x04000000, + const NOTE_RESOURCEEND = 0x02000000, + const NOTE_APPACTIVE = 0x00800000, + const NOTE_APPBACKGROUND = 0x00400000, + const NOTE_APPNONUI = 0x00200000, + const NOTE_APPINACTIVE = 0x00100000, + const NOTE_APPALLSTATES = 0x00f00000, + const NOTE_PDATAMASK = 0x000fffff, + const NOTE_PCTRLMASK = 0xfff00000, + const NOTE_EXIT_REPARENTED = 0x00080000, + const NOTE_VM_PRESSURE = 0x80000000, + const NOTE_VM_PRESSURE_TERMINATE = 0x40000000, + const NOTE_VM_PRESSURE_SUDDEN_TERMINATE = 0x20000000, + const NOTE_VM_ERROR = 0x10000000, + const NOTE_SECONDS = 0x00000001, + const NOTE_USECONDS = 0x00000002, + const NOTE_NSECONDS = 0x00000004, + const NOTE_ABSOLUTE = 0x00000008, + const NOTE_TRACK = 0x00000001, + const NOTE_TRACKERR = 0x00000002, + const NOTE_CHILD = 0x00000004 } ) -pub static EV_POLL: EventFlag = EV_FLAG0; -pub static EV_OOBAND: EventFlag = EV_FLAG1; +pub const EV_POLL: EventFlag = EV_FLAG0; +pub const EV_OOBAND: EventFlag = EV_FLAG1; pub fn kqueue() -> SysResult<Fd> { let res = unsafe { ffi::kqueue() }; diff --git a/src/sys/eventfd.rs b/src/sys/eventfd.rs index a60dcd6e..06cb0a92 100644 --- a/src/sys/eventfd.rs +++ b/src/sys/eventfd.rs @@ -5,9 +5,9 @@ use errno::{SysResult, SysError}; bitflags!( flags EventFdFlag: c_int { - static EFD_CLOEXEC = 0o2000000, // Since Linux 2.6.27 - static EFD_NONBLOCK = 0o0004000, // Since Linux 2.6.27 - static EFD_SEMAPHORE = 0o0000001, // Since Linux 2.6.30 + const EFD_CLOEXEC = 0o2000000, // Since Linux 2.6.27 + const EFD_NONBLOCK = 0o0004000, // Since Linux 2.6.27 + const EFD_SEMAPHORE = 0o0000001, // Since Linux 2.6.30 } ) diff --git a/src/sys/socket.rs b/src/sys/socket.rs index ed78c54f..4885795e 100644 --- a/src/sys/socket.rs +++ b/src/sys/socket.rs @@ -25,8 +25,8 @@ mod ffi { // Extra flags - Supported by Linux 2.6.27, normalized on other platforms bitflags!( flags SockFlag: c_int { - static SOCK_NONBLOCK = 0o0004000, - static SOCK_CLOEXEC = 0o2000000 + const SOCK_NONBLOCK = 0o0004000, + const SOCK_CLOEXEC = 0o2000000 } ) @@ -42,59 +42,59 @@ mod consts { pub type AddressFamily = c_int; - pub static AF_UNIX: AddressFamily = 1; - pub static AF_LOCAL: AddressFamily = AF_UNIX; - pub static AF_INET: AddressFamily = 2; - pub static AF_INET6: AddressFamily = 10; + pub const AF_UNIX: AddressFamily = 1; + pub const AF_LOCAL: AddressFamily = AF_UNIX; + pub const AF_INET: AddressFamily = 2; + pub const AF_INET6: AddressFamily = 10; pub type SockType = c_int; - pub static SOCK_STREAM: SockType = 1; - pub static SOCK_DGRAM: SockType = 2; - pub static SOCK_SEQPACKET: SockType = 5; - pub static SOCK_RAW: SockType = 3; - pub static SOCK_RDM: SockType = 4; + pub const SOCK_STREAM: SockType = 1; + pub const SOCK_DGRAM: SockType = 2; + pub const SOCK_SEQPACKET: SockType = 5; + pub const SOCK_RAW: SockType = 3; + pub const SOCK_RDM: SockType = 4; pub type SockLevel = c_int; - pub static SOL_IP: SockLevel = 0; - pub static SOL_SOCKET: SockLevel = 1; - pub static SOL_TCP: SockLevel = 6; - pub static SOL_UDP: SockLevel = 17; - pub static SOL_IPV6: SockLevel = 41; + pub const SOL_IP: SockLevel = 0; + pub const SOL_SOCKET: SockLevel = 1; + pub const SOL_TCP: SockLevel = 6; + pub const SOL_UDP: SockLevel = 17; + pub const SOL_IPV6: SockLevel = 41; pub type SockOpt = c_int; - pub static SO_ACCEPTCONN: SockOpt = 30; - pub static SO_BINDTODEVICE: SockOpt = 25; - pub static SO_BROADCAST: SockOpt = 6; - pub static SO_BSDCOMPAT: SockOpt = 14; - pub static SO_DEBUG: SockOpt = 1; - pub static SO_DOMAIN: SockOpt = 39; - pub static SO_ERROR: SockOpt = 4; - pub static SO_DONTROUTE: SockOpt = 5; - pub static SO_KEEPALIVE: SockOpt = 9; - pub static SO_LINGER: SockOpt = 13; - pub static SO_MARK: SockOpt = 36; - pub static SO_OOBINLINE: SockOpt = 10; - pub static SO_PASSCRED: SockOpt = 16; - pub static SO_PEEK_OFF: SockOpt = 42; - pub static SO_PEERCRED: SockOpt = 17; - pub static SO_PRIORITY: SockOpt = 12; - pub static SO_PROTOCOL: SockOpt = 38; - pub static SO_RCVBUF: SockOpt = 8; - pub static SO_RCVBUFFORCE: SockOpt = 33; - pub static SO_RCVLOWAT: SockOpt = 18; - pub static SO_SNDLOWAT: SockOpt = 19; - pub static SO_RCVTIMEO: SockOpt = 20; - pub static SO_SNDTIMEO: SockOpt = 21; - pub static SO_REUSEADDR: SockOpt = 2; - pub static SO_RXQ_OVFL: SockOpt = 40; - pub static SO_SNDBUF: SockOpt = 7; - pub static SO_SNDBUFFORCE: SockOpt = 32; - pub static SO_TIMESTAMP: SockOpt = 29; - pub static SO_TYPE: SockOpt = 3; - pub static SO_BUSY_POLL: SockOpt = 46; + pub const SO_ACCEPTCONN: SockOpt = 30; + pub const SO_BINDTODEVICE: SockOpt = 25; + pub const SO_BROADCAST: SockOpt = 6; + pub const SO_BSDCOMPAT: SockOpt = 14; + pub const SO_DEBUG: SockOpt = 1; + pub const SO_DOMAIN: SockOpt = 39; + pub const SO_ERROR: SockOpt = 4; + pub const SO_DONTROUTE: SockOpt = 5; + pub const SO_KEEPALIVE: SockOpt = 9; + pub const SO_LINGER: SockOpt = 13; + pub const SO_MARK: SockOpt = 36; + pub const SO_OOBINLINE: SockOpt = 10; + pub const SO_PASSCRED: SockOpt = 16; + pub const SO_PEEK_OFF: SockOpt = 42; + pub const SO_PEERCRED: SockOpt = 17; + pub const SO_PRIORITY: SockOpt = 12; + pub const SO_PROTOCOL: SockOpt = 38; + pub const SO_RCVBUF: SockOpt = 8; + pub const SO_RCVBUFFORCE: SockOpt = 33; + pub const SO_RCVLOWAT: SockOpt = 18; + pub const SO_SNDLOWAT: SockOpt = 19; + pub const SO_RCVTIMEO: SockOpt = 20; + pub const SO_SNDTIMEO: SockOpt = 21; + pub const SO_REUSEADDR: SockOpt = 2; + pub const SO_RXQ_OVFL: SockOpt = 40; + pub const SO_SNDBUF: SockOpt = 7; + pub const SO_SNDBUFFORCE: SockOpt = 32; + pub const SO_TIMESTAMP: SockOpt = 29; + pub const SO_TYPE: SockOpt = 3; + pub const SO_BUSY_POLL: SockOpt = 46; } #[cfg(any(target_os = "macos", target_os = "ios"))] @@ -103,62 +103,62 @@ mod consts { pub type AddressFamily = c_int; - pub static AF_UNIX: AddressFamily = 1; - pub static AF_LOCAL: AddressFamily = AF_UNIX; - pub static AF_INET: AddressFamily = 2; - pub static AF_INET6: AddressFamily = 30; + pub const AF_UNIX: AddressFamily = 1; + pub const AF_LOCAL: AddressFamily = AF_UNIX; + pub const AF_INET: AddressFamily = 2; + pub const AF_INET6: AddressFamily = 30; pub type SockType = c_int; - pub static SOCK_STREAM: SockType = 1; - pub static SOCK_DGRAM: SockType = 2; - pub static SOCK_SEQPACKET: SockType = 5; - pub static SOCK_RAW: SockType = 3; - pub static SOCK_RDM: SockType = 4; + pub const SOCK_STREAM: SockType = 1; + pub const SOCK_DGRAM: SockType = 2; + pub const SOCK_SEQPACKET: SockType = 5; + pub const SOCK_RAW: SockType = 3; + pub const SOCK_RDM: SockType = 4; pub type SockLevel = c_int; - pub static SOL_SOCKET: SockLevel = 0xffff; + pub const SOL_SOCKET: SockLevel = 0xffff; pub type SockOpt = c_int; - pub static SO_ACCEPTCONN: SockOpt = 0x0002; - pub static SO_BROADCAST: SockOpt = 0x0020; - pub static SO_DEBUG: SockOpt = 0x0001; - pub static SO_DONTTRUNC: SockOpt = 0x2000; - pub static SO_ERROR: SockOpt = 0x1007; - pub static SO_DONTROUTE: SockOpt = 0x0010; - pub static SO_KEEPALIVE: SockOpt = 0x0008; - pub static SO_LABEL: SockOpt = 0x1010; - pub static SO_LINGER: SockOpt = 0x0080; - pub static SO_NREAD: SockOpt = 0x1020; - pub static SO_NKE: SockOpt = 0x1021; - pub static SO_NOSIGPIPE: SockOpt = 0x1022; - pub static SO_NOADDRERR: SockOpt = 0x1023; - pub static SO_NOTIFYCONFLICT: SockOpt = 0x1026; - pub static SO_NP_EXTENSIONS: SockOpt = 0x1083; - pub static SO_NWRITE: SockOpt = 0x1024; - pub static SO_OOBINLINE: SockOpt = 0x0100; - pub static SO_PEERLABEL: SockOpt = 0x1011; - pub static SO_RCVBUF: SockOpt = 0x1002; - pub static SO_RCVLOWAT: SockOpt = 0x1004; - pub static SO_SNDLOWAT: SockOpt = 0x1003; - pub static SO_RCVTIMEO: SockOpt = 0x1006; - pub static SO_SNDTIMEO: SockOpt = 0x1005; - pub static SO_RANDOMPORT: SockOpt = 0x1082; - pub static SO_RESTRICTIONS: SockOpt = 0x1081; - pub static SO_RESTRICT_DENYIN: SockOpt = 0x00000001; - pub static SO_RESTRICT_DENYOUT: SockOpt = 0x00000002; - pub static SO_REUSEADDR: SockOpt = 0x0004; - pub static SO_REUSESHAREUID: SockOpt = 0x1025; - pub static SO_SNDBUF: SockOpt = 0x1001; - pub static SO_TIMESTAMP: SockOpt = 0x0400; - pub static SO_TIMESTAMP_MONOTONIC: SockOpt = 0x0800; - pub static SO_TYPE: SockOpt = 0x1008; - pub static SO_WANTMORE: SockOpt = 0x4000; - pub static SO_WANTOOBFLAG: SockOpt = 0x8000; + pub const SO_ACCEPTCONN: SockOpt = 0x0002; + pub const SO_BROADCAST: SockOpt = 0x0020; + pub const SO_DEBUG: SockOpt = 0x0001; + pub const SO_DONTTRUNC: SockOpt = 0x2000; + pub const SO_ERROR: SockOpt = 0x1007; + pub const SO_DONTROUTE: SockOpt = 0x0010; + pub const SO_KEEPALIVE: SockOpt = 0x0008; + pub const SO_LABEL: SockOpt = 0x1010; + pub const SO_LINGER: SockOpt = 0x0080; + pub const SO_NREAD: SockOpt = 0x1020; + pub const SO_NKE: SockOpt = 0x1021; + pub const SO_NOSIGPIPE: SockOpt = 0x1022; + pub const SO_NOADDRERR: SockOpt = 0x1023; + pub const SO_NOTIFYCONFLICT: SockOpt = 0x1026; + pub const SO_NP_EXTENSIONS: SockOpt = 0x1083; + pub const SO_NWRITE: SockOpt = 0x1024; + pub const SO_OOBINLINE: SockOpt = 0x0100; + pub const SO_PEERLABEL: SockOpt = 0x1011; + pub const SO_RCVBUF: SockOpt = 0x1002; + pub const SO_RCVLOWAT: SockOpt = 0x1004; + pub const SO_SNDLOWAT: SockOpt = 0x1003; + pub const SO_RCVTIMEO: SockOpt = 0x1006; + pub const SO_SNDTIMEO: SockOpt = 0x1005; + pub const SO_RANDOMPORT: SockOpt = 0x1082; + pub const SO_RESTRICTIONS: SockOpt = 0x1081; + pub const SO_RESTRICT_DENYIN: SockOpt = 0x00000001; + pub const SO_RESTRICT_DENYOUT: SockOpt = 0x00000002; + pub const SO_REUSEADDR: SockOpt = 0x0004; + pub const SO_REUSESHAREUID: SockOpt = 0x1025; + pub const SO_SNDBUF: SockOpt = 0x1001; + pub const SO_TIMESTAMP: SockOpt = 0x0400; + pub const SO_TIMESTAMP_MONOTONIC: SockOpt = 0x0800; + pub const SO_TYPE: SockOpt = 0x1008; + pub const SO_WANTMORE: SockOpt = 0x4000; + pub const SO_WANTOOBFLAG: SockOpt = 0x8000; #[allow(type_overflow)] - pub static SO_RESTRICT_DENYSET: SockOpt = 0x80000000; + pub const SO_RESTRICT_DENYSET: SockOpt = 0x80000000; } pub fn socket(domain: AddressFamily, mut ty: SockType, flags: SockFlag) -> SysResult<Fd> { diff --git a/src/sys/stat.rs b/src/sys/stat.rs index 2f2737d4..e5ecde61 100644 --- a/src/sys/stat.rs +++ b/src/sys/stat.rs @@ -21,11 +21,11 @@ mod ffi { bitflags!( flags SFlag: mode_t { - static S_IFREG = 0o100000, - static S_IFCHR = 0o020000, - static S_IFBLK = 0o060000, - static S_IFIFO = 0o010000, - static S_IFSOCK = 0o140000 + const S_IFREG = 0o100000, + const S_IFCHR = 0o020000, + const S_IFBLK = 0o060000, + const S_IFIFO = 0o010000, + const S_IFSOCK = 0o140000 } ) @@ -41,7 +41,7 @@ pub fn mknod(path: &Path, kind: SFlag, perm: FilePermission, dev: dev_t) -> SysR } #[cfg(target_os = "linux")] -static MINORBITS: uint = 20; +const MINORBITS: uint = 20; #[cfg(target_os = "linux")] pub fn mkdev(major: u64, minor: u64) -> dev_t { diff --git a/src/sys/utsname.rs b/src/sys/utsname.rs index d676b29f..2540c57a 100644 --- a/src/sys/utsname.rs +++ b/src/sys/utsname.rs @@ -12,7 +12,7 @@ mod ffi { } -static UTSNAME_LEN: uint = 65; +const UTSNAME_LEN: uint = 65; #[repr(C)] pub struct UtsName { diff --git a/src/sys/wait.rs b/src/sys/wait.rs index f5d8aaf7..6f232bff 100644 --- a/src/sys/wait.rs +++ b/src/sys/wait.rs @@ -11,7 +11,7 @@ mod ffi { bitflags!( flags WaitPidFlag: c_int { - static WNOHANG = 0x00000001, + const WNOHANG = 0x00000001, } ) |