Skip to content

Commit 67b4872

Browse files
authored
Merge branch 'master' into socket-mss
2 parents 76fe409 + aaec214 commit 67b4872

37 files changed

+576
-169
lines changed

.cirrus.yml

Lines changed: 78 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -2,27 +2,53 @@ cargo_cache:
22
folder: $CARGO_HOME/registry
33
fingerprint_script: cat Cargo.lock || echo ""
44

5+
env:
6+
# Build by default; don't just check
7+
BUILD: build
8+
RUSTFLAGS: -D warnings
9+
RUSTDOCFLAGS: -D warnings
10+
TOOL: cargo
11+
# The MSRV
12+
TOOLCHAIN: 1.46.0
13+
ZFLAGS:
14+
15+
# Tests that don't require executing the build binaries
16+
build: &BUILD
17+
build_script:
18+
- . $HOME/.cargo/env || true
19+
- $TOOL +$TOOLCHAIN $BUILD $ZFLAGS --target $TARGET --all-targets
20+
- $TOOL +$TOOLCHAIN doc $ZFLAGS --no-deps --target $TARGET
21+
22+
# Tests that do require executing the binaries
23+
test: &TEST
24+
<< : *BUILD
25+
test_script:
26+
- . $HOME/.cargo/env || true
27+
- $TOOL +$TOOLCHAIN test --target $TARGET
28+
529
# Test FreeBSD in a full VM. Test the i686 target too, in the
630
# same VM. The binary will be built in 32-bit mode, but will execute on a
731
# 64-bit kernel and in a 64-bit environment. Our tests don't execute any of
832
# the system's binaries, so the environment shouldn't matter.
933
task:
1034
name: FreeBSD amd64 & i686
35+
env:
36+
TARGET: x86_64-unknown-freebsd
1137
freebsd_instance:
1238
image: freebsd-11-4-release-amd64
1339
setup_script:
1440
- fetch https://sh.rustup.rs -o rustup.sh
15-
- sh rustup.sh -y --profile=minimal --default-toolchain 1.46.0
41+
- sh rustup.sh -y --profile=minimal --default-toolchain $TOOLCHAIN
1642
- $HOME/.cargo/bin/rustup target add i686-unknown-freebsd
17-
amd64_test_script:
18-
- . $HOME/.cargo/env
19-
- cargo test
43+
<< : *TEST
2044
i386_test_script:
2145
- . $HOME/.cargo/env
46+
- cargo build --target i686-unknown-freebsd
47+
- cargo doc --no-deps --target i686-unknown-freebsd
2248
- cargo test --target i686-unknown-freebsd
2349
before_cache_script: rm -rf $CARGO_HOME/registry/index
2450

25-
# Test OSX and iOS in a full VM
51+
# Test OSX in a full VM
2652
task:
2753
matrix:
2854
- name: OSX x86_64
@@ -32,13 +58,9 @@ task:
3258
image: catalina-xcode
3359
setup_script:
3460
- curl --proto '=https' --tlsv1.2 -sSf -o rustup.sh https://sh.rustup.rs
35-
- sh rustup.sh -y --profile=minimal --default-toolchain 1.46.0
36-
- . $HOME/.cargo/env
37-
- cargo install cross
38-
script:
61+
- sh rustup.sh -y --profile=minimal --default-toolchain $TOOLCHAIN
3962
- . $HOME/.cargo/env
40-
- cross build --target $TARGET
41-
- cross test --target $TARGET
63+
<< : *TEST
4264
before_cache_script: rm -rf $CARGO_HOME/registry/index
4365

