summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorHomu <homu@barosl.com>2017-04-16 06:11:28 +0900
committerHomu <homu@barosl.com>2017-04-16 06:11:28 +0900
commit635c8718eede6d7f6a50cf9954a9af8603d2fa1d (patch)
tree6faeff26b5dd177130a4dbac9020a53e8a7099ae /src
parent44c0ecbc42bc8f5ea132aa07cc612139a2cd74b0 (diff)
parent56f5a0a0068c6a7ba69d5b91bf05f664b6dfc1a4 (diff)
downloadnix-635c8718eede6d7f6a50cf9954a9af8603d2fa1d.zip
Auto merge of #536 - nix-rust:new-ci/master, r=kamalmarhubi
Merge New CI Infrastructure Based on Trust/Cross Into Master See discussion on https://github.com/nix-rust/nix/pull/528. This PR is to track the final decision of whether we are ready to merge the new CI infrastructure (and related bug fixes) back into master. Initially, we know that the branch is not ready to merge (as there are still failing tests). This PR acts as a single point of reference to get the current status of how close we are to merging things back into master. A number of issues with "TRUST CI" in the title have been created for the work that appears to be required to get us to the point where this branch can be merged.
Diffstat (limited to 'src')
-rw-r--r--src/errno.rs544
-rw-r--r--src/sys/event.rs14
-rw-r--r--src/sys/socket/consts.rs69
-rw-r--r--src/sys/socket/sockopt.rs6
-rw-r--r--src/sys/syscall.rs10
-rw-r--r--src/sys/termios.rs24
6 files changed, 344 insertions, 323 deletions
diff --git a/src/errno.rs b/src/errno.rs
index 4218bf9c..a27abaa7 100644
--- a/src/errno.rs
+++ b/src/errno.rs
@@ -374,10 +374,10 @@ fn desc(errno: Errno) -> &'static str {
#[cfg(any(target_os = "linux", target_os = "android"))]
ENOTRECOVERABLE => "State not recoverable",
- #[cfg(target_os = "linux")]
+ #[cfg(all(target_os = "linux", not(target_arch="mips")))]
ERFKILL => "Operation not possible due to RF-kill",
- #[cfg(target_os = "linux")]
+ #[cfg(all(target_os = "linux", not(target_arch="mips")))]
EHWPOISON => "Memory page has hardware error",
#[cfg(any(target_os = "freebsd", target_os = "dragonfly"))]
@@ -522,143 +522,145 @@ fn desc(errno: Errno) -> &'static str {
#[cfg(any(target_os = "linux", target_os = "android"))]
mod consts {
+ use libc;
+
#[derive(Debug, Clone, PartialEq, Copy)]
pub enum Errno {
UnknownErrno = 0,
- EPERM = 1,
- ENOENT = 2,
- ESRCH = 3,
- EINTR = 4,
- EIO = 5,
- ENXIO = 6,
- E2BIG = 7,
- ENOEXEC = 8,
- EBADF = 9,
- ECHILD = 10,
- EAGAIN = 11,
- ENOMEM = 12,
- EACCES = 13,
- EFAULT = 14,
- ENOTBLK = 15,
- EBUSY = 16,
- EEXIST = 17,
- EXDEV = 18,
- ENODEV = 19,
- ENOTDIR = 20,
- EISDIR = 21,
- EINVAL = 22,
- ENFILE = 23,
- EMFILE = 24,
- ENOTTY = 25,
- ETXTBSY = 26,
- EFBIG = 27,
- ENOSPC = 28,
- ESPIPE = 29,
- EROFS = 30,
- EMLINK = 31,
- EPIPE = 32,
- EDOM = 33,
- ERANGE = 34,
- EDEADLK = 35,
- ENAMETOOLONG = 36,
- ENOLCK = 37,
- ENOSYS = 38,
- ENOTEMPTY = 39,
- ELOOP = 40,
- ENOMSG = 42,
- EIDRM = 43,
- ECHRNG = 44,
- EL2NSYNC = 45,
- EL3HLT = 46,
- EL3RST = 47,
- ELNRNG = 48,
- EUNATCH = 49,
- ENOCSI = 50,
- EL2HLT = 51,
- EBADE = 52,
- EBADR = 53,
- EXFULL = 54,
- ENOANO = 55,
- EBADRQC = 56,
- EBADSLT = 57,
- EBFONT = 59,
- ENOSTR = 60,
- ENODATA = 61,
- ETIME = 62,
- ENOSR = 63,
- ENONET = 64,
- ENOPKG = 65,
- EREMOTE = 66,
- ENOLINK = 67,
- EADV = 68,
- ESRMNT = 69,
- ECOMM = 70,
- EPROTO = 71,
- EMULTIHOP = 72,
- EDOTDOT = 73,
- EBADMSG = 74,
- EOVERFLOW = 75,
- ENOTUNIQ = 76,
- EBADFD = 77,
- EREMCHG = 78,
- ELIBACC = 79,
- ELIBBAD = 80,
- ELIBSCN = 81,
- ELIBMAX = 82,
- ELIBEXEC = 83,
- EILSEQ = 84,
- ERESTART = 85,
- ESTRPIPE = 86,
- EUSERS = 87,
- ENOTSOCK = 88,
- EDESTADDRREQ = 89,
- EMSGSIZE = 90,
- EPROTOTYPE = 91,
- ENOPROTOOPT = 92,
- EPROTONOSUPPORT = 93,
- ESOCKTNOSUPPORT = 94,
- EOPNOTSUPP = 95,
- EPFNOSUPPORT = 96,
- EAFNOSUPPORT = 97,
- EADDRINUSE = 98,
- EADDRNOTAVAIL = 99,
- ENETDOWN = 100,
- ENETUNREACH = 101,
- ENETRESET = 102,
- ECONNABORTED = 103,
- ECONNRESET = 104,
- ENOBUFS = 105,
- EISCONN = 106,
- ENOTCONN = 107,
- ESHUTDOWN = 108,
- ETOOMANYREFS = 109,
- ETIMEDOUT = 110,
- ECONNREFUSED = 111,
- EHOSTDOWN = 112,
- EHOSTUNREACH = 113,
- EALREADY = 114,
- EINPROGRESS = 115,
- ESTALE = 116,
- EUCLEAN = 117,
- ENOTNAM = 118,
- ENAVAIL = 119,
- EISNAM = 120,
- EREMOTEIO = 121,
- EDQUOT = 122,
- ENOMEDIUM = 123,
- EMEDIUMTYPE = 124,
- ECANCELED = 125,
- ENOKEY = 126,
- EKEYEXPIRED = 127,
- EKEYREVOKED = 128,
- EKEYREJECTED = 129,
- EOWNERDEAD = 130,
- ENOTRECOVERABLE = 131,
-
- #[cfg(not(target_os = "android"))]
- ERFKILL = 132,
- #[cfg(not(target_os = "android"))]
- EHWPOISON = 133,
+ EPERM = libc::EPERM as isize,
+ ENOENT = libc::ENOENT as isize,
+ ESRCH = libc::ESRCH as isize,
+ EINTR = libc::EINTR as isize,
+ EIO = libc::EIO as isize,
+ ENXIO = libc::ENXIO as isize,
+ E2BIG = libc::E2BIG as isize,
+ ENOEXEC = libc::ENOEXEC as isize,
+ EBADF = libc::EBADF as isize,
+ ECHILD = libc::ECHILD as isize,
+ EAGAIN = libc::EAGAIN as isize,
+ ENOMEM = libc::ENOMEM as isize,
+ EACCES = libc::EACCES as isize,
+ EFAULT = libc::EFAULT as isize,
+ ENOTBLK = libc::ENOTBLK as isize,
+ EBUSY = libc::EBUSY as isize,
+ EEXIST = libc::EEXIST as isize,
+ EXDEV = libc::EXDEV as isize,
+ ENODEV = libc::ENODEV as isize,
+ ENOTDIR = libc::ENOTDIR as isize,
+ EISDIR = libc::EISDIR as isize,
+ EINVAL = libc::EINVAL as isize,
+ ENFILE = libc::ENFILE as isize,
+ EMFILE = libc::EMFILE as isize,
+ ENOTTY = libc::ENOTTY as isize,
+ ETXTBSY = libc::ETXTBSY as isize,
+ EFBIG = libc::EFBIG as isize,
+ ENOSPC = libc::ENOSPC as isize,
+ ESPIPE = libc::ESPIPE as isize,
+ EROFS = libc::EROFS as isize,
+ EMLINK = libc::EMLINK as isize,
+ EPIPE = libc::EPIPE as isize,
+ EDOM = libc::EDOM as isize,
+ ERANGE = libc::ERANGE as isize,
+ EDEADLK = libc::EDEADLK as isize,
+ ENAMETOOLONG = libc::ENAMETOOLONG as isize,
+ ENOLCK = libc::ENOLCK as isize,
+ ENOSYS = libc::ENOSYS as isize,
+ ENOTEMPTY = libc::ENOTEMPTY as isize,
+ ELOOP = libc::ELOOP as isize,
+ ENOMSG = libc::ENOMSG as isize,
+ EIDRM = libc::EIDRM as isize,
+ ECHRNG = libc::ECHRNG as isize,
+ EL2NSYNC = libc::EL2NSYNC as isize,
+ EL3HLT = libc::EL3HLT as isize,
+ EL3RST = libc::EL3RST as isize,
+ ELNRNG = libc::ELNRNG as isize,
+ EUNATCH = libc::EUNATCH as isize,
+ ENOCSI = libc::ENOCSI as isize,
+ EL2HLT = libc::EL2HLT as isize,
+ EBADE = libc::EBADE as isize,
+ EBADR = libc::EBADR as isize,
+ EXFULL = libc::EXFULL as isize,
+ ENOANO = libc::ENOANO as isize,
+ EBADRQC = libc::EBADRQC as isize,
+ EBADSLT = libc::EBADSLT as isize,
+ EBFONT = libc::EBFONT as isize,
+ ENOSTR = libc::ENOSTR as isize,
+ ENODATA = libc::ENODATA as isize,
+ ETIME = libc::ETIME as isize,
+ ENOSR = libc::ENOSR as isize,
+ ENONET = libc::ENONET as isize,
+ ENOPKG = libc::ENOPKG as isize,
+ EREMOTE = libc::EREMOTE as isize,
+ ENOLINK = libc::ENOLINK as isize,
+ EADV = libc::EADV as isize,
+ ESRMNT = libc::ESRMNT as isize,
+ ECOMM = libc::ECOMM as isize,
+ EPROTO = libc::EPROTO as isize,
+ EMULTIHOP = libc::EMULTIHOP as isize,
+ EDOTDOT = libc::EDOTDOT as isize,
+ EBADMSG = libc::EBADMSG as isize,
+ EOVERFLOW = libc::EOVERFLOW as isize,
+ ENOTUNIQ = libc::ENOTUNIQ as isize,
+ EBADFD = libc::EBADFD as isize,
+ EREMCHG = libc::EREMCHG as isize,
+ ELIBACC = libc::ELIBACC as isize,
+ ELIBBAD = libc::ELIBBAD as isize,
+ ELIBSCN = libc::ELIBSCN as isize,
+ ELIBMAX = libc::ELIBMAX as isize,
+ ELIBEXEC = libc::ELIBEXEC as isize,
+ EILSEQ = libc::EILSEQ as isize,
+ ERESTART = libc::ERESTART as isize,
+ ESTRPIPE = libc::ESTRPIPE as isize,
+ EUSERS = libc::EUSERS as isize,
+ ENOTSOCK = libc::ENOTSOCK as isize,
+ EDESTADDRREQ = libc::EDESTADDRREQ as isize,
+ EMSGSIZE = libc::EMSGSIZE as isize,
+ EPROTOTYPE = libc::EPROTOTYPE as isize,
+ ENOPROTOOPT = libc::ENOPROTOOPT as isize,
+ EPROTONOSUPPORT = libc::EPROTONOSUPPORT as isize,
+ ESOCKTNOSUPPORT = libc::ESOCKTNOSUPPORT as isize,
+ EOPNOTSUPP = libc::EOPNOTSUPP as isize,
+ EPFNOSUPPORT = libc::EPFNOSUPPORT as isize,
+ EAFNOSUPPORT = libc::EAFNOSUPPORT as isize,
+ EADDRINUSE = libc::EADDRINUSE as isize,
+ EADDRNOTAVAIL = libc::EADDRNOTAVAIL as isize,
+ ENETDOWN = libc::ENETDOWN as isize,
+ ENETUNREACH = libc::ENETUNREACH as isize,
+ ENETRESET = libc::ENETRESET as isize,
+ ECONNABORTED = libc::ECONNABORTED as isize,
+ ECONNRESET = libc::ECONNRESET as isize,
+ ENOBUFS = libc::ENOBUFS as isize,
+ EISCONN = libc::EISCONN as isize,
+ ENOTCONN = libc::ENOTCONN as isize,
+ ESHUTDOWN = libc::ESHUTDOWN as isize,
+ ETOOMANYREFS = libc::ETOOMANYREFS as isize,
+ ETIMEDOUT = libc::ETIMEDOUT as isize,
+ ECONNREFUSED = libc::ECONNREFUSED as isize,
+ EHOSTDOWN = libc::EHOSTDOWN as isize,
+ EHOSTUNREACH = libc::EHOSTUNREACH as isize,
+ EALREADY = libc::EALREADY as isize,
+ EINPROGRESS = libc::EINPROGRESS as isize,
+ ESTALE = libc::ESTALE as isize,
+ EUCLEAN = libc::EUCLEAN as isize,
+ ENOTNAM = libc::ENOTNAM as isize,
+ ENAVAIL = libc::ENAVAIL as isize,
+ EISNAM = libc::EISNAM as isize,
+ EREMOTEIO = libc::EREMOTEIO as isize,
+ EDQUOT = libc::EDQUOT as isize,
+ ENOMEDIUM = libc::ENOMEDIUM as isize,
+ EMEDIUMTYPE = libc::EMEDIUMTYPE as isize,
+ ECANCELED = libc::ECANCELED as isize,
+ ENOKEY = libc::ENOKEY as isize,
+ EKEYEXPIRED = libc::EKEYEXPIRED as isize,
+ EKEYREVOKED = libc::EKEYREVOKED as isize,
+ EKEYREJECTED = libc::EKEYREJECTED as isize,
+ EOWNERDEAD = libc::EOWNERDEAD as isize,
+ ENOTRECOVERABLE = libc::ENOTRECOVERABLE as isize,
+
+ #[cfg(not(any(target_os = "android", target_arch="mips")))]
+ ERFKILL = libc::ERFKILL as isize,
+ #[cfg(not(any(target_os = "android", target_arch="mips")))]
+ EHWPOISON = libc::EHWPOISON as isize,
}
pub const EWOULDBLOCK: Errno = Errno::EAGAIN;
@@ -669,140 +671,140 @@ mod consts {
match e {
0 => UnknownErrno,
- 1 => EPERM,
- 2 => ENOENT,
- 3 => ESRCH,
- 4 => EINTR,
- 5 => EIO,
- 6 => ENXIO,
- 7 => E2BIG,
- 8 => ENOEXEC,
- 9 => EBADF,
- 10 => ECHILD,
- 11 => EAGAIN,
- 12 => ENOMEM,
- 13 => EACCES,
- 14 => EFAULT,
- 15 => ENOTBLK,
- 16 => EBUSY,
- 17 => EEXIST,
- 18 => EXDEV,
- 19 => ENODEV,
- 20 => ENOTDIR,
- 21 => EISDIR,
- 22 => EINVAL,
- 23 => ENFILE,
- 24 => EMFILE,
- 25 => ENOTTY,
- 26 => ETXTBSY,
- 27 => EFBIG,
- 28 => ENOSPC,
- 29 => ESPIPE,
- 30 => EROFS,
- 31 => EMLINK,
- 32 => EPIPE,
- 33 => EDOM,
- 34 => ERANGE,
- 35 => EDEADLK,
- 36 => ENAMETOOLONG,
- 37 => ENOLCK,
- 38 => ENOSYS,
- 39 => ENOTEMPTY,
- 40 => ELOOP,
- 42 => ENOMSG,
- 43 => EIDRM,
- 44 => ECHRNG,
- 45 => EL2NSYNC,
- 46 => EL3HLT,
- 47 => EL3RST,
- 48 => ELNRNG,
- 49 => EUNATCH,
- 50 => ENOCSI,
- 51 => EL2HLT,
- 52 => EBADE,
- 53 => EBADR,
- 54 => EXFULL,
- 55 => ENOANO,
- 56 => EBADRQC,
- 57 => EBADSLT,
- 59 => EBFONT,
- 60 => ENOSTR,
- 61 => ENODATA,
- 62 => ETIME,
- 63 => ENOSR,
- 64 => ENONET,
- 65 => ENOPKG,
- 66 => EREMOTE,
- 67 => ENOLINK,
- 68 => EADV,
- 69 => ESRMNT,
- 70 => ECOMM,
- 71 => EPROTO,
- 72 => EMULTIHOP,
- 73 => EDOTDOT,
- 74 => EBADMSG,
- 75 => EOVERFLOW,
- 76 => ENOTUNIQ,
- 77 => EBADFD,
- 78 => EREMCHG,
- 79 => ELIBACC,
- 80 => ELIBBAD,
- 81 => ELIBSCN,
- 82 => ELIBMAX,
- 83 => ELIBEXEC,
- 84 => EILSEQ,
- 85 => ERESTART,
- 86 => ESTRPIPE,
- 87 => EUSERS,
- 88 => ENOTSOCK,
- 89 => EDESTADDRREQ,
- 90 => EMSGSIZE,
- 91 => EPROTOTYPE,
- 92 => ENOPROTOOPT,
- 93 => EPROTONOSUPPORT,
- 94 => ESOCKTNOSUPPORT,
- 95 => EOPNOTSUPP,
- 96 => EPFNOSUPPORT,
- 97 => EAFNOSUPPORT,
- 98 => EADDRINUSE,
- 99 => EADDRNOTAVAIL,
- 100 => ENETDOWN,
- 101 => ENETUNREACH,
- 102 => ENETRESET,
- 103 => ECONNABORTED,
- 104 => ECONNRESET,
- 105 => ENOBUFS,
- 106 => EISCONN,
- 107 => ENOTCONN,
- 108 => ESHUTDOWN,
- 109 => ETOOMANYREFS,
- 110 => ETIMEDOUT,
- 111 => ECONNREFUSED,
- 112 => EHOSTDOWN,
- 113 => EHOSTUNREACH,
- 114 => EALREADY,
- 115 => EINPROGRESS,
- 116 => ESTALE,
- 117 => EUCLEAN,
- 118 => ENOTNAM,
- 119 => ENAVAIL,
- 120 => EISNAM,
- 121 => EREMOTEIO,
- 122 => EDQUOT,
- 123 => ENOMEDIUM,
- 124 => EMEDIUMTYPE,
- 125 => ECANCELED,
- 126 => ENOKEY,
- 127 => EKEYEXPIRED,
- 128 => EKEYREVOKED,
- 129 => EKEYREJECTED,
- 130 => EOWNERDEAD,
- 131 => ENOTRECOVERABLE,
-
- #[cfg(not(target_os = "android"))]
- 132 => ERFKILL,
- #[cfg(not(target_os = "android"))]
- 133 => EHWPOISON,
+ libc::EPERM => EPERM,
+ libc::ENOENT => ENOENT,
+ libc::ESRCH => ESRCH,
+ libc::EINTR => EINTR,
+ libc::EIO => EIO,
+ libc::ENXIO => ENXIO,
+ libc::E2BIG => E2BIG,
+ libc::ENOEXEC => ENOEXEC,
+ libc::EBADF => EBADF,
+ libc::ECHILD => ECHILD,
+ libc::EAGAIN => EAGAIN,
+ libc::ENOMEM => ENOMEM,
+ libc::EACCES => EACCES,
+ libc::EFAULT => EFAULT,
+ libc::ENOTBLK => ENOTBLK,
+ libc::EBUSY => EBUSY,
+ libc::EEXIST => EEXIST,
+ libc::EXDEV => EXDEV,
+ libc::ENODEV => ENODEV,
+ libc::ENOTDIR => ENOTDIR,
+ libc::EISDIR => EISDIR,
+ libc::EINVAL => EINVAL,
+ libc::ENFILE => ENFILE,
+ libc::EMFILE => EMFILE,
+ libc::ENOTTY => ENOTTY,
+ libc::ETXTBSY => ETXTBSY,
+ libc::EFBIG => EFBIG,
+ libc::ENOSPC => ENOSPC,
+ libc::ESPIPE => ESPIPE,
+ libc::EROFS => EROFS,
+ libc::EMLINK => EMLINK,
+ libc::EPIPE => EPIPE,
+ libc::EDOM => EDOM,
+ libc::ERANGE => ERANGE,
+ libc::EDEADLK => EDEADLK,
+ libc::ENAMETOOLONG => ENAMETOOLONG,
+ libc::ENOLCK => ENOLCK,
+ libc::ENOSYS => ENOSYS,
+ libc::ENOTEMPTY => ENOTEMPTY,
+ libc::ELOOP => ELOOP,
+ libc::ENOMSG => ENOMSG,
+ libc::EIDRM => EIDRM,
+ libc::ECHRNG => ECHRNG,
+ libc::EL2NSYNC => EL2NSYNC,
+ libc::EL3HLT => EL3HLT,
+ libc::EL3RST => EL3RST,
+ libc::ELNRNG => ELNRNG,
+ libc::EUNATCH => EUNATCH,
+ libc::ENOCSI => ENOCSI,
+ libc::EL2HLT => EL2HLT,
+ libc::EBADE => EBADE,
+ libc::EBADR => EBADR,
+ libc::EXFULL => EXFULL,
+ libc::ENOANO => ENOANO,
+ libc::EBADRQC => EBADRQC,
+ libc::EBADSLT => EBADSLT,
+ libc::EBFONT => EBFONT,
+ libc::ENOSTR => ENOSTR,
+ libc::ENODATA => ENODATA,
+ libc::ETIME => ETIME,
+ libc::ENOSR => ENOSR,
+ libc::ENONET => ENONET,
+ libc::ENOPKG => ENOPKG,
+ libc::EREMOTE => EREMOTE,
+ libc::ENOLINK => ENOLINK,
+ libc::EADV => EADV,
+ libc::ESRMNT => ESRMNT,
+ libc::ECOMM => ECOMM,
+ libc::EPROTO => EPROTO,
+ libc::EMULTIHOP => EMULTIHOP,
+ libc::EDOTDOT => EDOTDOT,
+ libc::EBADMSG => EBADMSG,
+ libc::EOVERFLOW => EOVERFLOW,
+ libc::ENOTUNIQ => ENOTUNIQ,
+ libc::EBADFD => EBADFD,
+ libc::EREMCHG => EREMCHG,
+ libc::ELIBACC => ELIBACC,
+ libc::ELIBBAD => ELIBBAD,
+ libc::ELIBSCN => ELIBSCN,
+ libc::ELIBMAX => ELIBMAX,
+ libc::ELIBEXEC => ELIBEXEC,
+ libc::EILSEQ => EILSEQ,
+ libc::ERESTART => ERESTART,
+ libc::ESTRPIPE => ESTRPIPE,
+ libc::EUSERS => EUSERS,
+ libc::ENOTSOCK => ENOTSOCK,
+ libc::EDESTADDRREQ => EDESTADDRREQ,
+ libc::EMSGSIZE => EMSGSIZE,
+ libc::EPROTOTYPE => EPROTOTYPE,
+ libc::ENOPROTOOPT => ENOPROTOOPT,
+ libc::EPROTONOSUPPORT => EPROTONOSUPPORT,
+ libc::ESOCKTNOSUPPORT => ESOCKTNOSUPPORT,
+ libc::EOPNOTSUPP => EOPNOTSUPP,
+ libc::EPFNOSUPPORT => EPFNOSUPPORT,
+ libc::EAFNOSUPPORT => EAFNOSUPPORT,
+ libc::EADDRINUSE => EADDRINUSE,
+ libc::EADDRNOTAVAIL => EADDRNOTAVAIL,
+ libc::ENETDOWN => ENETDOWN,
+ libc::ENETUNREACH => ENETUNREACH,
+ libc::ENETRESET => ENETRESET,
+ libc::ECONNABORTED => ECONNABORTED,
+ libc::ECONNRESET => ECONNRESET,
+ libc::ENOBUFS => ENOBUFS,
+ libc::EISCONN => EISCONN,
+ libc::ENOTCONN => ENOTCONN,
+ libc::ESHUTDOWN => ESHUTDOWN,
+ libc::ETOOMANYREFS => ETOOMANYREFS,
+ libc::ETIMEDOUT => ETIMEDOUT,
+ libc::ECONNREFUSED => ECONNREFUSED,
+ libc::EHOSTDOWN => EHOSTDOWN,
+ libc::EHOSTUNREACH => EHOSTUNREACH,
+ libc::EALREADY => EALREADY,
+ libc::EINPROGRESS => EINPROGRESS,
+ libc::ESTALE => ESTALE,
+ libc::EUCLEAN => EUCLEAN,
+ libc::ENOTNAM => ENOTNAM,
+ libc::ENAVAIL => ENAVAIL,
+ libc::EISNAM => EISNAM,
+ libc::EREMOTEIO => EREMOTEIO,
+ libc::EDQUOT => EDQUOT,
+ libc::ENOMEDIUM => ENOMEDIUM,
+ libc::EMEDIUMTYPE => EMEDIUMTYPE,
+ libc::ECANCELED => ECANCELED,
+ libc::ENOKEY => ENOKEY,
+ libc::EKEYEXPIRED => EKEYEXPIRED,
+ libc::EKEYREVOKED => EKEYREVOKED,
+ libc::EKEYREJECTED => EKEYREJECTED,
+ libc::EOWNERDEAD => EOWNERDEAD,
+ libc::ENOTRECOVERABLE => ENOTRECOVERABLE,
+
+ #[cfg(not(any(target_os = "android", target_arch="mips")))]
+ libc::ERFKILL => ERFKILL,
+ #[cfg(not(any(target_os = "android", target_arch="mips")))]
+ libc::EHWPOISON => EHWPOISON,
_ => UnknownErrno,
}
}
@@ -2058,7 +2060,7 @@ mod test {
}
#[test]
- #[cfg(target_os = "linux")]
+ #[cfg(all(target_os = "linux", not(target_arch = "mips")))]
pub fn test_linux_not_android_errnos() {
check_errno!(
ERFKILL /*,
diff --git a/src/sys/event.rs b/src/sys/event.rs
index 3e2a6d43..494c12dd 100644
--- a/src/sys/event.rs
+++ b/src/sys/event.rs
@@ -22,8 +22,14 @@ pub struct KEvent {
target_os = "dragonfly", target_os = "macos",
target_os = "ios"))]
type type_of_udata = *mut ::c_void;
+#[cfg(any(target_os = "openbsd", target_os = "freebsd",
+ target_os = "dragonfly", target_os = "macos",
+ target_os = "ios"))]
+type type_of_data = libc::intptr_t;
#[cfg(any(target_os = "netbsd"))]
type type_of_udata = intptr_t;
+#[cfg(any(target_os = "netbsd"))]
+type type_of_data = libc::int64_t;
#[cfg(not(target_os = "netbsd"))]
type type_of_event_filter = i16;
@@ -58,9 +64,9 @@ pub enum EventFilter {
}
#[cfg(target_os = "netbsd")]
-type type_of_event_filter = i32;
+type type_of_event_filter = libc::uint32_t;
#[cfg(target_os = "netbsd")]
-#[repr(u32)]
+#[repr(i32)]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum EventFilter {
EVFILT_READ = libc::EVFILT_READ,
@@ -216,7 +222,7 @@ impl KEvent {
filter: filter as type_of_event_filter,
flags: flags.bits(),
fflags: fflags.bits(),
- data: data,
+ data: data as type_of_data,
udata: udata as type_of_udata
} }
}
@@ -238,7 +244,7 @@ impl KEvent {
}
pub fn data(&self) -> intptr_t {
- self.kevent.data
+ self.kevent.data as intptr_t
}
pub fn udata(&self) -> intptr_t {
diff --git a/src/sys/socket/consts.rs b/src/sys/socket/consts.rs
index 9a1861fa..54213ef1 100644
--- a/src/sys/socket/consts.rs
+++ b/src/sys/socket/consts.rs
@@ -11,14 +11,14 @@ mod os {
pub const AF_NETLINK: c_int = 16;
pub const AF_PACKET: c_int = 17;
- pub const SOCK_STREAM: c_int = 1;
- pub const SOCK_DGRAM: c_int = 2;
- pub const SOCK_SEQPACKET: c_int = 5;
- pub const SOCK_RAW: c_int = 3;
+ pub const SOCK_STREAM: c_int = libc::SOCK_STREAM;
+ pub const SOCK_DGRAM: c_int = libc::SOCK_DGRAM;
+ pub const SOCK_SEQPACKET: c_int = libc::SOCK_SEQPACKET;
+ pub const SOCK_RAW: c_int = libc::SOCK_RAW;
pub const SOCK_RDM: c_int = 4;
pub const SOL_IP: c_int = 0;
- pub const SOL_SOCKET: c_int = 1;
+ pub const SOL_SOCKET: c_int = libc::SOL_SOCKET;
pub const SOL_TCP: c_int = 6;
pub const SOL_UDP: c_int = 17;
pub const SOL_IPV6: c_int = 41;
@@ -28,36 +28,39 @@ mod os {
pub const IPPROTO_TCP: c_int = SOL_TCP;
pub const IPPROTO_UDP: c_int = SOL_UDP;
- pub const SO_ACCEPTCONN: c_int = 30;
+ pub const SO_ACCEPTCONN: c_int = libc::SO_ACCEPTCONN;
pub const SO_BINDTODEVICE: c_int = 25;
- pub const SO_BROADCAST: c_int = 6;
+ pub const SO_BROADCAST: c_int = libc::SO_BROADCAST;
pub const SO_BSDCOMPAT: c_int = 14;
pub const SO_DEBUG: c_int = 1;
pub const SO_DOMAIN: c_int = 39;
- pub const SO_ERROR: c_int = 4;
- pub const SO_DONTROUTE: c_int = 5;
- pub const SO_KEEPALIVE: c_int = 9;
- pub const SO_LINGER: c_int = 13;
+ pub const SO_ERROR: c_int = libc::SO_ERROR;
+ pub const SO_DONTROUTE: c_int = libc::SO_DONTROUTE;
+ pub const SO_KEEPALIVE: c_int = libc::SO_KEEPALIVE;
+ pub const SO_LINGER: c_int = libc::SO_LINGER;
pub const SO_MARK: c_int = 36;
- pub const SO_OOBINLINE: c_int = 10;
- pub const SO_PASSCRED: c_int = 16;
+ pub const SO_OOBINLINE: c_int = libc::SO_OOBINLINE;
+ #[cfg(not(target_arch="arm"))]
+ pub const SO_PASSCRED: c_int = libc::SO_PASSCRED;
pub const SO_PEEK_OFF: c_int = 42;
- pub const SO_PEERCRED: c_int = 17;
+ #[cfg(not(target_arch="arm"))]
+ pub const SO_PEERCRED: c_int = libc::SO_PEERCRED;
pub const SO_PRIORITY: c_int = 12;
pub const SO_PROTOCOL: c_int = 38;
- pub const SO_RCVBUF: c_int = 8;
+ pub const SO_RCVBUF: c_int = libc::SO_RCVBUF;
pub const SO_RCVBUFFORCE: c_int = 33;
- pub const SO_RCVLOWAT: c_int = 18;
- pub const SO_SNDLOWAT: c_int = 19;
- pub const SO_RCVTIMEO: c_int = 20;
- pub const SO_SNDTIMEO: c_int = 21;
- pub const SO_REUSEADDR: c_int = 2;
- pub const SO_REUSEPORT: c_int = 15;
+ pub const SO_RCVLOWAT: c_int = libc::SO_RCVLOWAT;
+ pub const SO_SNDLOWAT: c_int = libc::SO_SNDLOWAT;
+ pub const SO_RCVTIMEO: c_int = libc::SO_RCVTIMEO;
+ pub const SO_SNDTIMEO: c_int = libc::SO_SNDTIMEO;
+ pub const SO_REUSEADDR: c_int = libc::SO_REUSEADDR;
+ pub const SO_REUSEPORT: c_int = libc::SO_REUSEPORT;
pub const SO_RXQ_OVFL: c_int = 40;
- pub const SO_SNDBUF: c_int = 7;
- pub const SO_SNDBUFFORCE: c_int = 32;
+ pub const SO_SNDBUF: c_int = libc::SO_SNDBUF;
+ #[cfg(not(target_arch="arm"))]
+ pub const SO_SNDBUFFORCE: c_int = libc::SO_SNDBUFFORCE;
pub const SO_TIMESTAMP: c_int = 29;
- pub const SO_TYPE: c_int = 3;
+ pub const SO_TYPE: c_int = libc::SO_TYPE;
pub const SO_BUSY_POLL: c_int = 46;
#[cfg(target_os = "linux")]
pub const SO_ORIGINAL_DST: c_int = 80;
@@ -152,7 +155,7 @@ mod os {
#[cfg(any(target_os = "macos", target_os = "ios"))]
pub const SYSPROTO_CONTROL: c_int = 2;
- pub const SO_ACCEPTCONN: c_int = 0x0002;
+ pub const SO_ACCEPTCONN: c_int = libc::SO_ACCEPTCONN;
pub const SO_BROADCAST: c_int = 0x0020;
pub const SO_DEBUG: c_int = 0x0001;
#[cfg(not(target_os = "netbsd"))]
@@ -417,7 +420,7 @@ mod test {
#[cfg(target_os = "linux")]
#[test]
- pub fn test_linux_consts() {
+ pub fn test_general_linux_consts() {
// TODO Figure out how to test new constants
check_const!(
SOL_IP,
@@ -431,13 +434,21 @@ mod test {
TCP_CORK,
// SO_BUSY_POLL,
// SO_RXQ_OVFL,
- SO_PASSCRED,
SO_PRIORITY,
// SO_PROTOCOL,
SO_RCVBUFFORCE,
// SO_PEEK_OFF,
- SO_PEERCRED,
- SO_SNDBUFFORCE,
MSG_ERRQUEUE);
}
+
+ #[cfg(all(target_os = "linux", not(target_arch="arm")))]
+ #[test]
+ pub fn test_linux_not_arm_consts() {
+ // TODO Figure out how to test new constants
+ check_const!(
+ SO_PASSCRED,
+ SO_PEERCRED,
+ SO_SNDBUFFORCE);
+ }
+
}
diff --git a/src/sys/socket/sockopt.rs b/src/sys/socket/sockopt.rs
index bf17347c..61d85ec3 100644
--- a/src/sys/socket/sockopt.rs
+++ b/src/sys/socket/sockopt.rs
@@ -152,7 +152,7 @@ sockopt_impl!(Both, Broadcast, consts::SOL_SOCKET, consts::SO_BROADCAST, bool);
sockopt_impl!(Both, OobInline, consts::SOL_SOCKET, consts::SO_OOBINLINE, bool);
sockopt_impl!(GetOnly, SocketError, consts::SOL_SOCKET, consts::SO_ERROR, i32);
sockopt_impl!(Both, KeepAlive, consts::SOL_SOCKET, consts::SO_KEEPALIVE, bool);
-#[cfg(target_os = "linux")]
+#[cfg(all(target_os = "linux", not(target_arch="arm")))]
sockopt_impl!(GetOnly, PeerCredentials, consts::SOL_SOCKET, consts::SO_PEERCRED, super::ucred);
#[cfg(any(target_os = "macos",
target_os = "ios"))]
@@ -167,7 +167,7 @@ sockopt_impl!(Both, RcvBuf, consts::SOL_SOCKET, consts::SO_RCVBUF, usize);
sockopt_impl!(Both, SndBuf, consts::SOL_SOCKET, consts::SO_SNDBUF, usize);
#[cfg(target_os = "linux")]
sockopt_impl!(SetOnly, RcvBufForce, consts::SOL_SOCKET, consts::SO_RCVBUFFORCE, usize);
-#[cfg(target_os = "linux")]
+#[cfg(all(target_os = "linux", not(target_arch="arm")))]
sockopt_impl!(SetOnly, SndBufForce, consts::SOL_SOCKET, consts::SO_SNDBUFFORCE, usize);
sockopt_impl!(GetOnly, SockType, consts::SOL_SOCKET, consts::SO_TYPE, super::SockType);
#[cfg(any(target_os = "freebsd",
@@ -378,7 +378,7 @@ impl<'a> Set<'a, usize> for SetUsize {
#[cfg(test)]
mod test {
- #[cfg(target_os = "linux")]
+ #[cfg(all(target_os = "linux", not(target_arch = "arm")))]
#[test]
fn can_get_peercred_on_unix_socket() {
use super::super::*;
diff --git a/src/sys/syscall.rs b/src/sys/syscall.rs
index c2d9e51c..692b4cef 100644
--- a/src/sys/syscall.rs
+++ b/src/sys/syscall.rs
@@ -54,6 +54,16 @@ mod arch {
pub static MEMFD_CREATE: Syscall = 354;
}
+#[cfg(target_arch = "powerpc")]
+mod arch {
+ use libc::c_long;
+
+ pub type Syscall = c_long;
+
+ pub static SYSPIVOTROOT: Syscall = 203;
+ pub static MEMFD_CREATE: Syscall = 360;
+}
+
extern {
pub fn syscall(num: Syscall, ...) -> c_int;
}
diff --git a/src/sys/termios.rs b/src/sys/termios.rs
index e8df1ed9..126d149c 100644
--- a/src/sys/termios.rs
+++ b/src/sys/termios.rs
@@ -96,22 +96,14 @@ mod ffi {
#[cfg(any(target_os = "macos", target_os = "freebsd", target_os = "dragonfly", target_os = "openbsd", target_os = "netbsd"))]
pub mod consts {
- #[cfg(not(any(target_os = "dragonfly", target_os = "netbsd")))]
- use libc::{c_int, c_ulong, c_uchar};
- #[cfg(any(target_os = "dragonfly", target_os = "netbsd"))]
- use libc::{c_int, c_uint, c_uchar};
- #[cfg(not(any(target_os = "dragonfly", target_os = "netbsd")))]
- pub type tcflag_t = c_ulong;
- #[cfg(any(target_os = "dragonfly", target_os = "netbsd"))]
- pub type tcflag_t = c_uint;
+ use libc;
- pub type cc_t = c_uchar;
+ use libc::c_int;
- #[cfg(not(any(target_os = "dragonfly", target_os = "netbsd")))]
- pub type speed_t = c_ulong;
- #[cfg(any(target_os = "dragonfly", target_os = "netbsd"))]
- pub type speed_t = c_uint;
+ pub type tcflag_t = libc::tcflag_t;
+ pub type cc_t = libc::cc_t;
+ pub type speed_t = libc::speed_t;
#[repr(C)]
#[derive(Clone, Copy)]
@@ -166,7 +158,7 @@ mod ffi {
B7200, B14400, B28800, B57600,
B76800, B115200, B230400};
- #[cfg(any(target_os = "netbsd", target_os = "freebsd"))]
+ #[cfg(target_os = "freebsd")]
use libc::{B460800, B921600};
match s {
@@ -193,9 +185,9 @@ mod ffi {
B76800 => BaudRate::B76800,
B115200 => BaudRate::B115200,
B230400 => BaudRate::B230400,
- #[cfg(any(target_os = "netbsd", target_os = "freebsd"))]
+ #[cfg(target_os = "freebsd")]
B460800 => BaudRate::B460800,
- #[cfg(any(target_os = "netbsd", target_os = "freebsd"))]
+ #[cfg(target_os = "freebsd")]
B921600 => BaudRate::B921600,
b @ _ => unreachable!("Invalid baud constant: {}", b),
}