about summary refs log tree commit diff
path: root/library/std/src
diff options
context:
space:
mode:
Diffstat (limited to 'library/std/src')
-rw-r--r--library/std/src/os/unix/net/stream.rs4
-rw-r--r--library/std/src/os/wasi/fs.rs2
-rw-r--r--library/std/src/os/windows/process.rs36
-rw-r--r--library/std/src/sys/process/windows.rs36
4 files changed, 74 insertions, 4 deletions
diff --git a/library/std/src/os/unix/net/stream.rs b/library/std/src/os/unix/net/stream.rs
index 1cab04a454d..1bd3bab5e37 100644
--- a/library/std/src/os/unix/net/stream.rs
+++ b/library/std/src/os/unix/net/stream.rs
@@ -307,11 +307,11 @@ impl UnixStream {
     ///
     /// ```no_run
     /// use std::io;
-    /// use std::net::UdpSocket;
+    /// use std::os::unix::net::UnixStream;
     /// use std::time::Duration;
     ///
     /// fn main() -> std::io::Result<()> {
-    ///     let socket = UdpSocket::bind("127.0.0.1:34254")?;
+    ///     let socket = UnixStream::connect("/tmp/sock")?;
     ///     let result = socket.set_write_timeout(Some(Duration::new(0, 0)));
     ///     let err = result.unwrap_err();
     ///     assert_eq!(err.kind(), io::ErrorKind::InvalidInput);
diff --git a/library/std/src/os/wasi/fs.rs b/library/std/src/os/wasi/fs.rs
index 34f0e89f2f1..5ea91dd6521 100644
--- a/library/std/src/os/wasi/fs.rs
+++ b/library/std/src/os/wasi/fs.rs
@@ -72,7 +72,6 @@ pub trait FileExt {
     /// If this function returns an error, it is unspecified how many bytes it
     /// has read, but it will never read more than would be necessary to
     /// completely fill the buffer.
-    #[stable(feature = "rw_exact_all_at", since = "1.33.0")]
     fn read_exact_at(&self, mut buf: &mut [u8], mut offset: u64) -> io::Result<()> {
         while !buf.is_empty() {
             match self.read_at(buf, offset) {
@@ -144,7 +143,6 @@ pub trait FileExt {
     /// non-[`io::ErrorKind::Interrupted`] kind that [`write_at`] returns.
     ///
     /// [`write_at`]: FileExt::write_at
-    #[stable(feature = "rw_exact_all_at", since = "1.33.0")]
     fn write_all_at(&self, mut buf: &[u8], mut offset: u64) -> io::Result<()> {
         while !buf.is_empty() {
             match self.write_at(buf, offset) {
diff --git a/library/std/src/os/windows/process.rs b/library/std/src/os/windows/process.rs
index a084f452e55..c223eee95b5 100644
--- a/library/std/src/os/windows/process.rs
+++ b/library/std/src/os/windows/process.rs
@@ -344,6 +344,27 @@ pub trait CommandExt: Sealed {
         &mut self,
         attribute_list: &ProcThreadAttributeList<'_>,
     ) -> io::Result<process::Child>;
+
+    /// When true, sets the `STARTF_RUNFULLSCREEN` flag on the [STARTUPINFO][1] struct before passing it to `CreateProcess`.
+    ///
+    /// [1]: https://learn.microsoft.com/en-us/windows/win32/api/processthreadsapi/ns-processthreadsapi-startupinfoa
+    #[unstable(feature = "windows_process_extensions_startupinfo", issue = "141010")]
+    fn startupinfo_fullscreen(&mut self, enabled: bool) -> &mut process::Command;
+
+    /// When true, sets the `STARTF_UNTRUSTEDSOURCE` flag on the [STARTUPINFO][1] struct before passing it to `CreateProcess`.
+    ///
+    /// [1]: https://learn.microsoft.com/en-us/windows/win32/api/processthreadsapi/ns-processthreadsapi-startupinfoa
+    #[unstable(feature = "windows_process_extensions_startupinfo", issue = "141010")]
+    fn startupinfo_untrusted_source(&mut self, enabled: bool) -> &mut process::Command;
+
+    /// When specified, sets the following flags on the [STARTUPINFO][1] struct before passing it to `CreateProcess`:
+    /// - If `Some(true)`, sets `STARTF_FORCEONFEEDBACK`
+    /// - If `Some(false)`, sets `STARTF_FORCEOFFFEEDBACK`
+    /// - If `None`, does not set any flags
+    ///
+    /// [1]: https://learn.microsoft.com/en-us/windows/win32/api/processthreadsapi/ns-processthreadsapi-startupinfoa
+    #[unstable(feature = "windows_process_extensions_startupinfo", issue = "141010")]
+    fn startupinfo_force_feedback(&mut self, enabled: Option<bool>) -> &mut process::Command;
 }
 
 #[stable(feature = "windows_process_extensions", since = "1.16.0")]
@@ -385,6 +406,21 @@ impl CommandExt for process::Command {
             .spawn_with_attributes(sys::process::Stdio::Inherit, true, Some(attribute_list))
             .map(process::Child::from_inner)
     }
+
+    fn startupinfo_fullscreen(&mut self, enabled: bool) -> &mut process::Command {
+        self.as_inner_mut().startupinfo_fullscreen(enabled);
+        self
+    }
+
+    fn startupinfo_untrusted_source(&mut self, enabled: bool) -> &mut process::Command {
+        self.as_inner_mut().startupinfo_untrusted_source(enabled);
+        self
+    }
+
+    fn startupinfo_force_feedback(&mut self, enabled: Option<bool>) -> &mut process::Command {
+        self.as_inner_mut().startupinfo_force_feedback(enabled);
+        self
+    }
 }
 
 #[unstable(feature = "windows_process_extensions_main_thread_handle", issue = "96723")]
diff --git a/library/std/src/sys/process/windows.rs b/library/std/src/sys/process/windows.rs
index 4acd753eec9..1ee3fbd285f 100644
--- a/library/std/src/sys/process/windows.rs
+++ b/library/std/src/sys/process/windows.rs
@@ -155,6 +155,9 @@ pub struct Command {
     stdout: Option<Stdio>,
     stderr: Option<Stdio>,
     force_quotes_enabled: bool,
+    startupinfo_fullscreen: bool,
+    startupinfo_untrusted_source: bool,
+    startupinfo_force_feedback: Option<bool>,
 }
 
 pub enum Stdio {
@@ -186,6 +189,9 @@ impl Command {
             stdout: None,
             stderr: None,
             force_quotes_enabled: false,
+            startupinfo_fullscreen: false,
+            startupinfo_untrusted_source: false,
+            startupinfo_force_feedback: None,
         }
     }
 
@@ -222,6 +228,18 @@ impl Command {
         self.args.push(Arg::Raw(command_str_to_append.to_os_string()))
     }
 
+    pub fn startupinfo_fullscreen(&mut self, enabled: bool) {
+        self.startupinfo_fullscreen = enabled;
+    }
+
+    pub fn startupinfo_untrusted_source(&mut self, enabled: bool) {
+        self.startupinfo_untrusted_source = enabled;
+    }
+
+    pub fn startupinfo_force_feedback(&mut self, enabled: Option<bool>) {
+        self.startupinfo_force_feedback = enabled;
+    }
+
     pub fn get_program(&self) -> &OsStr {
         &self.program
     }
@@ -343,6 +361,24 @@ impl Command {
             si.wShowWindow = cmd_show;
         }
 
+        if self.startupinfo_fullscreen {
+            si.dwFlags |= c::STARTF_RUNFULLSCREEN;
+        }
+
+        if self.startupinfo_untrusted_source {
+            si.dwFlags |= c::STARTF_UNTRUSTEDSOURCE;
+        }
+
+        match self.startupinfo_force_feedback {
+            Some(true) => {
+                si.dwFlags |= c::STARTF_FORCEONFEEDBACK;
+            }
+            Some(false) => {
+                si.dwFlags |= c::STARTF_FORCEOFFFEEDBACK;
+            }
+            None => {}
+        }
+
         let si_ptr: *mut c::STARTUPINFOW;
 
         let mut si_ex;