4466
# Use cross for QEMU-based testing
@@ -48,10 +70,9 @@ task:
4870
RUST_TEST_THREADS: 1 # QEMU works best with 1 thread
4971
HOME: /tmp/home
5072
PATH: $HOME/.cargo/bin:$PATH
73+
RUSTFLAGS: --cfg qemu -D warnings
74+
TOOL: cross
5175
matrix:
52-
- name: Linux aarch64
53-
env:
54-
TARGET: aarch64-unknown-linux-gnu
5576
- name: Linux arm gnueabi
5677
env:
5778
TARGET: arm-unknown-linux-gnueabi
@@ -88,46 +109,48 @@ task:
88109
setup_script:
89110
- mkdir /tmp/home
90111
- curl --proto '=https' --tlsv1.2 -sSf -o rustup.sh https://sh.rustup.rs
91-
- sh rustup.sh -y --profile=minimal --default-toolchain 1.46.0
112+
- sh rustup.sh -y --profile=minimal --default-toolchain $TOOLCHAIN
92113
- . $HOME/.cargo/env
93114
- cargo install cross
94-
script:
95-
- . $HOME/.cargo/env || true
96-
- cross build --target $TARGET
97-
- cross test --target $TARGET
115+
<< : *TEST
98116
before_cache_script: rm -rf $CARGO_HOME/registry/index
99117

100-
# Tasks for Linux amd64 builds
118+
# Tasks for Linux native builds
101119
task:
102120
matrix:
103121
- name: Rust Stable
122+
container:
123+
image: rust:latest
104124
env:
105125
TARGET: x86_64-unknown-linux-gnu
106-
TOOLCHAIN: stable
126+
TOOLCHAIN:
127+
- name: Linux aarch64
128+
arm_container:
129+
image: rust:1.46
130+
env:
131+
RUSTFLAGS: --cfg graviton -D warnings
132+
TARGET: aarch64-unknown-linux-gnu
107133
- name: Linux x86_64
134+
container:
135+
image: rust:1.46
108136
env:
109137
TARGET: x86_64-unknown-linux-gnu
110-
TOOLCHAIN: 1.46.0
111138
- name: Linux x86_64 musl
139+
container:
140+
image: rust:1.46
112141
env:
113142
TARGET: x86_64-unknown-linux-musl
114-
TOOLCHAIN: 1.46.0
115-
container:
116-
image: rust:1.46
117143
setup_script:
118-
- rustup toolchain install $TOOLCHAIN
119-
- rustup target add --toolchain $TOOLCHAIN $TARGET
120-
script:
121-
- cargo +$TOOLCHAIN build --target $TARGET --all-targets
122-
- cargo +$TOOLCHAIN test --target $TARGET
144+
- rustup target add $TARGET
145+
<< : *TEST
123146
before_cache_script: rm -rf $CARGO_HOME/registry/index
124147

125148
# Tasks for cross-compiling, but no testing
126149
task:
127150
container:
128151
image: rust:1.46
129152
env:
130-
TOOLCHAIN: 1.46.0
153+
BUILD: check
131154
matrix:
132155
# Cross claims to support Android, but when it tries to run Nix's tests it
133156
# reports undefined symbol references.
@@ -166,8 +189,7 @@ task:
166189
TARGET: aarch64-apple-ios
167190
# Rustup only supports cross-building from arbitrary hosts for iOS at
168191
# 1.49.0 and above. Below that it's possible to cross-build from an OSX
169-
# host, but OSX VMs
170-
# are more expensive than Linux VMs.
192+
# host, but OSX VMs are more expensive than Linux VMs.
171193
TOOLCHAIN: 1.49.0
172194
- name: iOS x86_64
173195
env:
@@ -202,16 +224,36 @@ task:
202224
setup_script:
203225
- rustup target add $TARGET
204226
- rustup toolchain install $TOOLCHAIN --profile minimal --target $TARGET
205-
script:
206-
- cargo +$TOOLCHAIN check --target $TARGET
207-
- cargo +$TOOLCHAIN check --all-targets --target $TARGET
227+
<< : *BUILD
228+
before_cache_script: rm -rf $CARGO_HOME/registry/index
229+
230+
# Rust Tier 3 targets can't use Rustup
231+
task:
232+
container:
233+
image: rustlang/rust:nightly
234+
env:
235+
BUILD: check
236+
TOOLCHAIN: nightly
237+
ZFLAGS: -Zbuild-std
238+
matrix:
239+
- name: DragonFly BSD x86_64
240+
env:
241+
TARGET: x86_64-unknown-dragonfly
242+
- name: OpenBSD x86_64
243+
env:
244+
TARGET: x86_64-unknown-openbsd
245+
setup_script:
246+
- rustup component add rust-src
247+
<< : *BUILD
208248
before_cache_script: rm -rf $CARGO_HOME/registry/index
209249

