diff options
Diffstat (limited to 'libc/src/unix/redox/mod.rs')
-rw-r--r-- | libc/src/unix/redox/mod.rs | 157 |
1 files changed, 139 insertions, 18 deletions
diff --git a/libc/src/unix/redox/mod.rs b/libc/src/unix/redox/mod.rs index 2591a79..b00a191 100644 --- a/libc/src/unix/redox/mod.rs +++ b/libc/src/unix/redox/mod.rs @@ -40,7 +40,9 @@ pub type time_t = ::c_long; pub enum timezone {} impl ::Copy for timezone {} impl ::Clone for timezone { - fn clone(&self) -> timezone { *self } + fn clone(&self) -> timezone { + *self + } } s_no_extra_traits! { @@ -610,6 +612,124 @@ pub const SOCK_STREAM: ::c_int = 1; pub const SOCK_DGRAM: ::c_int = 2; pub const SOL_SOCKET: ::c_int = 1; +// sys/termios.h +pub const NCCS: usize = 32; + +pub const VINTR: usize = 0; +pub const VQUIT: usize = 1; +pub const VERASE: usize = 2; +pub const VKILL: usize = 3; +pub const VEOF: usize = 4; +pub const VTIME: usize = 5; +pub const VMIN: usize = 6; +pub const VSWTC: usize = 7; +pub const VSTART: usize = 8; +pub const VSTOP: usize = 9; +pub const VSUSP: usize = 10; +pub const VEOL: usize = 11; +pub const VREPRINT: usize = 12; +pub const VDISCARD: usize = 13; +pub const VWERASE: usize = 14; +pub const VLNEXT: usize = 15; +pub const VEOL2: usize = 16; + +pub const IGNBRK: ::tcflag_t = 0o000_001; +pub const BRKINT: ::tcflag_t = 0o000_002; +pub const IGNPAR: ::tcflag_t = 0o000_004; +pub const PARMRK: ::tcflag_t = 0o000_010; +pub const INPCK: ::tcflag_t = 0o000_020; +pub const ISTRIP: ::tcflag_t = 0o000_040; +pub const INLCR: ::tcflag_t = 0o000_100; +pub const IGNCR: ::tcflag_t = 0o000_200; +pub const ICRNL: ::tcflag_t = 0o000_400; +pub const IUCLC: ::tcflag_t = 0o001_000; +pub const IXON: ::tcflag_t = 0o002_000; +pub const IXANY: ::tcflag_t = 0o004_000; +pub const IXOFF: ::tcflag_t = 0o010_000; +pub const IMAXBEL: ::tcflag_t = 0o020_000; +pub const IUTF8: ::tcflag_t = 0o040_000; + +pub const OPOST: ::tcflag_t = 0o000_001; +pub const OLCUC: ::tcflag_t = 0o000_002; +pub const ONLCR: ::tcflag_t = 0o000_004; +pub const OCRNL: ::tcflag_t = 0o000_010; +pub const ONOCR: ::tcflag_t = 0o000_020; +pub const ONLRET: ::tcflag_t = 0o00_0040; +pub const OFILL: ::tcflag_t = 0o000_100; +pub const OFDEL: ::tcflag_t = 0o000_200; + +pub const VTDLY: usize = 0o040_000; +pub const VT0: usize = 0o000_000; +pub const VT1: usize = 0o040_000; + +pub const B0: speed_t = 0o000_000; +pub const B50: speed_t = 0o000_001; +pub const B75: speed_t = 0o000_002; +pub const B110: speed_t = 0o000_003; +pub const B134: speed_t = 0o000_004; +pub const B150: speed_t = 0o000_005; +pub const B200: speed_t = 0o000_006; +pub const B300: speed_t = 0o000_007; +pub const B600: speed_t = 0o000_010; +pub const B1200: speed_t = 0o000_011; +pub const B1800: speed_t = 0o000_012; +pub const B2400: speed_t = 0o000_013; +pub const B4800: speed_t = 0o000_014; +pub const B9600: speed_t = 0o000_015; +pub const B19200: speed_t = 0o000_016; +pub const B38400: speed_t = 0o000_017; + +pub const B57600: speed_t = 0o010_001; +pub const B115200: speed_t = 0o010_002; +pub const B230400: speed_t = 0o010_003; +pub const B460800: speed_t = 0o010_004; +pub const B500000: speed_t = 0o010_005; +pub const B576000: speed_t = 0o010_006; +pub const B921600: speed_t = 0o010_007; +pub const B1000000: speed_t = 0o010_010; +pub const B1152000: speed_t = 0o010_011; +pub const B1500000: speed_t = 0o010_012; +pub const B2000000: speed_t = 0o010_013; +pub const B2500000: speed_t = 0o010_014; +pub const B3000000: speed_t = 0o010_015; +pub const B3500000: speed_t = 0o010_016; +pub const B4000000: speed_t = 0o010_017; + +pub const CSIZE: ::tcflag_t = 0o000_060; +pub const CS5: ::tcflag_t = 0o000_000; +pub const CS6: ::tcflag_t = 0o000_020; +pub const CS7: ::tcflag_t = 0o000_040; +pub const CS8: ::tcflag_t = 0o000_060; +pub const CSTOPB: ::tcflag_t = 0o000_100; +pub const CREAD: ::tcflag_t = 0o000_200; +pub const PARENB: ::tcflag_t = 0o000_400; +pub const PARODD: ::tcflag_t = 0o001_000; +pub const HUPCL: ::tcflag_t = 0o002_000; +pub const CLOCAL: ::tcflag_t = 0o004_000; + +pub const ISIG: ::tcflag_t = 0o000_001; +pub const ICANON: ::tcflag_t = 0o000_002; +pub const ECHO: ::tcflag_t = 0o000_010; +pub const ECHOE: ::tcflag_t = 0o000_020; +pub const ECHOK: ::tcflag_t = 0o000_040; +pub const ECHONL: ::tcflag_t = 0o000_100; +pub const NOFLSH: ::tcflag_t = 0o000_200; +pub const TOSTOP: ::tcflag_t = 0o000_400; +pub const IEXTEN: ::tcflag_t = 0o100_000; + +pub const TCOOFF: ::c_int = 0; +pub const TCOON: ::c_int = 1; +pub const TCIOFF: ::c_int = 2; +pub const TCION: ::c_int = 3; + +pub const TCIFLUSH: ::c_int = 0; +pub const TCOFLUSH: ::c_int = 1; +pub const TCIOFLUSH: ::c_int = 2; + +pub const TCSANOW: ::c_int = 0; +pub const TCSADRAIN: ::c_int = 1; +pub const TCSAFLUSH: ::c_int = 2; + // sys/wait.h pub const WNOHANG: ::c_int = 1; pub const WUNTRACED: ::c_int = 2; @@ -624,9 +744,6 @@ pub const __WALL: ::c_int = 0x4000_0000; #[allow(overflowing_literals)] pub const __WCLONE: ::c_int = 0x8000_0000; -// termios.h -pub const NCCS: usize = 32; - // time.h pub const CLOCK_REALTIME: ::c_int = 1; pub const CLOCK_MONOTONIC: ::c_int = 4; @@ -724,11 +841,14 @@ f! { } } -extern { +extern "C" { // errno.h pub fn __errno_location() -> *mut ::c_int; - pub fn strerror_r(errnum: ::c_int, buf: *mut c_char, - buflen: ::size_t) -> ::c_int; + pub fn strerror_r( + errnum: ::c_int, + buf: *mut c_char, + buflen: ::size_t, + ) -> ::c_int; // unistd.h pub fn pipe2(fds: *mut ::c_int, flags: ::c_int) -> ::c_int; @@ -738,14 +858,14 @@ extern { // pthread.h pub fn pthread_atfork( - prepare: ::Option<unsafe extern fn()>, - parent: ::Option<unsafe extern fn()>, - child: ::Option<unsafe extern fn()>, + prepare: ::Option<unsafe extern "C" fn()>, + parent: ::Option<unsafe extern "C" fn()>, + child: ::Option<unsafe extern "C" fn()>, ) -> ::c_int; pub fn pthread_create( tid: *mut ::pthread_t, attr: *const ::pthread_attr_t, - start: extern fn(*mut ::c_void) -> *mut ::c_void, + start: extern "C" fn(*mut ::c_void) -> *mut ::c_void, arg: *mut ::c_void, ) -> ::c_int; pub fn pthread_condattr_setclock( @@ -754,11 +874,13 @@ extern { ) -> ::c_int; // pwd.h - pub fn getpwuid_r(uid: ::uid_t, - pwd: *mut passwd, - buf: *mut ::c_char, - buflen: ::size_t, - result: *mut *mut passwd) -> ::c_int; + pub fn getpwuid_r( + uid: ::uid_t, + pwd: *mut passwd, + buf: *mut ::c_char, + buflen: ::size_t, + result: *mut *mut passwd, + ) -> ::c_int; // signal.h pub fn pthread_sigmask( @@ -824,8 +946,7 @@ extern { pub fn uname(utsname: *mut utsname) -> ::c_int; // time.h - pub fn gettimeofday(tp: *mut ::timeval, - tz: *mut ::timezone) -> ::c_int; + pub fn gettimeofday(tp: *mut ::timeval, tz: *mut ::timezone) -> ::c_int; pub fn clock_gettime(clk_id: ::clockid_t, tp: *mut ::timespec) -> ::c_int; } |