1 //! Platform-specific extensions to `std` for Unix platforms.
3 //! Provides access to platform-level information on Unix platforms, and
4 //! exposes Unix-specific functions that would otherwise be inappropriate as
5 //! part of the core `std` library.
7 //! It exposes more ways to deal with platform-specific strings (`OsStr`,
8 //! `OsString`), allows to set permissions more granularly, extract low-level
9 //! file descriptors from files and sockets, and has platform-specific helpers
10 //! for spawning processes.
15 //! use std::fs::File;
16 //! use std::os::unix::prelude::*;
18 //! fn main() -> std::io::Result<()> {
19 //! let f = File::create("foo.txt")?;
20 //! let fd = f.as_raw_fd();
22 //! // use fd with native unix bindings
28 #![stable(feature = "rust1", since = "1.0.0")]
30 #![allow(missing_docs)]
40 #[unstable(feature = "peer_credentials_unix_socket", issue = "42839", reason = "unstable")]
42 target_os
= "android",
44 target_os
= "dragonfly",
45 target_os
= "freebsd",
52 /// A prelude for conveniently writing platform-specific code.
54 /// Includes all extension traits, and some important type definitions.
55 #[stable(feature = "rust1", since = "1.0.0")]
58 #[stable(feature = "rust1", since = "1.0.0")]
59 pub use super::ffi
::{OsStrExt, OsStringExt}
;
61 #[stable(feature = "rust1", since = "1.0.0")]
62 pub use super::fs
::DirEntryExt
;
64 #[stable(feature = "file_offset", since = "1.15.0")]
65 pub use super::fs
::FileExt
;
67 #[stable(feature = "rust1", since = "1.0.0")]
68 pub use super::fs
::{FileTypeExt, MetadataExt, OpenOptionsExt, PermissionsExt}
;
70 #[stable(feature = "rust1", since = "1.0.0")]
71 pub use super::io
::{AsRawFd, FromRawFd, IntoRawFd, RawFd}
;
73 #[stable(feature = "rust1", since = "1.0.0")]
74 pub use super::process
::{CommandExt, ExitStatusExt}
;
76 #[stable(feature = "rust1", since = "1.0.0")]
77 pub use super::thread
::JoinHandleExt
;