Skip to content

Commit c1b35d9

Browse files
authored
Update to rustix 0.32.0. (#220)
* Update to rustix 0.32.0. The one relevant API change in rustix is that `utimensat` now takes a struct instead of a 2-element array. * `Fifo` and `Socket` are not defined for WASI's `FileType` for now.
1 parent 0d887dd commit c1b35d9

File tree

9 files changed

+23
-13
lines changed

9 files changed

+23
-13
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ camino = "1.0.5"
2727
libc = "0.2.100"
2828

2929
[target.'cfg(not(windows))'.dev-dependencies]
30-
rustix = "0.31.0"
30+
rustix = "0.32.0"
3131

3232
[target.'cfg(windows)'.dev-dependencies]
3333
# nt_version uses internal Windows APIs, however we're only using it

cap-async-std/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ io-extras = { version = "0.12.0", features = ["use_async_std"] }
2323
camino = { version = "1.0.5", optional = true }
2424

2525
[target.'cfg(not(windows))'.dependencies]
26-
rustix = "0.31.0"
26+
rustix = "0.32.0"
2727

2828
[features]
2929
default = []

cap-directories/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ cap-std = { path = "../cap-std", version = "^0.22.2-alpha.0"}
1717
directories-next = "2.0.0"
1818

1919
[target.'cfg(not(windows))'.dependencies]
20-
rustix = "0.31.0"
20+
rustix = "0.32.0"
2121

2222
[target.'cfg(windows)'.dependencies]
2323
winapi = "0.3.9"

cap-primitives/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,12 @@ ambient-authority = "0.0.1"
1717
arbitrary = { version = "1.0.0", optional = true, features = ["derive"] }
1818
ipnet = "2.3.0"
1919
maybe-owned = "0.3.4"
20-
fs-set-times = "0.14.0"
20+
fs-set-times = "0.14.2"
2121
io-extras = "0.12.0"
2222
io-lifetimes = { version = "0.4.0", default-features = false }
2323

2424
[target.'cfg(not(windows))'.dependencies]
25-
rustix = { version = "0.31.0", features = ["procfs"] }
25+
rustix = { version = "0.32.0", features = ["procfs"] }
2626

2727
[target.'cfg(target_os = "macos")'.dependencies]
2828
errno = { version = "0.2.8", default-features = false }

cap-primitives/src/rustix/fs/dir_entry_inner.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,9 @@ impl DirEntryInner {
4545
rustix::fs::FileType::Directory => FileType::dir(),
4646
rustix::fs::FileType::RegularFile => FileType::file(),
4747
rustix::fs::FileType::Symlink => FileType::ext(FileTypeExt::symlink()),
48+
#[cfg(not(target_os = "wasi"))]
4849
rustix::fs::FileType::Fifo => FileType::ext(FileTypeExt::fifo()),
50+
#[cfg(not(target_os = "wasi"))]
4951
rustix::fs::FileType::Socket => FileType::ext(FileTypeExt::socket()),
5052
rustix::fs::FileType::CharacterDevice => FileType::ext(FileTypeExt::char_device()),
5153
rustix::fs::FileType::BlockDevice => FileType::ext(FileTypeExt::block_device()),

cap-primitives/src/rustix/fs/file_type_ext.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,11 @@ impl FileTypeExt {
4949
if std.is_fifo() {
5050
return FileType::ext(Self::Fifo);
5151
}
52+
#[cfg(not(target_os = "wasi"))]
5253
if std.is_socket() {
53-
FileType::ext(Self::Socket)
54-
} else {
55-
FileType::unknown()
54+
return FileType::ext(Self::Socket);
5655
}
56+
FileType::unknown()
5757
}
5858
}
5959

@@ -65,9 +65,11 @@ impl FileTypeExt {
6565
rustix::fs::FileType::RegularFile => FileType::file(),
6666
rustix::fs::FileType::Directory => FileType::dir(),
6767
rustix::fs::FileType::Symlink => FileType::ext(Self::symlink()),
68+
#[cfg(not(target_os = "wasi"))]
6869
rustix::fs::FileType::Fifo => FileType::ext(Self::fifo()),
6970
rustix::fs::FileType::CharacterDevice => FileType::ext(Self::char_device()),
7071
rustix::fs::FileType::BlockDevice => FileType::ext(Self::block_device()),
72+
#[cfg(not(target_os = "wasi"))]
7173
rustix::fs::FileType::Socket => FileType::ext(Self::socket()),
7274
_ => FileType::unknown(),
7375
}

cap-primitives/src/rustix/fs/times.rs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use crate::fs::SystemTimeSpec;
22
use crate::time::SystemClock;
33
use io_lifetimes::BorrowedFd;
4-
use rustix::fs::{utimensat, AtFlags, UTIME_NOW, UTIME_OMIT};
4+
use rustix::fs::{utimensat, AtFlags, Timestamps, UTIME_NOW, UTIME_OMIT};
55
use rustix::time::Timespec;
66
use std::convert::TryInto;
77
use std::path::Path;
@@ -40,7 +40,10 @@ pub(crate) fn set_times_nofollow_unchecked(
4040
atime: Option<SystemTimeSpec>,
4141
mtime: Option<SystemTimeSpec>,
4242
) -> io::Result<()> {
43-
let times = [to_timespec(atime)?, to_timespec(mtime)?];
43+
let times = Timestamps {
44+
last_access: to_timespec(atime)?,
45+
last_modification: to_timespec(mtime)?,
46+
};
4447
Ok(utimensat(start, path, &times, AtFlags::SYMLINK_NOFOLLOW)?)
4548
}
4649

@@ -51,6 +54,9 @@ pub(crate) fn set_times_follow_unchecked(
5154
atime: Option<SystemTimeSpec>,
5255
mtime: Option<SystemTimeSpec>,
5356
) -> io::Result<()> {
54-
let times = [to_timespec(atime)?, to_timespec(mtime)?];
57+
let times = Timestamps {
58+
last_access: to_timespec(atime)?,
59+
last_modification: to_timespec(mtime)?,
60+
};
5561
Ok(utimensat(&start, path, &times, AtFlags::empty())?)
5662
}

cap-std/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ io-lifetimes = { version = "0.4.0", default-features = false }
2121
camino = { version = "1.0.5", optional = true }
2222

2323
[target.'cfg(not(windows))'.dependencies]
24-
rustix = "0.31.0"
24+
rustix = "0.32.0"
2525

2626
[features]
2727
default = []

cap-time-ext/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ cap-primitives = { path = "../cap-primitives", version = "^0.22.2-alpha.0"}
1717
cap-std = { path = "../cap-std", optional = true, version = "^0.22.2-alpha.0"}
1818

1919
[target.'cfg(not(windows))'.dependencies]
20-
rustix = "0.31.0"
20+
rustix = "0.32.0"
2121

2222
[target.'cfg(windows)'.dependencies]
2323
once_cell = "1.5.2"

0 commit comments

Comments
 (0)