1mod abs;
4#[cfg(not(target_os = "redox"))]
5mod at;
6mod constants;
7#[cfg(linux_kernel)]
8mod copy_file_range;
9#[cfg(not(any(target_os = "espidf", target_os = "redox")))]
10#[cfg(not(target_os = "haiku"))]
11mod cwd;
13#[cfg(all(feature = "alloc", not(any(target_os = "espidf", target_os = "redox"))))]
14mod dir;
15#[cfg(not(any(
16 apple,
17 netbsdlike,
18 solarish,
19 target_os = "dragonfly",
20 target_os = "espidf",
21 target_os = "haiku",
22 target_os = "redox",
23 target_os = "vita",
24)))]
25mod fadvise;
26pub(crate) mod fcntl;
27#[cfg(apple)]
28mod fcntl_apple;
29#[cfg(apple)]
30mod fcopyfile;
31pub(crate) mod fd;
32#[cfg(all(apple, feature = "alloc"))]
33mod getpath;
34#[cfg(not(target_os = "wasi"))] mod id;
36#[cfg(linux_kernel)]
37pub mod inotify;
38#[cfg(linux_kernel)]
39mod ioctl;
40#[cfg(not(any(
41 target_os = "espidf",
42 target_os = "haiku",
43 target_os = "redox",
44 target_os = "vita",
45 target_os = "wasi"
46)))]
47mod makedev;
48#[cfg(any(linux_kernel, target_os = "freebsd"))]
49mod memfd_create;
50#[cfg(linux_kernel)]
51#[cfg(feature = "fs")]
52mod mount;
53#[cfg(linux_kernel)]
54mod openat2;
55#[cfg(linux_kernel)]
56mod raw_dir;
57mod seek_from;
58#[cfg(target_os = "linux")]
59mod sendfile;
60#[cfg(linux_kernel)]
61mod statx;
62#[cfg(not(any(
63 target_os = "espidf",
64 target_os = "redox",
65 target_os = "vita",
66 target_os = "wasi"
67)))]
68mod sync;
69#[cfg(any(apple, linux_kernel, target_os = "hurd"))]
70mod xattr;
71
72pub use abs::*;
73#[cfg(not(target_os = "redox"))]
74pub use at::*;
75pub use constants::*;
76#[cfg(linux_kernel)]
77pub use copy_file_range::copy_file_range;
78#[cfg(not(any(target_os = "espidf", target_os = "redox")))]
79#[cfg(not(target_os = "haiku"))]
80pub use cwd::*;
82#[cfg(all(feature = "alloc", not(any(target_os = "espidf", target_os = "redox"))))]
83pub use dir::{Dir, DirEntry};
84#[cfg(not(any(
85 apple,
86 netbsdlike,
87 solarish,
88 target_os = "dragonfly",
89 target_os = "espidf",
90 target_os = "haiku",
91 target_os = "redox",
92 target_os = "vita",
93)))]
94pub use fadvise::fadvise;
95pub use fcntl::*;
96#[cfg(apple)]
97pub use fcntl_apple::*;
98#[cfg(apple)]
99pub use fcopyfile::*;
100pub use fd::*;
101#[cfg(all(apple, feature = "alloc"))]
102pub use getpath::getpath;
103#[cfg(not(target_os = "wasi"))]
104pub use id::*;
105#[cfg(linux_kernel)]
106pub use ioctl::*;
107#[cfg(not(any(
108 target_os = "espidf",
109 target_os = "haiku",
110 target_os = "redox",
111 target_os = "vita",
112 target_os = "wasi"
113)))]
114pub use makedev::*;
115#[cfg(any(linux_kernel, target_os = "freebsd"))]
116pub use memfd_create::memfd_create;
117#[cfg(linux_kernel)]
118#[cfg(feature = "fs")]
119pub use mount::*;
120#[cfg(linux_kernel)]
121pub use openat2::openat2;
122#[cfg(linux_kernel)]
123pub use raw_dir::{RawDir, RawDirEntry};
124pub use seek_from::SeekFrom;
125#[cfg(target_os = "linux")]
126pub use sendfile::sendfile;
127#[cfg(linux_kernel)]
128pub use statx::statx;
129#[cfg(not(any(
130 target_os = "espidf",
131 target_os = "redox",
132 target_os = "vita",
133 target_os = "wasi"
134)))]
135pub use sync::sync;
136#[cfg(any(apple, linux_kernel, target_os = "hurd"))]
137pub use xattr::*;
138
139#[cfg(feature = "std")]
141#[cfg(unix)]
142pub use std::os::unix::fs::{DirEntryExt, FileExt, FileTypeExt, MetadataExt, OpenOptionsExt};
143#[cfg(feature = "std")]
144#[cfg(all(wasi_ext, target_os = "wasi"))]
145pub use std::os::wasi::fs::{DirEntryExt, FileExt, FileTypeExt, MetadataExt, OpenOptionsExt};
146
147#[cfg(unix)]
156pub trait StatExt {
157 fn atime(&self) -> i64;
159 fn mtime(&self) -> i64;
161 fn ctime(&self) -> i64;
163}
164
165#[cfg(all(
166 unix,
167 not(any(target_os = "aix", target_os = "hurd", target_os = "nto"))
168))]
169#[allow(deprecated)]
170impl StatExt for Stat {
171 #[inline]
172 fn atime(&self) -> i64 {
173 self.st_atime as i64
174 }
175
176 #[inline]
177 fn mtime(&self) -> i64 {
178 self.st_mtime as i64
179 }
180
181 #[inline]
182 fn ctime(&self) -> i64 {
183 self.st_ctime as i64
184 }
185}
186
187#[cfg(any(target_os = "aix", target_os = "hurd", target_os = "nto"))]
188#[allow(deprecated)]
189impl StatExt for Stat {
190 #[inline]
191 fn atime(&self) -> i64 {
192 self.st_atim.tv_sec as i64
193 }
194
195 #[inline]
196 fn mtime(&self) -> i64 {
197 self.st_mtim.tv_sec as i64
198 }
199
200 #[inline]
201 fn ctime(&self) -> i64 {
202 self.st_ctim.tv_sec as i64
203 }
204}