diff options
| author | Jiahao XU <Jiahao_XU@outlook.com> | 2025-04-07 00:04:57 +1000 |
|---|---|---|
| committer | Jiahao XU <Jiahao_XU@outlook.com> | 2025-04-23 23:02:52 +1000 |
| commit | 780f95dd182b1a432159430add57e9ab7cb45dd6 (patch) | |
| tree | 134bdcc279d91cbb6b702cc66cf1975a457d73e5 /library/std/src/sys/fs/unix.rs | |
| parent | 1bc56185ee257ed829a0aea7abdc3b03c5fed887 (diff) | |
| download | rust-780f95dd182b1a432159430add57e9ab7cb45dd6.tar.gz rust-780f95dd182b1a432159430add57e9ab7cb45dd6.zip | |
Impl new API `std::os::unix::fs::mkfifo` under feature `unix_fifo`
Tracking issue #139324 Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
Diffstat (limited to 'library/std/src/sys/fs/unix.rs')
| -rw-r--r-- | library/std/src/sys/fs/unix.rs | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/library/std/src/sys/fs/unix.rs b/library/std/src/sys/fs/unix.rs index 87865be0387..018e7e98c23 100644 --- a/library/std/src/sys/fs/unix.rs +++ b/library/std/src/sys/fs/unix.rs @@ -2148,6 +2148,12 @@ pub fn chroot(dir: &Path) -> io::Result<()> { Err(io::const_error!(io::ErrorKind::Unsupported, "chroot not supported by vxworks")) } +pub fn mkfifo(path: &Path, mode: u32) -> io::Result<()> { + run_path_with_cstr(path, &|path| { + cvt(unsafe { libc::mkfifo(path.as_ptr(), mode.try_into().unwrap()) }).map(|_| ()) + }) +} + pub use remove_dir_impl::remove_dir_all; // Fallback for REDOX, ESP-ID, Horizon, Vita, Vxworks and Miri |
