Skip to content

Commit 5465167

Browse files
bors[bot]asomers
andauthored
Merge #1511
1511: Document more things r=asomers a=asomers Also, test rustdoc in CI, and demote missing_docs from a deny to a warning (but still deny it in CI). Co-authored-by: Alan Somers <[email protected]>
2 parents 39c6366 + a757be7 commit 5465167

File tree

17 files changed

+306
-53
lines changed

17 files changed

+306
-53
lines changed

.cirrus.yml

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

5+
env:
6+
RUSTFLAGS: -D warnings
7+
RUSTDOCFLAGS: -D warnings
58
# Test FreeBSD in a full VM. Test the i686 target too, in the
69
# same VM. The binary will be built in 32-bit mode, but will execute on a
710
# 64-bit kernel and in a 64-bit environment. Our tests don't execute any of
@@ -17,9 +20,11 @@ task:
1720
amd64_test_script:
1821
- . $HOME/.cargo/env
1922
- cargo test
23+
- cargo doc --no-deps
2024
i386_test_script:
2125
- . $HOME/.cargo/env
2226
- cargo test --target i686-unknown-freebsd
27+
- cargo doc --no-deps --target i686-unknown-freebsd
2328
before_cache_script: rm -rf $CARGO_HOME/registry/index
2429

2530
# Test OSX and iOS in a full VM
@@ -48,7 +53,7 @@ task:
4853
RUST_TEST_THREADS: 1 # QEMU works best with 1 thread
4954
HOME: /tmp/home
5055
PATH: $HOME/.cargo/bin:$PATH
51-
RUSTFLAGS: --cfg qemu
56+
RUSTFLAGS: --cfg qemu -D warnings
5257
matrix:
5358
- name: Linux arm gnueabi
5459
env:
@@ -93,6 +98,7 @@ task:
9398
- . $HOME/.cargo/env || true
9499
- cross build --target $TARGET
95100
- cross test --target $TARGET
101+
- cross doc --no-deps --target $TARGET
96102
before_cache_script: rm -rf $CARGO_HOME/registry/index
97103

98104
# Tasks for Linux native builds
@@ -107,7 +113,7 @@ task:
107113
arm_container:
108114
image: rust:1.46
109115
env:
110-
RUSTFLAGS: --cfg graviton
116+
RUSTFLAGS: --cfg graviton -D warnings
111117
TARGET: aarch64-unknown-linux-gnu
112118
- name: Linux x86_64
113119
container:
@@ -125,6 +131,7 @@ task:
125131
script:
126132
- cargo build --target $TARGET --all-targets
127133
- cargo test --target $TARGET
134+
- cargo doc --no-deps --target $TARGET
128135
before_cache_script: rm -rf $CARGO_HOME/registry/index
129136

130137
# Tasks for cross-compiling, but no testing
@@ -210,6 +217,7 @@ task:
210217
script:
211218
- cargo +$TOOLCHAIN check --target $TARGET
212219
- cargo +$TOOLCHAIN check --all-targets --target $TARGET
220+
- cargo +$TOOLCHAIN doc --no-deps --target $TARGET
213221
before_cache_script: rm -rf $CARGO_HOME/registry/index
214222

