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")))]
10mod cwd;
11#[cfg(all(feature = "alloc", not(any(target_os = "espidf", target_os = "redox"))))]
12mod dir;
13#[cfg(not(any(
14 apple,
15 netbsdlike,
16 target_os = "solaris",
17 target_os = "dragonfly",
18 target_os = "espidf",
19 target_os = "haiku",
20 target_os = "redox",
21 target_os = "vita",
22)))]
23mod fadvise;
24pub(crate) mod fcntl;
25#[cfg(apple)]
26mod fcntl_apple;
27#[cfg(apple)]
28mod fcopyfile;
29pub(crate) mod fd;
30#[cfg(all(apple, feature = "alloc"))]
31mod getpath;
32#[cfg(not(target_os = "wasi"))] mod id;
34#[cfg(linux_kernel)]
35pub mod inotify;
36#[cfg(linux_kernel)]
37mod ioctl;
38#[cfg(not(any(
39 target_os = "espidf",
40 target_os = "haiku",
41 target_os = "redox",
42 target_os = "vita",
43 target_os = "wasi"
44)))]
45mod makedev;
46#[cfg(any(linux_kernel, target_os = "freebsd"))]
47mod memfd_create;
48#[cfg(linux_kernel)]
49#[cfg(feature = "fs")]
50mod mount;
51#[cfg(linux_kernel)]
52mod openat2;
53#[cfg(linux_kernel)]
54mod raw_dir;
55mod seek_from;
56#[cfg(target_os = "linux")]
57mod sendfile;
58#[cfg(not(any(target_os = "espidf", target_os = "redox")))]
59mod special;
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")))]
79pub use cwd::*;
80#[cfg(all(feature = "alloc", not(any(target_os = "espidf", target_os = "redox"))))]
81pub use dir::{Dir, DirEntry};
82#[cfg(not(any(
83 apple,
84 netbsdlike,
85 target_os = "solaris",
86 target_os = "dragonfly",
87 target_os = "espidf",
88 target_os = "haiku",
89 target_os = "redox",
90 target_os = "vita",
91)))]
92pub use fadvise::fadvise;
93pub use fcntl::*;
94#[cfg(apple)]
95pub use fcntl_apple::*;
96#[cfg(apple)]
97pub use fcopyfile::*;
98pub use fd::*;
99#[cfg(all(apple, feature = "alloc"))]
100pub use getpath::getpath;
101#[cfg(not(target_os = "wasi"))]
102pub use id::*;
103#[cfg(linux_kernel)]
104pub use ioctl::*;
105#[cfg(not(any(
106 target_os = "espidf",
107 target_os = "haiku",
108 target_os = "redox",
109 target_os = "vita",
110 target_os = "wasi"
111)))]
112pub use makedev::*;
113#[cfg(any(linux_kernel, target_os = "freebsd"))]
114pub use memfd_create::memfd_create;
115#[cfg(linux_kernel)]
116#[cfg(feature = "fs")]
117pub use mount::*;
118#[cfg(linux_kernel)]
119pub use openat2::openat2;
120#[cfg(linux_kernel)]
121pub use raw_dir::{RawDir, RawDirEntry};
122pub use seek_from::SeekFrom;
123#[cfg(target_os = "linux")]
124pub use sendfile::sendfile;
125#[cfg(not(any(target_os = "espidf", target_os = "redox")))]
126pub use special::*;
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}