diff options
Diffstat (limited to 'libc')
-rw-r--r-- | libc/Cargo.lock | 56 | ||||
-rw-r--r-- | libc/Cargo.toml | 2 | ||||
-rw-r--r-- | libc/README.md | 2 | ||||
-rw-r--r-- | libc/ci/docker/arm-unknown-linux-musleabihf/Dockerfile | 2 | ||||
-rw-r--r-- | libc/libc-test/build.rs | 10 | ||||
-rw-r--r-- | libc/src/dox.rs | 5 | ||||
-rw-r--r-- | libc/src/unix/bsd/apple/mod.rs | 25 | ||||
-rw-r--r-- | libc/src/unix/bsd/freebsdlike/freebsd/mod.rs | 1 | ||||
-rw-r--r-- | libc/src/unix/bsd/freebsdlike/mod.rs | 3 | ||||
-rw-r--r-- | libc/src/unix/bsd/mod.rs | 7 | ||||
-rw-r--r-- | libc/src/unix/bsd/netbsdlike/mod.rs | 2 | ||||
-rw-r--r-- | libc/src/unix/bsd/netbsdlike/netbsd/mod.rs | 3 | ||||
-rw-r--r-- | libc/src/unix/bsd/netbsdlike/openbsdlike/mod.rs | 1 | ||||
-rw-r--r-- | libc/src/unix/notbsd/android/mod.rs | 3 | ||||
-rw-r--r-- | libc/src/unix/notbsd/linux/mips/mod.rs | 3 | ||||
-rw-r--r-- | libc/src/unix/notbsd/linux/mod.rs | 3 | ||||
-rw-r--r-- | libc/src/unix/notbsd/linux/s390x.rs | 3 | ||||
-rw-r--r-- | libc/src/unix/notbsd/mod.rs | 13 | ||||
-rw-r--r-- | libc/src/windows/gnu.rs | 7 | ||||
-rw-r--r-- | libc/src/windows/mod.rs | 67 | ||||
-rw-r--r-- | libc/src/windows/msvc.rs | 2 |
21 files changed, 177 insertions, 43 deletions
diff --git a/libc/Cargo.lock b/libc/Cargo.lock index 6d94df8..c15eee4 100644 --- a/libc/Cargo.lock +++ b/libc/Cargo.lock @@ -10,7 +10,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "cc" -version = "1.0.25" +version = "1.0.28" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -23,7 +23,7 @@ name = "ctest" version = "0.2.8" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "cc 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)", + "cc 1.0.28 (registry+https://github.com/rust-lang/crates.io-index)", "syntex_syntax 0.59.1 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -36,7 +36,7 @@ dependencies = [ "rand 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", "semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.81 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.84 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -69,12 +69,12 @@ dependencies = [ [[package]] name = "libc" -version = "0.2.44" +version = "0.2.45" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "libc" -version = "0.2.45" +version = "0.2.46" dependencies = [ "rustc-std-workspace-core 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -84,7 +84,7 @@ name = "libc-test" version = "0.1.0" dependencies = [ "ctest 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.45", + "libc 0.2.46", ] [[package]] @@ -130,7 +130,7 @@ version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "fuchsia-zircon 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.44 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -167,35 +167,35 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "serde" -version = "1.0.81" +version = "1.0.84" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "serde_derive 1.0.81 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.84 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "serde_derive" -version = "1.0.81" +version = "1.0.84" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "proc-macro2 0.4.24 (registry+https://github.com/rust-lang/crates.io-index)", "quote 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.22 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.23 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "serde_json" -version = "1.0.33" +version = "1.0.34" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "itoa 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", "ryu 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.81 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.84 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "syn" -version = "0.15.22" +version = "0.15.23" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "proc-macro2 0.4.24 (registry+https://github.com/rust-lang/crates.io-index)", @@ -208,9 +208,9 @@ name = "syntex_errors" version = "0.59.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.44 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.81 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.81 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.84 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.84 (registry+https://github.com/rust-lang/crates.io-index)", "syntex_pos 0.59.1 (registry+https://github.com/rust-lang/crates.io-index)", "term 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -221,8 +221,8 @@ name = "syntex_pos" version = "0.59.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "serde 1.0.81 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.81 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.84 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.84 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -233,9 +233,9 @@ dependencies = [ "bitflags 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)", "extprim 1.6.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.81 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.81 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_json 1.0.33 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.84 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.84 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.34 (registry+https://github.com/rust-lang/crates.io-index)", "syntex_errors 0.59.1 (registry+https://github.com/rust-lang/crates.io-index)", "syntex_pos 0.59.1 (registry+https://github.com/rust-lang/crates.io-index)", "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -287,7 +287,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [metadata] "checksum bitflags 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)" = "4efd02e230a02e18f92fc2735f44597385ed02ad8f831e7c1c1156ee5e1ab3a5" "checksum bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "228047a76f468627ca71776ecdebd732a3423081fcf5125585bcd7c49886ce12" -"checksum cc 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)" = "f159dfd43363c4d08055a07703eb7a3406b0dac4d0584d96965a3262db3c9d16" +"checksum cc 1.0.28 (registry+https://github.com/rust-lang/crates.io-index)" = "bb4a8b715cb4597106ea87c7c84b2f1d452c7492033765df7f32651e66fcf749" "checksum cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "082bb9b28e00d3c9d39cc03e64ce4cea0f1bb9b3fde493f0cbc008472d22bdf4" "checksum ctest 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "3574c0edc91c25cb50d1e4238f35ae2651b0beadf72bfec31fb4ead46b4eb5b8" "checksum extprim 1.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "054bc2552b3f66fa8097e29e47255bfff583c08e737a67cbbb54b817ddaa5206" @@ -295,7 +295,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum fuchsia-zircon-sys 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "3dcaa9ae7725d12cdb85b3ad99a434db70b468c09ded17e012d86b5c1010f7a7" "checksum itoa 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "1306f3464951f30e30d12373d31c79fbd52d236e5e896fd92f96ec7babbbe60b" "checksum kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d" -"checksum libc 0.2.44 (registry+https://github.com/rust-lang/crates.io-index)" = "10923947f84a519a45c8fefb7dd1b3e8c08747993381adee176d7a82b4195311" +"checksum libc 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)" = "2d2857ec59fadc0773853c664d2d18e7198e83883e7060b63c924cb077bd5c74" "checksum log 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)" = "e19e8d5c34a3e0e2223db8e060f9e8264aeeb5c5fc64a4ee9965c062211c024b" "checksum log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c84ec4b527950aa83a329754b01dbe3f58361d1c5efacd1f6d68c494d08a17c6" "checksum num-traits 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "0b3a5d7cc97d6d30d8b9bc8fa19bf45349ffe46241e8816f50f62f6d6aaabee1" @@ -307,10 +307,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum ryu 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)" = "eb9e9b8cde282a9fe6a42dd4681319bfb63f121b8a8ee9439c6f4107e58a46f7" "checksum semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403" "checksum semver-parser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" -"checksum serde 1.0.81 (registry+https://github.com/rust-lang/crates.io-index)" = "c91eb5b0190ae87b4e2e39cbba6e3bed3ac6186935fe265f0426156c4c49961b" -"checksum serde_derive 1.0.81 (registry+https://github.com/rust-lang/crates.io-index)" = "477b13b646f5b5b56fc95bedfc3b550d12141ce84f466f6c44b9a17589923885" -"checksum serde_json 1.0.33 (registry+https://github.com/rust-lang/crates.io-index)" = "c37ccd6be3ed1fdf419ee848f7c758eb31b054d7cd3ae3600e3bae0adf569811" -"checksum syn 0.15.22 (registry+https://github.com/rust-lang/crates.io-index)" = "ae8b29eb5210bc5cf63ed6149cbf9adfc82ac0be023d8735c176ee74a2db4da7" +"checksum serde 1.0.84 (registry+https://github.com/rust-lang/crates.io-index)" = "0e732ed5a5592c17d961555e3b552985baf98d50ce418b7b655f31f6ba7eb1b7" +"checksum serde_derive 1.0.84 (registry+https://github.com/rust-lang/crates.io-index)" = "b4d6115a3ca25c224e409185325afc16a0d5aaaabc15c42b09587d6f1ba39a5b" +"checksum serde_json 1.0.34 (registry+https://github.com/rust-lang/crates.io-index)" = "bdf540260cfee6da923831f4776ddc495ada940c30117977c70f1313a6130545" +"checksum syn 0.15.23 (registry+https://github.com/rust-lang/crates.io-index)" = "9545a6a093a3f0bd59adb472700acc08cad3776f860f16a897dfce8c88721cbc" "checksum syntex_errors 0.59.1 (registry+https://github.com/rust-lang/crates.io-index)" = "3133289179676c9f5c5b2845bf5a2e127769f4889fcbada43035ef6bd662605e" "checksum syntex_pos 0.59.1 (registry+https://github.com/rust-lang/crates.io-index)" = "30ab669fa003d208c681f874bbc76d91cc3d32550d16b5d9d2087cf477316470" "checksum syntex_syntax 0.59.1 (registry+https://github.com/rust-lang/crates.io-index)" = "03815b9f04d95828770d9c974aa39c6e1f6ef3114eb77a3ce09008a0d15dd142" diff --git a/libc/Cargo.toml b/libc/Cargo.toml index 8d8272e..f7bf9f5 100644 --- a/libc/Cargo.toml +++ b/libc/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "libc" -version = "0.2.45" +version = "0.2.46" authors = ["The Rust Project Developers"] license = "MIT OR Apache-2.0" readme = "README.md" diff --git a/libc/README.md b/libc/README.md index 6cf2d15..636f10e 100644 --- a/libc/README.md +++ b/libc/README.md @@ -5,11 +5,11 @@ Raw FFI bindings to platform libraries like `libc`. [![Build Status](https://travis-ci.org/rust-lang/libc.svg?branch=master)](https://travis-ci.org/rust-lang/libc) [![Build status](https://ci.appveyor.com/api/projects/status/github/rust-lang/libc?svg=true)](https://ci.appveyor.com/project/rust-lang-libs/libc) +[![Build Status](https://api.cirrus-ci.com/github/rust-lang/libc.svg)](https://cirrus-ci.com/github/rust-lang/libc) [![Latest version](https://img.shields.io/crates/v/libc.svg)](https://crates.io/crates/libc) [![Documentation](https://docs.rs/libc/badge.svg)](https://docs.rs/libc) ![License](https://img.shields.io/crates/l/libc.svg) - ## Usage First, add the following to your `Cargo.toml`: diff --git a/libc/ci/docker/arm-unknown-linux-musleabihf/Dockerfile b/libc/ci/docker/arm-unknown-linux-musleabihf/Dockerfile index 3fc9dd3..0d493ca 100644 --- a/libc/ci/docker/arm-unknown-linux-musleabihf/Dockerfile +++ b/libc/ci/docker/arm-unknown-linux-musleabihf/Dockerfile @@ -7,7 +7,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ RUN curl --retry 5 https://www.musl-libc.org/releases/musl-1.1.19.tar.gz | tar xzf - WORKDIR /musl-1.1.19 RUN CC=arm-linux-gnueabihf-gcc \ - CFLAGS="-march=armv6 -marm" \ + CFLAGS="-march=armv6 -marm -mfpu=vfp" \ ./configure --prefix=/musl-arm --enable-wrapper=yes RUN make install -j4 diff --git a/libc/libc-test/build.rs b/libc/libc-test/build.rs index 460eb72..ffab452 100644 --- a/libc/libc-test/build.rs +++ b/libc/libc-test/build.rs @@ -76,6 +76,7 @@ fn main() { cfg.header("windows.h"); cfg.header("process.h"); cfg.header("ws2ipdef.h"); + cfg.header("signal.h"); if target.contains("gnu") { cfg.header("ws2tcpip.h"); @@ -372,7 +373,9 @@ fn main() { // Fixup a few types on windows that don't actually exist. "time64_t" if windows => "__time64_t".to_string(), "ssize_t" if windows => "SSIZE_T".to_string(), - + // windows + "sighandler_t" if windows && !mingw => "_crt_signal_t".to_string(), + "sighandler_t" if windows && mingw => "__p_sig_fn_t".to_string(), // OSX calls this something else "sighandler_t" if bsdlike => "sig_t".to_string(), @@ -507,6 +510,7 @@ fn main() { n if n.starts_with("P") => true, n if n.starts_with("H") => true, n if n.starts_with("LP") => true, + "__p_sig_fn_t" if mingw => true, _ => false, } }); @@ -652,6 +656,10 @@ fn main() { "BOTHER" => true, "MFD_CLOEXEC" | "MFD_ALLOW_SEALING" if !mips && musl => true, + // MFD_HUGETLB is not available in some older libc versions on the CI builders. On the + // x86_64 and i686 builders it seems to be available for all targets, so at least test + // it there. + "MFD_HUGETLB" if !(x86_64 || i686) || musl => true, "DT_FIFO" | "DT_CHR" | "DT_DIR" | "DT_BLK" | "DT_REG" | "DT_LNK" | "DT_SOCK" diff --git a/libc/src/dox.rs b/libc/src/dox.rs index 33a9c16..6296c6c 100644 --- a/libc/src/dox.rs +++ b/libc/src/dox.rs @@ -52,6 +52,11 @@ mod imp { #[lang = "sized"] pub trait Sized {} + #[lang = "receiver"] + pub trait Receiver {} + impl<T: ?Sized> Receiver for &T {} + impl<T: ?Sized> Receiver for &mut T {} + macro_rules! each_int { ($mac:ident) => { $mac!(u8); diff --git a/libc/src/unix/bsd/apple/mod.rs b/libc/src/unix/bsd/apple/mod.rs index bb07cc4..3d9dd94 100644 --- a/libc/src/unix/bsd/apple/mod.rs +++ b/libc/src/unix/bsd/apple/mod.rs @@ -1570,11 +1570,16 @@ pub const SOCK_RDM: ::c_int = 4; pub const SOCK_SEQPACKET: ::c_int = 5; pub const IP_TTL: ::c_int = 4; pub const IP_HDRINCL: ::c_int = 2; +pub const IP_RECVDSTADDR: ::c_int = 7; pub const IP_ADD_MEMBERSHIP: ::c_int = 12; pub const IP_DROP_MEMBERSHIP: ::c_int = 13; +pub const IP_RECVIF: ::c_int = 20; pub const IP_PKTINFO: ::c_int = 26; +pub const IP_RECVTOS: ::c_int = 27; pub const IPV6_JOIN_GROUP: ::c_int = 12; pub const IPV6_LEAVE_GROUP: ::c_int = 13; +pub const IPV6_RECVTCLASS: ::c_int = 35; +pub const IPV6_TCLASS: ::c_int = 36; pub const IPV6_PKTINFO: ::c_int = 46; pub const IPV6_RECVPKTINFO: ::c_int = 61; @@ -1914,6 +1919,13 @@ pub const IUTF8: ::tcflag_t = 0x00004000; pub const CRTSCTS: ::tcflag_t = 0x00030000; pub const NI_MAXHOST: ::socklen_t = 1025; +pub const NI_MAXSERV: ::socklen_t = 32; +pub const NI_NOFQDN: ::c_int = 0x00000001; +pub const NI_NUMERICHOST: ::c_int = 0x00000002; +pub const NI_NAMEREQD: ::c_int = 0x00000004; +pub const NI_NUMERICSERV: ::c_int = 0x00000008; +pub const NI_NUMERICSCOPE: ::c_int = 0x00000100; +pub const NI_DGRAM: ::c_int = 0x00000010; pub const Q_GETQUOTA: ::c_int = 0x300; pub const Q_SETQUOTA: ::c_int = 0x400; @@ -2147,6 +2159,19 @@ pub const PRIO_DARWIN_NONUI: ::c_int = 0x1001; pub const SEM_FAILED: *mut sem_t = -1isize as *mut ::sem_t; +pub const AI_PASSIVE: ::c_int = 0x00000001; +pub const AI_CANONNAME: ::c_int = 0x00000002; +pub const AI_NUMERICHOST: ::c_int = 0x00000004; +pub const AI_NUMERICSERV: ::c_int = 0x00001000; +pub const AI_MASK: ::c_int = AI_PASSIVE | AI_CANONNAME | AI_NUMERICHOST | + AI_NUMERICSERV | AI_ADDRCONFIG; +pub const AI_ALL: ::c_int = 0x00000100; +pub const AI_V4MAPPED_CFG: ::c_int = 0x00000200; +pub const AI_ADDRCONFIG: ::c_int = 0x00000400; +pub const AI_V4MAPPED: ::c_int = 0x00000800; +pub const AI_DEFAULT: ::c_int = AI_V4MAPPED_CFG | AI_ADDRCONFIG; +pub const AI_UNUSABLE: ::c_int = 0x10000000; + pub const SIGEV_NONE: ::c_int = 0; pub const SIGEV_SIGNAL: ::c_int = 1; pub const SIGEV_THREAD: ::c_int = 3; diff --git a/libc/src/unix/bsd/freebsdlike/freebsd/mod.rs b/libc/src/unix/bsd/freebsdlike/freebsd/mod.rs index 1ead166..03b19eb 100644 --- a/libc/src/unix/bsd/freebsdlike/freebsd/mod.rs +++ b/libc/src/unix/bsd/freebsdlike/freebsd/mod.rs @@ -803,6 +803,7 @@ pub const TCP_PCAP_OUT: ::c_int = 2048; pub const TCP_PCAP_IN: ::c_int = 4096; pub const IP_BINDANY: ::c_int = 24; +pub const IP_RECVTOS: ::c_int = 68; pub const PF_SLOW: ::c_int = AF_SLOW; pub const PF_SCLUSTER: ::c_int = AF_SCLUSTER; diff --git a/libc/src/unix/bsd/freebsdlike/mod.rs b/libc/src/unix/bsd/freebsdlike/mod.rs index cb3dba4..9829dde 100644 --- a/libc/src/unix/bsd/freebsdlike/mod.rs +++ b/libc/src/unix/bsd/freebsdlike/mod.rs @@ -664,10 +664,13 @@ pub const IP_RECVDSTADDR: ::c_int = 7; pub const IP_SENDSRCADDR: ::c_int = IP_RECVDSTADDR; pub const IP_ADD_MEMBERSHIP: ::c_int = 12; pub const IP_DROP_MEMBERSHIP: ::c_int = 13; +pub const IP_RECVIF: ::c_int = 20; pub const IPV6_JOIN_GROUP: ::c_int = 12; pub const IPV6_LEAVE_GROUP: ::c_int = 13; pub const IPV6_RECVPKTINFO: ::c_int = 36; pub const IPV6_PKTINFO: ::c_int = 46; +pub const IPV6_RECVTCLASS: ::c_int = 57; +pub const IPV6_TCLASS: ::c_int = 61; pub const TCP_NOPUSH: ::c_int = 4; pub const TCP_NOOPT: ::c_int = 8; diff --git a/libc/src/unix/bsd/mod.rs b/libc/src/unix/bsd/mod.rs index 770b9b9..03125c9 100644 --- a/libc/src/unix/bsd/mod.rs +++ b/libc/src/unix/bsd/mod.rs @@ -179,6 +179,7 @@ pub const SIG_SETMASK: ::c_int = 3; pub const SIG_BLOCK: ::c_int = 0x1; pub const SIG_UNBLOCK: ::c_int = 0x2; +pub const IP_TOS: ::c_int = 3; pub const IP_MULTICAST_IF: ::c_int = 9; pub const IP_MULTICAST_TTL: ::c_int = 10; pub const IP_MULTICAST_LOOP: ::c_int = 11; @@ -189,6 +190,12 @@ pub const IPV6_MULTICAST_HOPS: ::c_int = 10; pub const IPV6_MULTICAST_LOOP: ::c_int = 11; pub const IPV6_V6ONLY: ::c_int = 27; +pub const IPTOS_ECN_NOTECT: u8 = 0x00; +pub const IPTOS_ECN_MASK: u8 = 0x03; +pub const IPTOS_ECN_ECT1: u8 = 0x01; +pub const IPTOS_ECN_ECT0: u8 = 0x02; +pub const IPTOS_ECN_CE: u8 = 0x03; + pub const ST_RDONLY: ::c_ulong = 1; pub const SCM_RIGHTS: ::c_int = 0x01; diff --git a/libc/src/unix/bsd/netbsdlike/mod.rs b/libc/src/unix/bsd/netbsdlike/mod.rs index bfd541d..abd014c 100644 --- a/libc/src/unix/bsd/netbsdlike/mod.rs +++ b/libc/src/unix/bsd/netbsdlike/mod.rs @@ -430,6 +430,8 @@ pub const IP_ADD_MEMBERSHIP: ::c_int = 12; pub const IP_DROP_MEMBERSHIP: ::c_int = 13; pub const IPV6_RECVPKTINFO: ::c_int = 36; pub const IPV6_PKTINFO: ::c_int = 46; +pub const IPV6_RECVTCLASS: ::c_int = 57; +pub const IPV6_TCLASS: ::c_int = 61; pub const SOL_SOCKET: ::c_int = 0xffff; pub const SO_DEBUG: ::c_int = 0x01; diff --git a/libc/src/unix/bsd/netbsdlike/netbsd/mod.rs b/libc/src/unix/bsd/netbsdlike/netbsd/mod.rs index 55b8f4c..9c8173f 100644 --- a/libc/src/unix/bsd/netbsdlike/netbsd/mod.rs +++ b/libc/src/unix/bsd/netbsdlike/netbsd/mod.rs @@ -393,6 +393,9 @@ pub const F_GETNOSIGPIPE: ::c_int = 13; pub const F_SETNOSIGPIPE: ::c_int = 14; pub const F_MAXFD: ::c_int = 11; +pub const IP_RECVDSTADDR: ::c_int = 7; +pub const IP_SENDSRCADDR: ::c_int = IP_RECVDSTADDR; +pub const IP_RECVIF: ::c_int = 20; pub const IP_PKTINFO: ::c_int = 25; pub const IP_RECVPKTINFO: ::c_int = 26; pub const IPV6_JOIN_GROUP: ::c_int = 12; diff --git a/libc/src/unix/bsd/netbsdlike/openbsdlike/mod.rs b/libc/src/unix/bsd/netbsdlike/openbsdlike/mod.rs index 85f0a02..1c2e47d 100644 --- a/libc/src/unix/bsd/netbsdlike/openbsdlike/mod.rs +++ b/libc/src/unix/bsd/netbsdlike/openbsdlike/mod.rs @@ -319,6 +319,7 @@ pub const IPPROTO_DIVERT: ::c_int = 258; pub const IP_RECVDSTADDR: ::c_int = 7; pub const IP_SENDSRCADDR: ::c_int = IP_RECVDSTADDR; +pub const IP_RECVIF: ::c_int = 30; // sys/netinet/in.h pub const TCP_MD5SIG: ::c_int = 0x04; diff --git a/libc/src/unix/notbsd/android/mod.rs b/libc/src/unix/notbsd/android/mod.rs index 70052e1..972281c 100644 --- a/libc/src/unix/notbsd/android/mod.rs +++ b/libc/src/unix/notbsd/android/mod.rs @@ -666,6 +666,8 @@ pub const SO_RXQ_OVFL: ::c_int = 40; pub const SO_PEEK_OFF: ::c_int = 42; pub const SO_BUSY_POLL: ::c_int = 46; +pub const IPTOS_ECN_NOTECT: u8 = 0x00; + pub const O_ACCMODE: ::c_int = 3; pub const O_APPEND: ::c_int = 1024; pub const O_CREAT: ::c_int = 64; @@ -1056,6 +1058,7 @@ pub const O_TMPFILE: ::c_int = 0o20000000 | O_DIRECTORY; pub const MFD_CLOEXEC: ::c_uint = 0x0001; pub const MFD_ALLOW_SEALING: ::c_uint = 0x0002; +pub const MFD_HUGETLB: ::c_uint = 0x0004; // linux/netfilter.h pub const NF_DROP: ::c_int = 0; diff --git a/libc/src/unix/notbsd/linux/mips/mod.rs b/libc/src/unix/notbsd/linux/mips/mod.rs index b000d6d..8809bef 100644 --- a/libc/src/unix/notbsd/linux/mips/mod.rs +++ b/libc/src/unix/notbsd/linux/mips/mod.rs @@ -537,6 +537,9 @@ pub const MAP_HUGETLB: ::c_int = 0x080000; pub const EFD_NONBLOCK: ::c_int = 0x80; +pub const F_RDLCK: ::c_int = 0; +pub const F_WRLCK: ::c_int = 1; +pub const F_UNLCK: ::c_int = 2; pub const F_GETLK: ::c_int = 14; pub const F_GETOWN: ::c_int = 23; pub const F_SETOWN: ::c_int = 24; diff --git a/libc/src/unix/notbsd/linux/mod.rs b/libc/src/unix/notbsd/linux/mod.rs index 1aeceb1..8669a06 100644 --- a/libc/src/unix/notbsd/linux/mod.rs +++ b/libc/src/unix/notbsd/linux/mod.rs @@ -1320,6 +1320,7 @@ pub const CMSPAR: ::tcflag_t = 0o10000000000; pub const MFD_CLOEXEC: ::c_uint = 0x0001; pub const MFD_ALLOW_SEALING: ::c_uint = 0x0002; +pub const MFD_HUGETLB: ::c_uint = 0x0004; // these are used in the p_type field of Elf32_Phdr and Elf64_Phdr, which has // the type Elf32Word and Elf64Word respectively. Luckily, both of those are u32 @@ -1611,6 +1612,8 @@ pub const SIOCSIFMAP: ::c_ulong = 0x00008971; pub const IPTOS_TOS_MASK: u8 = 0x1E; pub const IPTOS_PREC_MASK: u8 = 0xE0; +pub const IPTOS_ECN_NOT_ECT: u8 = 0x00; + pub const RTF_UP: ::c_ushort = 0x0001; pub const RTF_GATEWAY: ::c_ushort = 0x0002; diff --git a/libc/src/unix/notbsd/linux/s390x.rs b/libc/src/unix/notbsd/linux/s390x.rs index 9196f88..9e3814f 100644 --- a/libc/src/unix/notbsd/linux/s390x.rs +++ b/libc/src/unix/notbsd/linux/s390x.rs @@ -791,6 +791,9 @@ pub const MAP_HUGETLB: ::c_int = 0x040000; pub const EFD_NONBLOCK: ::c_int = 0x800; +pub const F_RDLCK: ::c_int = 0; +pub const F_WRLCK: ::c_int = 1; +pub const F_UNLCK: ::c_int = 2; pub const F_GETLK: ::c_int = 5; pub const F_GETOWN: ::c_int = 9; pub const F_SETOWN: ::c_int = 8; diff --git a/libc/src/unix/notbsd/mod.rs b/libc/src/unix/notbsd/mod.rs index 9557d1b..6ff0807 100644 --- a/libc/src/unix/notbsd/mod.rs +++ b/libc/src/unix/notbsd/mod.rs @@ -623,9 +623,11 @@ pub const SOCK_RDM: ::c_int = 4; pub const IP_MULTICAST_IF: ::c_int = 32; pub const IP_MULTICAST_TTL: ::c_int = 33; pub const IP_MULTICAST_LOOP: ::c_int = 34; +pub const IP_TOS: ::c_int = 1; pub const IP_TTL: ::c_int = 2; pub const IP_HDRINCL: ::c_int = 3; pub const IP_PKTINFO: ::c_int = 8; +pub const IP_RECVTOS: ::c_int = 13; pub const IP_ADD_MEMBERSHIP: ::c_int = 35; pub const IP_DROP_MEMBERSHIP: ::c_int = 36; pub const IP_TRANSPARENT: ::c_int = 19; @@ -638,6 +640,8 @@ pub const IPV6_DROP_MEMBERSHIP: ::c_int = 21; pub const IPV6_V6ONLY: ::c_int = 26; pub const IPV6_RECVPKTINFO: ::c_int = 49; pub const IPV6_PKTINFO: ::c_int = 50; +pub const IPV6_RECVTCLASS: ::c_int = 66; +pub const IPV6_TCLASS: ::c_int = 67; pub const TCP_NODELAY: ::c_int = 1; pub const TCP_MAXSEG: ::c_int = 2; @@ -874,6 +878,11 @@ pub const IPTOS_PREC_IMMEDIATE: u8 = 0x40; pub const IPTOS_PREC_PRIORITY: u8 = 0x20; pub const IPTOS_PREC_ROUTINE: u8 = 0x00; +pub const IPTOS_ECN_MASK: u8 = 0x03; +pub const IPTOS_ECN_ECT1: u8 = 0x01; +pub const IPTOS_ECN_ECT0: u8 = 0x02; +pub const IPTOS_ECN_CE: u8 = 0x03; + pub const IPOPT_COPY: u8 = 0x80; pub const IPOPT_CLASS_MASK: u8 = 0x60; pub const IPOPT_NUMBER_MASK: u8 = 0x1f; @@ -1087,6 +1096,10 @@ f! { pub fn IPOPT_NUMBER(o: u8) -> u8 { o & IPOPT_NUMBER_MASK } + + pub fn IPTOS_ECN(x: u8) -> u8 { + x & ::IPTOS_ECN_MASK + } } extern { diff --git a/libc/src/windows/gnu.rs b/libc/src/windows/gnu.rs index a67af15..45e7dda 100644 --- a/libc/src/windows/gnu.rs +++ b/libc/src/windows/gnu.rs @@ -1,8 +1,13 @@ pub const L_tmpnam: ::c_uint = 14; pub const TMP_MAX: ::c_uint = 0x7fff; +// stdio file descriptor numbers +pub const STDIN_FILENO: ::c_int = 0; +pub const STDOUT_FILENO: ::c_int = 1; +pub const STDERR_FILENO: ::c_int = 2; + extern { pub fn strcasecmp(s1: *const ::c_char, s2: *const ::c_char) -> ::c_int; pub fn strncasecmp(s1: *const ::c_char, s2: *const ::c_char, - n: ::size_t) -> ::c_int; + n: ::size_t) -> ::c_int; } diff --git a/libc/src/windows/mod.rs b/libc/src/windows/mod.rs index f46eb36..4bea459 100644 --- a/libc/src/windows/mod.rs +++ b/libc/src/windows/mod.rs @@ -27,6 +27,7 @@ pub type ptrdiff_t = isize; pub type intptr_t = isize; pub type uintptr_t = usize; pub type ssize_t = isize; +pub type sighandler_t = usize; pub type c_char = i8; pub type c_long = i32; @@ -49,6 +50,8 @@ pub type ino_t = u16; pub enum timezone {} pub type time64_t = i64; +pub type SOCKET = ::uintptr_t; + s! { // note this is the struct called stat64 in Windows. Not stat, nor stati64. pub struct stat { @@ -72,15 +75,15 @@ s! { } pub struct tm { - tm_sec: ::c_int, - tm_min: ::c_int, - tm_hour: ::c_int, - tm_mday: ::c_int, - tm_mon: ::c_int, - tm_year: ::c_int, - tm_wday: ::c_int, - tm_yday: ::c_int, - tm_isdst: ::c_int, + pub tm_sec: ::c_int, + pub tm_min: ::c_int, + pub tm_hour: ::c_int, + pub tm_mday: ::c_int, + pub tm_mon: ::c_int, + pub tm_year: ::c_int, + pub tm_wday: ::c_int, + pub tm_yday: ::c_int, + pub tm_isdst: ::c_int, } pub struct timeval { @@ -92,6 +95,11 @@ s! { pub tv_sec: time_t, pub tv_nsec: c_long, } + + pub struct sockaddr { + pub sa_family: c_ushort, + pub sa_data: [c_char; 14], + } } pub const INT_MIN: c_int = -2147483648; @@ -177,6 +185,16 @@ pub const ENOTEMPTY: ::c_int = 41; pub const EILSEQ: ::c_int = 42; pub const STRUNCATE: ::c_int = 80; +// signal codes +pub const SIGINT: ::c_int = 2; +pub const SIGILL: ::c_int = 4; +pub const SIGFPE: ::c_int = 8; +pub const SIGSEGV: ::c_int = 11; +pub const SIGTERM: ::c_int = 15; +pub const SIGABRT: ::c_int = 22; +pub const NSIG: ::c_int = 23; +pub const SIG_ERR: ::c_int = -1; + // inline comment below appeases style checker #[cfg(all(target_env = "msvc", feature = "rustc-dep-of-std"))] // " if " #[link(name = "msvcrt", cfg(not(target_feature = "crt-static")))] @@ -287,6 +305,9 @@ extern { pub fn rand() -> c_int; pub fn srand(seed: c_uint); + pub fn signal(signum: c_int, handler: sighandler_t) -> sighandler_t; + pub fn raise(signum: c_int) -> c_int; + #[link_name = "_chmod"] pub fn chmod(path: *const c_char, mode: ::c_int) -> ::c_int; #[link_name = "_wchmod"] @@ -369,6 +390,34 @@ extern { locale: *const wchar_t) -> *mut wchar_t; } +extern "system" { + pub fn listen(s: SOCKET, backlog: ::c_int) -> ::c_int; + pub fn accept(s: SOCKET, addr: *mut ::sockaddr, + addrlen: *mut ::c_int) -> SOCKET; + pub fn bind(s: SOCKET, name: *const ::sockaddr, + namelen: ::c_int) -> ::c_int; + pub fn connect(s: SOCKET, name: *const ::sockaddr, + namelen: ::c_int) -> ::c_int; + pub fn getpeername(s: SOCKET, name: *mut ::sockaddr, + nameln: *mut ::c_int) -> ::c_int; + pub fn getsockname(s: SOCKET, name: *mut ::sockaddr, + nameln: *mut ::c_int) -> ::c_int; + pub fn getsockopt(s: SOCKET, level: ::c_int, optname: ::c_int, + optval: *mut ::c_char, + optlen: *mut ::c_int) -> ::c_int; + pub fn recvfrom(s: SOCKET, buf: *mut ::c_char, len: ::c_int, + flags: ::c_int, from: *mut ::sockaddr, + fromlen: *mut ::c_int) -> ::c_int; + pub fn sendto(s: SOCKET, buf: *const ::c_char, len: ::c_int, + flags: ::c_int, to: *const ::sockaddr, + tolen: ::c_int) -> ::c_int; + pub fn setsockopt(s: SOCKET, level: ::c_int, optname: ::c_int, + optval: *const ::c_char, + optlen: ::c_int) -> ::c_int; + pub fn socket(af: ::c_int, socket_type: ::c_int, + protocol: ::c_int) -> SOCKET; +} + cfg_if! { if #[cfg(core_cvoid)] { pub use core::ffi::c_void; diff --git a/libc/src/windows/msvc.rs b/libc/src/windows/msvc.rs index 9e2a9b9..1ebfcad 100644 --- a/libc/src/windows/msvc.rs +++ b/libc/src/windows/msvc.rs @@ -7,4 +7,4 @@ extern { #[link_name = "_strnicmp"] pub fn strnicmp(s1: *const ::c_char, s2: *const ::c_char, n: ::size_t) -> ::c_int; -}
\ No newline at end of file +} |