Skip to content

Commit

Permalink
native: Convert statics to constants
Browse files Browse the repository at this point in the history
  • Loading branch information
alexcrichton committed Oct 9, 2014
1 parent 6532a8c commit 8ccb616
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 54 deletions.
70 changes: 35 additions & 35 deletions src/libnative/io/c_unix.rs
Expand Up @@ -23,41 +23,41 @@ use libc;
target_os = "ios",
target_os = "freebsd",
target_os = "dragonfly"))]
pub static FIONBIO: libc::c_ulong = 0x8004667e;
pub const FIONBIO: libc::c_ulong = 0x8004667e;
#[cfg(any(all(target_os = "linux",
any(target_arch = "x86",
target_arch = "x86_64",
target_arch = "arm")),
target_os = "android"))]
pub static FIONBIO: libc::c_ulong = 0x5421;
pub const FIONBIO: libc::c_ulong = 0x5421;
#[cfg(all(target_os = "linux",
any(target_arch = "mips", target_arch = "mipsel")))]
pub static FIONBIO: libc::c_ulong = 0x667e;
pub const FIONBIO: libc::c_ulong = 0x667e;

#[cfg(any(target_os = "macos",
target_os = "ios",
target_os = "freebsd",
target_os = "dragonfly"))]
pub static FIOCLEX: libc::c_ulong = 0x20006601;
pub const FIOCLEX: libc::c_ulong = 0x20006601;
#[cfg(any(all(target_os = "linux",
any(target_arch = "x86",
target_arch = "x86_64",
target_arch = "arm")),
target_os = "android"))]
pub static FIOCLEX: libc::c_ulong = 0x5451;
pub const FIOCLEX: libc::c_ulong = 0x5451;
#[cfg(all(target_os = "linux",
any(target_arch = "mips", target_arch = "mipsel")))]
pub static FIOCLEX: libc::c_ulong = 0x6601;
pub const FIOCLEX: libc::c_ulong = 0x6601;

#[cfg(any(target_os = "macos",
target_os = "ios",
target_os = "freebsd",
target_os = "dragonfly"))]
pub static MSG_DONTWAIT: libc::c_int = 0x80;
pub const MSG_DONTWAIT: libc::c_int = 0x80;
#[cfg(any(target_os = "linux", target_os = "android"))]
pub static MSG_DONTWAIT: libc::c_int = 0x40;
pub const MSG_DONTWAIT: libc::c_int = 0x40;

pub static WNOHANG: libc::c_int = 1;
pub const WNOHANG: libc::c_int = 1;

