summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2019-05-16 11:19:32 +0000
committerbors <bors@rust-lang.org>2019-05-16 11:19:32 +0000
commit8b14a7e95bd4f13707a1c4383bdb54222921098f (patch)
treee7996dfb59a4cd97bf38ebb56de476377b6a2c5d
parent5408b1079cda9700bd6efe29c374af862d897890 (diff)
parenta92266b0fe2de4781b327b9ea85fdcfb357b2aca (diff)
downloadrust-libc-8b14a7e95bd4f13707a1c4383bdb54222921098f.tar.gz
Auto merge of #1335 - leo60228:patch-1, r=gnzlbg
Improve newlib constants This is necessary to set socket options on the Nintendo Switch, which uses a socket implementation directly ported from FreeBSD. Reopened from #1334 because I accidentally closed that.
-rw-r--r--.travis.yml21
-rw-r--r--ci/switch.json37
-rw-r--r--src/unix/newlib/mod.rs67
3 files changed, 113 insertions, 12 deletions
diff --git a/.travis.yml b/.travis.yml
index ad8df07637..1fa0a8d368 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -207,6 +207,27 @@ matrix:
- env: TARGET=wasm32-wasi
rust: nightly
stage: tier2
+ - name: "Nintendo Switch - build libcore only"
+ rust: nightly
+ stage: tier2
+ install:
+ - rustup component add rust-src
+ - (test -x $HOME/.cargo/bin/cargo-xbuild || cargo install cargo-xbuild)
+ script:
+ - mkdir -p target
+ - cd target
+ - wget https://github.com/devkitPro/pacman/releases/download/devkitpro-pacman-1.0.1/devkitpro-pacman.deb
+ - sudo dpkg -i devkitpro-pacman.deb
+ - sudo dkp-pacman -Sy
+ - sudo dkp-pacman -Syu
+ - sudo dkp-pacman -S -v --noconfirm switch-dev devkitA64
+ - export PATH="$PATH:/opt/devkitpro/devkitA64/bin"
+ - export PATH="$PATH:/opt/devkitpro/tools/bin"
+ - cd ..
+ # Pull the target spec up into the current directory and then build
+ - mv ci/switch.json switch.json
+ - cargo xbuild --target switch.json
+
allow_failures:
# FIXME: android build bots time out irregularly
diff --git a/ci/switch.json b/ci/switch.json
new file mode 100644
index 0000000000..bc1894879d
--- /dev/null
+++ b/ci/switch.json
@@ -0,0 +1,37 @@
+{
+ "family": "unix",
+ "env": "newlib",
+ "target-env": "newlib",
+ "target-family": "unix",
+ "target-c-int-width": "32",
+ "target-endian": "little",
+ "target-pointer-width": "64",
+ "os": "horizon",
+ "arch": "aarch64",
+ "panic-strategy": "unwind",
+ "abi-blacklist": [
+ "stdcall",
+ "fastcall",
+ "vectorcall",
+ "thiscall",
+ "win64",
+ "sysv64"
+ ],
+ "dynamic-linking" : false,
+ "features": "+a53,+strict-align",
+ "data-layout": "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128",
+ "executables": true,
+ "position-independent-executables" : true,
+ "linker-flavor": "gcc",
+ "llvm-target": "aarch64-unknown-none",
+ "has-elf-tls" : false,
+ "linker-is-gnu" : true,
+ "disable-redzone" : true,
+ "relocation-model" : "pic",
+ "max-atomic-width": 128,
+ "exe-suffix": ".elf",
+ "staticlib-suffix" : ".a",
+ "trap-unreachable" : true,
+ "emit-debug-gdb-scripts" : true,
+ "requires-uwtable" : true
+} \ No newline at end of file
diff --git a/src/unix/newlib/mod.rs b/src/unix/newlib/mod.rs
index 791edb39cf..c9a25a35d4 100644
--- a/src/unix/newlib/mod.rs
+++ b/src/unix/newlib/mod.rs
@@ -406,7 +406,8 @@ pub const SEEK_SET: ::c_int = 0;
pub const SEEK_CUR: ::c_int = 1;
pub const SEEK_END: ::c_int = 2;
-pub const FIONBIO: ::c_int = 1;
+pub const FIONBIO: ::c_ulong = 1;
+pub const FIOCLEX: ::c_ulong = 0x20006601;
pub const S_BLKSIZE: ::mode_t = 1024;
pub const S_IREAD: ::mode_t = 256;
@@ -457,15 +458,41 @@ pub const SHUT_RD: ::c_int = 0;
pub const SHUT_WR: ::c_int = 1;
pub const SHUT_RDWR: ::c_int = 2;
-pub const SO_REUSEADDR: ::c_int = 4;
-pub const SO_LINGER: ::c_int = 128;
-pub const SO_OOBINLINE: ::c_int = 256;
-pub const SO_SNDBUF: ::c_int = 4097;
-pub const SO_RCVBUF: ::c_int = 4098;
-pub const SO_SNDLOWAT: ::c_int = 4099;
-pub const SO_RCVLOWAT: ::c_int = 4100;
-pub const SO_TYPE: ::c_int = 4104;
-pub const SO_ERROR: ::c_int = 4105;
+pub const SO_BINTIME: ::c_int = 0x2000;
+pub const SO_NO_OFFLOAD: ::c_int = 0x4000;
+pub const SO_NO_DDP: ::c_int = 0x8000;
+pub const SO_REUSEPORT_LB: ::c_int = 0x10000;
+pub const SO_LABEL: ::c_int = 0x1009;
+pub const SO_PEERLABEL: ::c_int = 0x1010;
+pub const SO_LISTENQLIMIT: ::c_int = 0x1011;
+pub const SO_LISTENQLEN: ::c_int = 0x1012;
+pub const SO_LISTENINCQLEN: ::c_int = 0x1013;
+pub const SO_SETFIB: ::c_int = 0x1014;
+pub const SO_USER_COOKIE: ::c_int = 0x1015;
+pub const SO_PROTOCOL: ::c_int = 0x1016;
+pub const SO_PROTOTYPE: ::c_int = SO_PROTOCOL;
+pub const SO_VENDOR: ::c_int = 0x80000000;
+pub const SO_DEBUG: ::c_int = 0x01;
+pub const SO_ACCEPTCONN: ::c_int = 0x0002;
+pub const SO_REUSEADDR: ::c_int = 0x0004;
+pub const SO_KEEPALIVE: ::c_int = 0x0008;
+pub const SO_DONTROUTE: ::c_int = 0x0010;
+pub const SO_BROADCAST: ::c_int = 0x0020;
+pub const SO_USELOOPBACK: ::c_int = 0x0040;
+pub const SO_LINGER: ::c_int = 0x0080;
+pub const SO_OOBINLINE: ::c_int = 0x0100;
+pub const SO_REUSEPORT: ::c_int = 0x0200;
+pub const SO_TIMESTAMP: ::c_int = 0x0400;
+pub const SO_NOSIGPIPE: ::c_int = 0x0800;
+pub const SO_ACCEPTFILTER: ::c_int = 0x1000;
+pub const SO_SNDBUF: ::c_int = 0x1001;
+pub const SO_RCVBUF: ::c_int = 0x1002;
+pub const SO_SNDLOWAT: ::c_int = 0x1003;
+pub const SO_RCVLOWAT: ::c_int = 0x1004;
+pub const SO_SNDTIMEO: ::c_int = 0x1005;
+pub const SO_RCVTIMEO: ::c_int = 0x1006;
+pub const SO_ERROR: ::c_int = 0x1007;
+pub const SO_TYPE: ::c_int = 0x1008;
pub const SOCK_CLOEXEC: ::c_int = O_CLOEXEC;
@@ -493,14 +520,30 @@ pub const IFF_MULTICAST: ::c_int = 0x8000; // supports multicast
pub const TCP_NODELAY: ::c_int = 8193;
pub const TCP_MAXSEG: ::c_int = 8194;
+pub const TCP_NOPUSH: ::c_int = 4;
+pub const TCP_NOOPT: ::c_int = 8;
+pub const TCP_KEEPIDLE: ::c_int = 256;
+pub const TCP_KEEPINTVL: ::c_int = 512;
+pub const TCP_KEEPCNT: ::c_int = 1024;
-pub const IP_TOS: ::c_int = 7;
+pub const IP_TOS: ::c_int = 3;
pub const IP_TTL: ::c_int = 8;
-pub const IP_MULTICAST_LOOP: ::c_int = 9;
+pub const IP_MULTICAST_IF: ::c_int = 9;
pub const IP_MULTICAST_TTL: ::c_int = 10;
+pub const IP_MULTICAST_LOOP: ::c_int = 11;
pub const IP_ADD_MEMBERSHIP: ::c_int = 11;
pub const IP_DROP_MEMBERSHIP: ::c_int = 12;
+pub const IPV6_UNICAST_HOPS: ::c_int = 4;
+pub const IPV6_MULTICAST_IF: ::c_int = 9;
+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 IPV6_JOIN_GROUP: ::c_int = 12;
+pub const IPV6_LEAVE_GROUP: ::c_int = 13;
+pub const IPV6_ADD_MEMBERSHIP: ::c_int = 12;
+pub const IPV6_DROP_MEMBERSHIP: ::c_int = 13;
+
pub const HOST_NOT_FOUND: ::c_int = 1;
pub const NO_DATA: ::c_int = 2;
pub const NO_ADDRESS: ::c_int = 2;