210250
# Test that we can build with the lowest version of all dependencies.
211251
# "cargo test" doesn't work because some of our dev-dependencies, like
212252
# rand, can't build with their own minimal dependencies.
213253
task:
214254
name: Minver
255+
env:
256+
TOOLCHAIN: nightly
215257
container:
216258
image: rustlang/rust:nightly
217259
setup_script:

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,10 @@ This project adheres to [Semantic Versioning](https://semver.org/).
3030
(#[1335](https://github.com/nix-rust/nix/pull/1335))
3131
- Exposed `SockAddr::from_raw_sockaddr`
3232
(#[1447](https://github.com/nix-rust/nix/pull/1447))
33+
- Added `TcpRepair`
34+
(#[1503](https://github.com/nix-rust/nix/pull/1503))
35+
- Enabled `pwritev` and `preadv` for more operating systems.
36+
(#[1511](https://github.com/nix-rust/nix/pull/1511))
3337
- Added support for `TCP_MAXSEG` TCP Maximum Segment Size socket options
3438
(#[1292](https://github.com/nix-rust/nix/pull/1292))
3539

@@ -76,6 +80,7 @@ This project adheres to [Semantic Versioning](https://semver.org/).
7680
- Removed a couple of termios constants on redox that were never actually
7781
supported.
7882
(#[1483](https://github.com/nix-rust/nix/pull/1483))
83+
7984
- Removed `nix::sys::signal::NSIG`. It was of dubious utility, and not correct
8085
for all platforms.
8186
(#[1484](https://github.com/nix-rust/nix/pull/1484))
@@ -87,6 +92,9 @@ This project adheres to [Semantic Versioning](https://semver.org/).
8792
- Deprecated `SockAddr/InetAddr::to_str` in favor of `ToString::to_string`
8893
(#[1495](https://github.com/nix-rust/nix/pull/1495))
8994

95+
- Removed `SigevNotify` on OpenBSD and Redox.
96+
(#[1511](https://github.com/nix-rust/nix/pull/1511))
97+
9098
## [0.22.0] - 9 July 2021
9199
### Added
92100
- Added `if_nameindex` (#[1445](https://github.com/nix-rust/nix/pull/1445))

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ targets = [
2525
]
2626

2727
[dependencies]
28-
libc = { git = "https://github.com/rust-lang/libc", rev = "f5e31f208", features = [ "extra_traits" ] }
28+
libc = { git = "https://github.com/rust-lang/libc", rev = "621a95373", features = [ "extra_traits" ] }
2929
bitflags = "1.3.1"
3030
cfg-if = "1.0"
3131

Cross.toml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,5 @@
11
[build.env]
2-
passthrough = ["RUST_TEST_THREADS"]
2+
passthrough = [
3+
"RUSTFLAGS",
4+
"RUST_TEST_THREADS"
5+
]

README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,12 +74,15 @@ Tier 2:
7474
* s390x-unknown-linux-gnu
7575
* x86_64-apple-ios
7676
* x86_64-linux-android
77+
* x86_64-unknown-illumos
7778
* x86_64-unknown-netbsd
7879

7980
Tier 3:
8081
* x86_64-fuchsia
81-
* x86_64-unknown-redox
82+
* x86_64-unknown-dragonfly
8283
* x86_64-unknown-linux-gnux32
84+
* x86_64-unknown-openbsd
85+
* x86_64-unknown-redox
8386

8487
## Usage
8588

bors.toml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ status = [
44
"Android armv7",
55
"Android i686",
66
"Android x86_64",
7+
"DragonFly BSD x86_64",
78
"FreeBSD amd64 & i686",
89
"Fuchsia x86_64",
910
"Linux MIPS",
@@ -25,12 +26,13 @@ status = [
2526
"Linux x86_64",
2627
"Minver",
2728
"NetBSD x86_64",
29+
"OpenBSD x86_64",
2830
"OSX x86_64",
2931
"Redox x86_64",
3032
"Rust Stable",
3133
"iOS aarch64",
3234
"iOS x86_64",
33-
"illumos",
35+
"Illumos",
3436
]
3537

3638
# Set bors's timeout to 1 hour

src/env.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
//! Environment variables
12
use cfg_if::cfg_if;
23
use std::fmt;
34

src/lib.rs

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,13 @@
55
#![crate_name = "nix"]
66
#![cfg(unix)]
77
#![allow(non_camel_case_types)]
8-
// latest bitflags triggers a rustc bug with cross-crate macro expansions causing dead_code
9-
// warnings even though the macro expands into something with allow(dead_code)
10-
#![allow(dead_code)]
118
#![cfg_attr(test, deny(warnings))]
129
#![recursion_limit = "500"]
1310
#![deny(unused)]
1411
#![deny(unstable_features)]
1512
#![deny(missing_copy_implementations)]
1613
#![deny(missing_debug_implementations)]
14+
#![warn(missing_docs)]
1715

1816
// Re-exported external crates
1917
pub use libc;
@@ -23,13 +21,14 @@ pub use libc;
2321

2422
// Public crates
2523
#[cfg(not(target_os = "redox"))]
24+
#[allow(missing_docs)]
2625
pub mod dir;
2726
pub mod env;
27+
#[allow(missing_docs)]
2828
pub mod errno;
29-
#[deny(missing_docs)]
3029
pub mod features;
30+
#[allow(missing_docs)]
3131
pub mod fcntl;
32-
#[deny(missing_docs)]
3332
#[cfg(any(target_os = "android",
3433
target_os = "dragonfly",
3534
target_os = "freebsd",
@@ -42,6 +41,7 @@ pub mod fcntl;
4241
pub mod ifaddrs;
4342
#[cfg(any(target_os = "android",
4443
target_os = "linux"))]
44+
#[allow(missing_docs)]
4545
pub mod kmod;
4646
#[cfg(any(target_os = "android",
4747
target_os = "freebsd",
@@ -52,23 +52,24 @@ pub mod mount;
5252
target_os = "fushsia",
5353
target_os = "linux",
5454
target_os = "netbsd"))]
55+
#[allow(missing_docs)]
5556
pub mod mqueue;
56-
#[deny(missing_docs)]
5757
#[cfg(not(target_os = "redox"))]
5858
pub mod net;
59-
#[deny(missing_docs)]
6059
pub mod poll;
61-
#[deny(missing_docs)]
6260
#[cfg(not(any(target_os = "redox", target_os = "fuchsia")))]
6361
pub mod pty;
6462
pub mod sched;
6563
pub mod sys;
64+
#[allow(missing_docs)]
6665
pub mod time;
6766
// This can be implemented for other platforms as soon as libc
6867
// provides bindings for them.
6968
#[cfg(all(target_os = "linux",
7069
any(target_arch = "x86", target_arch = "x86_64")))]
70+
#[allow(missing_docs)]
7171
pub mod ucontext;
72+
#[allow(missing_docs)]
7273
pub mod unistd;
7374

7475
/*
@@ -101,11 +102,17 @@ pub type Result<T> = result::Result<T, Errno>;
101102
/// ones.
102103
pub type Error = Errno;
103104

105+
/// Common trait used to represent file system paths by many Nix functions.
104106
pub trait NixPath {
107+
/// Is the path empty?
105108
fn is_empty(&self) -> bool;
106109

110+
/// Length of the path in bytes
107111
fn len(&self) -> usize;
108112

113+
/// Execute a function with this path as a `CStr`.
114+
///
115+
/// Mostly used internally by Nix.
109116
fn with_nix_path<T, F>(&self, f: F) -> Result<T>
110117
where F: FnOnce(&CStr) -> T;
111118
}

src/mount/bsd.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -347,6 +347,7 @@ impl<'a> Nmount<'a> {
347347
self
348348
}
349349

350+
/// Create a new `Nmount` struct with no options
350351
pub fn new() -> Self {
351352
Self::default()
352353
}

0 commit comments

Comments
 (0)