215223
# Test that we can build with the lowest version of all dependencies.

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ This project adheres to [Semantic Versioning](https://semver.org/).
3232
(#[1447](https://github.com/nix-rust/nix/pull/1447))
3333
- Added `TcpRepair`
3434
(#[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))
3537

3638
### Changed
3739

@@ -76,6 +78,7 @@ This project adheres to [Semantic Versioning](https://semver.org/).
7678
- Removed a couple of termios constants on redox that were never actually
7779
supported.
7880
(#[1483](https://github.com/nix-rust/nix/pull/1483))
81+
7982
- Removed `nix::sys::signal::NSIG`. It was of dubious utility, and not correct
8083
for all platforms.
8184
(#[1484](https://github.com/nix-rust/nix/pull/1484))
@@ -87,6 +90,9 @@ This project adheres to [Semantic Versioning](https://semver.org/).
8790
- Deprecated `SockAddr/InetAddr::to_str` in favor of `ToString::to_string`
8891
(#[1495](https://github.com/nix-rust/nix/pull/1495))
8992

93+
- Removed `SigevNotify` on OpenBSD and Redox.
94+
(#[1511](https://github.com/nix-rust/nix/pull/1511))
95+
9096
## [0.22.0] - 9 July 2021
9197
### Added
9298
- 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

src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
#![deny(unstable_features)]
1212
#![deny(missing_copy_implementations)]
1313
#![deny(missing_debug_implementations)]
14-
#![deny(missing_docs)]
14+
#![warn(missing_docs)]
1515

1616
// Re-exported external crates
1717
pub use libc;

src/sys/aio.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,9 @@ libc_enum! {
6262
pub enum LioOpcode {
6363
/// No operation
6464
LIO_NOP,
65-
/// Write data as if by a call to [`aio_write`]
65+
/// Write data as if by a call to [`AioCb::write`]
6666
LIO_WRITE,
67-
/// Write data as if by a call to [`aio_read`]
67+
/// Write data as if by a call to [`AioCb::read`]
6868
LIO_READ,
6969
}
7070
}

src/sys/mod.rs

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ pub mod mman;
4949
#[allow(missing_docs)]
5050
pub mod personality;
5151

52-
#[allow(missing_docs)]
5352
pub mod pthread;
5453

5554
#[cfg(any(target_os = "android",
@@ -70,22 +69,18 @@ pub mod quota;
7069
pub mod reboot;
7170

7271
#[cfg(not(any(target_os = "redox", target_os = "fuchsia", target_os = "illumos")))]
73-
#[allow(missing_docs)]
7472
pub mod resource;
7573

7674
#[cfg(not(target_os = "redox"))]
77-
#[allow(missing_docs)]
7875
pub mod select;
7976

8077
#[cfg(any(target_os = "android",
8178
target_os = "freebsd",
8279
target_os = "ios",
8380
target_os = "linux",
8481
target_os = "macos"))]
85-
#[allow(missing_docs)]
8682
pub mod sendfile;
8783

88-
#[allow(missing_docs)]
8984
pub mod signal;
9085

9186
#[cfg(any(target_os = "android", target_os = "linux"))]
@@ -107,7 +102,6 @@ pub mod stat;
107102
target_os = "macos",
108103
target_os = "openbsd"
109104
))]
110-
#[allow(missing_docs)]
111105
pub mod statfs;
112106

113107
pub mod statvfs;
@@ -122,13 +116,10 @@ pub mod termios;
122116
#[allow(missing_docs)]
123117
pub mod time;
124118

125-
#[allow(missing_docs)]
126119
pub mod uio;
127120

128-
#[allow(missing_docs)]
129121
pub mod utsname;
130122

131-
#[allow(missing_docs)]
132123
pub mod wait;
133124

134125
#[cfg(any(target_os = "android", target_os = "linux"))]

src/sys/pthread.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
//! Low level threading primitives
2+
13
#[cfg(not(target_os = "redox"))]
24
use crate::errno::Errno;
35
#[cfg(not(target_os = "redox"))]
@@ -6,6 +8,7 @@ use crate::Result;
68
use crate::sys::signal::Signal;
79
use libc::{self, pthread_t};
810

11+
/// Identifies an individual thread.
912
pub type Pthread = pthread_t;
1013

1114
/// Obtain ID of the calling thread (see

src/sys/resource.rs

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,54 +50,88 @@ libc_enum! {
5050
#[non_exhaustive]
5151
pub enum Resource {
5252
#[cfg(not(any(target_os = "netbsd", target_os = "freebsd")))]
53+
/// The maximum amount (in bytes) of virtual memory the process is
54+
/// allowed to map.
5355
RLIMIT_AS,
56+
/// The largest size (in bytes) core(5) file that may be created.
5457
RLIMIT_CORE,
58+
/// The maximum amount of cpu time (in seconds) to be used by each
59+
/// process.
5560
RLIMIT_CPU,
61+
/// The maximum size (in bytes) of the data segment for a process
5662
RLIMIT_DATA,
63+
/// The largest size (in bytes) file that may be created.
5764
RLIMIT_FSIZE,
65+
/// The maximum number of open files for this process.
5866
RLIMIT_NOFILE,
67+
/// The maximum size (in bytes) of the stack segment for a process.
5968
RLIMIT_STACK,
6069

6170
#[cfg(target_os = "freebsd")]
71+
/// The maximum number of kqueues this user id is allowed to create.
6272
RLIMIT_KQUEUES,
6373

6474
#[cfg(any(target_os = "android", target_os = "linux"))]
75+
/// A limit on the combined number of flock locks and fcntl leases that
76+
/// this process may establish.
6577
RLIMIT_LOCKS,
6678

6779
#[cfg(any(target_os = "android", target_os = "freebsd", target_os = "openbsd", target_os = "linux"))]
80+
/// The maximum size (in bytes) which a process may lock into memory
81+
/// using the mlock(2) system call.
6882
RLIMIT_MEMLOCK,
6983

7084
#[cfg(any(target_os = "android", target_os = "linux"))]
85+
/// A limit on the number of bytes that can be allocated for POSIX
86+
/// message queues for the real user ID of the calling process.
7187
RLIMIT_MSGQUEUE,
7288

7389
#[cfg(any(target_os = "android", target_os = "linux"))]
90+
/// A ceiling to which the process's nice value can be raised using
91+
/// setpriority or nice.
7492
RLIMIT_NICE,
7593

7694
#[cfg(any(target_os = "android", target_os = "freebsd", target_os = "openbsd", target_os = "linux"))]
95+
/// The maximum number of simultaneous processes for this user id.
7796
RLIMIT_NPROC,
7897

7998
#[cfg(target_os = "freebsd")]
99+
/// The maximum number of pseudo-terminals this user id is allowed to
100+
/// create.
80101
RLIMIT_NPTS,
81102

82103
#[cfg(any(target_os = "android", target_os = "freebsd", target_os = "openbsd", target_os = "linux"))]
104+
/// When there is memory pressure and swap is available, prioritize
105+
/// eviction of a process' resident pages beyond this amount (in bytes).
83106
RLIMIT_RSS,
84107

85108
#[cfg(any(target_os = "android", target_os = "linux"))]
109+
/// A ceiling on the real-time priority that may be set for this process
110+
/// using sched_setscheduler and sched_set‐ param.
86111
RLIMIT_RTPRIO,
87112

88113
#[cfg(any(target_os = "linux"))]
114+
/// A limit (in microseconds) on the amount of CPU time that a process
115+
/// scheduled under a real-time scheduling policy may con‐ sume without
116+
/// making a blocking system call.
89117
RLIMIT_RTTIME,
90118

91119
#[cfg(any(target_os = "android", target_os = "linux"))]
120+
/// A limit on the number of signals that may be queued for the real
121+
/// user ID of the calling process.
92122
RLIMIT_SIGPENDING,
93123

94124
#[cfg(any(target_os = "freebsd", target_os = "dragonfly"))]
125+
/// The maximum size (in bytes) of socket buffer usage for this user.
95126
RLIMIT_SBSIZE,
96127

97128
#[cfg(target_os = "freebsd")]
129+
/// The maximum size (in bytes) of the swap space that may be reserved
130+
/// or used by all of this user id's processes.
98131
RLIMIT_SWAP,
99132

100133
#[cfg(target_os = "freebsd")]
134+
/// An alias for RLIMIT_AS.
101135
RLIMIT_VMEM,
102136
}
103137
}

src/sys/select.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
//! Portably monitor a group of file descriptors for readiness.
12
use std::iter::FusedIterator;
23
use std::mem;
34
use std::ops::Range;
@@ -11,11 +12,13 @@ use crate::sys::time::{TimeSpec, TimeVal};
1112

1213
pub use libc::FD_SETSIZE;
1314

15+
/// Contains a set of file descriptors used by [`select`]
1416
#[repr(transparent)]
1517
#[derive(Clone, Copy, Debug, Eq, Hash, PartialEq)]
1618
pub struct FdSet(libc::fd_set);
1719

1820
impl FdSet {
21+
/// Create an empty `FdSet`
1922
pub fn new() -> FdSet {
2023
let mut fdset = mem::MaybeUninit::uninit();
2124
unsafe {
@@ -24,18 +27,22 @@ impl FdSet {
2427
}
2528
}
2629

30+
/// Add a file descriptor to an `FdSet`
2731
pub fn insert(&mut self, fd: RawFd) {
2832
unsafe { libc::FD_SET(fd, &mut self.0) };
2933
}
3034

35+
/// Remove a file descriptor from an `FdSet`
3136
pub fn remove(&mut self, fd: RawFd) {
3237
unsafe { libc::FD_CLR(fd, &mut self.0) };
3338
}
3439

40+
/// Test an `FdSet` for the presence of a certain file descriptor.
3541
pub fn contains(&self, fd: RawFd) -> bool {
3642
unsafe { libc::FD_ISSET(fd, &self.0) }
3743
}
3844

45+
/// Remove all file descriptors from this `FdSet`.
3946
pub fn clear(&mut self) {
4047
unsafe { libc::FD_ZERO(&mut self.0) };
4148
}

src/sys/sendfile.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
//! Send data from a file to a socket, bypassing userland.
2+
13
use cfg_if::cfg_if;
24
use std::os::unix::io::RawFd;
35
use std::ptr;

0 commit comments

Comments
 (0)