extern {
pub fn gettimeofday(timeval: *mut libc::timeval,
Expand Down Expand Up @@ -89,7 +89,7 @@ extern {

#[cfg(any(target_os = "macos", target_os = "ios"))]
mod select {
pub static FD_SETSIZE: uint = 1024;
pub const FD_SETSIZE: uint = 1024;

#[repr(C)]
pub struct fd_set {
Expand All @@ -109,7 +109,7 @@ mod select {
use std::uint;
use libc;

pub static FD_SETSIZE: uint = 1024;
pub const FD_SETSIZE: uint = 1024;

#[repr(C)]
pub struct fd_set {
Expand All @@ -131,14 +131,14 @@ mod select {
mod signal {
use libc;

pub static SA_NOCLDSTOP: libc::c_ulong = 0x00000001;
pub static SA_NOCLDWAIT: libc::c_ulong = 0x00000002;
pub static SA_NODEFER: libc::c_ulong = 0x40000000;
pub static SA_ONSTACK: libc::c_ulong = 0x08000000;
pub static SA_RESETHAND: libc::c_ulong = 0x80000000;
pub static SA_RESTART: libc::c_ulong = 0x10000000;
pub static SA_SIGINFO: libc::c_ulong = 0x00000004;
pub static SIGCHLD: libc::c_int = 17;
pub const SA_NOCLDSTOP: libc::c_ulong = 0x00000001;
pub const SA_NOCLDWAIT: libc::c_ulong = 0x00000002;
pub const SA_NODEFER: libc::c_ulong = 0x40000000;
pub const SA_ONSTACK: libc::c_ulong = 0x08000000;
pub const SA_RESETHAND: libc::c_ulong = 0x80000000;
pub const SA_RESTART: libc::c_ulong = 0x10000000;
pub const SA_SIGINFO: libc::c_ulong = 0x00000004;
pub const SIGCHLD: libc::c_int = 17;

// This definition is not as accurate as it could be, {pid, uid, status} is
// actually a giant union. Currently we're only interested in these fields,
Expand Down Expand Up @@ -179,14 +179,14 @@ mod signal {
mod signal {
use libc;

pub static SA_NOCLDSTOP: libc::c_ulong = 0x00000001;
pub static SA_NOCLDWAIT: libc::c_ulong = 0x00010000;
pub static SA_NODEFER: libc::c_ulong = 0x40000000;
pub static SA_ONSTACK: libc::c_ulong = 0x08000000;
pub static SA_RESETHAND: libc::c_ulong = 0x80000000;
pub static SA_RESTART: libc::c_ulong = 0x10000000;
pub static SA_SIGINFO: libc::c_ulong = 0x00000008;
pub static SIGCHLD: libc::c_int = 18;
pub const SA_NOCLDSTOP: libc::c_ulong = 0x00000001;
pub const SA_NOCLDWAIT: libc::c_ulong = 0x00010000;
pub const SA_NODEFER: libc::c_ulong = 0x40000000;
pub const SA_ONSTACK: libc::c_ulong = 0x08000000;
pub const SA_RESETHAND: libc::c_ulong = 0x80000000;
pub const SA_RESTART: libc::c_ulong = 0x10000000;
pub const SA_SIGINFO: libc::c_ulong = 0x00000008;
pub const SIGCHLD: libc::c_int = 18;

// This definition is not as accurate as it could be, {pid, uid, status} is
// actually a giant union. Currently we're only interested in these fields,
Expand Down Expand Up @@ -223,14 +223,14 @@ mod signal {
mod signal {
use libc;

pub static SA_ONSTACK: libc::c_int = 0x0001;
pub static SA_RESTART: libc::c_int = 0x0002;
pub static SA_RESETHAND: libc::c_int = 0x0004;
pub static SA_NOCLDSTOP: libc::c_int = 0x0008;
pub static SA_NODEFER: libc::c_int = 0x0010;
pub static SA_NOCLDWAIT: libc::c_int = 0x0020;
pub static SA_SIGINFO: libc::c_int = 0x0040;
pub static SIGCHLD: libc::c_int = 20;
pub const SA_ONSTACK: libc::c_int = 0x0001;
pub const SA_RESTART: libc::c_int = 0x0002;
pub const SA_RESETHAND: libc::c_int = 0x0004;
pub const SA_NOCLDSTOP: libc::c_int = 0x0008;
pub const SA_NODEFER: libc::c_int = 0x0010;
pub const SA_NOCLDWAIT: libc::c_int = 0x0020;
pub const SA_SIGINFO: libc::c_int = 0x0040;
pub const SIGCHLD: libc::c_int = 20;

#[cfg(any(target_os = "macos", target_os = "ios"))]
pub type sigset_t = u32;
Expand Down
38 changes: 19 additions & 19 deletions src/libnative/io/c_windows.rs
Expand Up @@ -14,26 +14,26 @@

use libc;

pub static WSADESCRIPTION_LEN: uint = 256;
pub static WSASYS_STATUS_LEN: uint = 128;
pub static FIONBIO: libc::c_long = 0x8004667e;
pub const WSADESCRIPTION_LEN: uint = 256;
pub const WSASYS_STATUS_LEN: uint = 128;
pub const FIONBIO: libc::c_long = 0x8004667e;
static FD_SETSIZE: uint = 64;
pub static MSG_DONTWAIT: libc::c_int = 0;
pub static ERROR_ILLEGAL_CHARACTER: libc::c_int = 582;
pub static ENABLE_ECHO_INPUT: libc::DWORD = 0x4;
pub static ENABLE_EXTENDED_FLAGS: libc::DWORD = 0x80;
pub static ENABLE_INSERT_MODE: libc::DWORD = 0x20;
pub static ENABLE_LINE_INPUT: libc::DWORD = 0x2;
pub static ENABLE_PROCESSED_INPUT: libc::DWORD = 0x1;
pub static ENABLE_QUICK_EDIT_MODE: libc::DWORD = 0x40;
pub static WSA_INVALID_EVENT: WSAEVENT = 0 as WSAEVENT;

pub static FD_ACCEPT: libc::c_long = 0x08;
pub static FD_MAX_EVENTS: uint = 10;
pub static WSA_INFINITE: libc::DWORD = libc::INFINITE;
pub static WSA_WAIT_TIMEOUT: libc::DWORD = libc::consts::os::extra::WAIT_TIMEOUT;
pub static WSA_WAIT_EVENT_0: libc::DWORD = libc::consts::os::extra::WAIT_OBJECT_0;
pub static WSA_WAIT_FAILED: libc::DWORD = libc::consts::os::extra::WAIT_FAILED;
pub const MSG_DONTWAIT: libc::c_int = 0;
pub const ERROR_ILLEGAL_CHARACTER: libc::c_int = 582;
pub const ENABLE_ECHO_INPUT: libc::DWORD = 0x4;
pub const ENABLE_EXTENDED_FLAGS: libc::DWORD = 0x80;
pub const ENABLE_INSERT_MODE: libc::DWORD = 0x20;
pub const ENABLE_LINE_INPUT: libc::DWORD = 0x2;
pub const ENABLE_PROCESSED_INPUT: libc::DWORD = 0x1;
pub const ENABLE_QUICK_EDIT_MODE: libc::DWORD = 0x40;
pub const WSA_INVALID_EVENT: WSAEVENT = 0 as WSAEVENT;

pub const FD_ACCEPT: libc::c_long = 0x08;
pub const FD_MAX_EVENTS: uint = 10;
pub const WSA_INFINITE: libc::DWORD = libc::INFINITE;
pub const WSA_WAIT_TIMEOUT: libc::DWORD = libc::consts::os::extra::WAIT_TIMEOUT;
pub const WSA_WAIT_EVENT_0: libc::DWORD = libc::consts::os::extra::WAIT_OBJECT_0;
pub const WSA_WAIT_FAILED: libc::DWORD = libc::consts::os::extra::WAIT_FAILED;

#[repr(C)]
#[cfg(target_arch = "x86")]
Expand Down

0 comments on commit 8ccb616

Please sign in to comment.