pub struct RealSystem(/* private fields */);Expand description
Implementation of System that actually interacts with the system.
RealSystem is an empty struct because the underlying operating system
manages the system’s internal state.
Implementations§
Source§impl RealSystem
impl RealSystem
Sourcepub unsafe fn new() -> Self
pub unsafe fn new() -> Self
Returns an instance of RealSystem.
§Safety
This function is marked unsafe because improper use of RealSystem
may lead to undefined behavior. Remember that most operations performed
on the system by Env are not thread-safe. You should never use
RealSystem in a multi-threaded program, and it is your responsibility
to make sure you are using only one instance of ReadSystem in the
process.
Trait Implementations§
Source§impl Debug for RealSystem
impl Debug for RealSystem
Source§impl System for RealSystem
impl System for RealSystem
Source§fn times(&self) -> Result<Times>
fn times(&self) -> Result<Times>
Returns consumed CPU times.
This function actually uses getrusage rather than times because it
provides better resolution on many systems.
Source§fn new_child_process(&mut self) -> Result<ChildProcessStarter>
fn new_child_process(&mut self) -> Result<ChildProcessStarter>
Creates a new child process.
This implementation calls the fork system call and returns both in the
parent and child process. In the parent, the returned
ChildProcessStarter ignores any arguments and returns the child
process ID. In the child, the starter runs the task and exits the
process.
Source§fn shell_path(&self) -> CString
fn shell_path(&self) -> CString
Returns the path to the shell.
On Linux, this function returns /proc/self/exe. On other platforms, it
searches for an executable sh from the default PATH returned by
confstr_path.
Source§fn fstatat(
&self,
dir_fd: Fd,
path: &CStr,
follow_symlinks: bool,
) -> Result<Stat>
fn fstatat( &self, dir_fd: Fd, path: &CStr, follow_symlinks: bool, ) -> Result<Stat>
Source§fn is_executable_file(&self, path: &CStr) -> bool
fn is_executable_file(&self, path: &CStr) -> bool
Source§fn is_directory(&self, path: &CStr) -> bool
fn is_directory(&self, path: &CStr) -> bool
Source§fn dup(&mut self, from: Fd, to_min: Fd, flags: EnumSet<FdFlag>) -> Result<Fd>
fn dup(&mut self, from: Fd, to_min: Fd, flags: EnumSet<FdFlag>) -> Result<Fd>
Source§fn open(
&mut self,
path: &CStr,
access: OfdAccess,
flags: EnumSet<OpenFlag>,
mode: Mode,
) -> Result<Fd>
fn open( &mut self, path: &CStr, access: OfdAccess, flags: EnumSet<OpenFlag>, mode: Mode, ) -> Result<Fd>
Source§fn open_tmpfile(&mut self, parent_dir: &Path) -> Result<Fd>
fn open_tmpfile(&mut self, parent_dir: &Path) -> Result<Fd>
Source§fn ofd_access(&self, fd: Fd) -> Result<OfdAccess>
fn ofd_access(&self, fd: Fd) -> Result<OfdAccess>
Source§fn get_and_set_nonblocking(&mut self, fd: Fd, nonblocking: bool) -> Result<bool>
fn get_and_set_nonblocking(&mut self, fd: Fd, nonblocking: bool) -> Result<bool>
Source§fn fcntl_getfd(&self, fd: Fd) -> Result<EnumSet<FdFlag>>
fn fcntl_getfd(&self, fd: Fd) -> Result<EnumSet<FdFlag>>
Source§fn fcntl_setfd(&mut self, fd: Fd, flags: EnumSet<FdFlag>) -> Result<()>
fn fcntl_setfd(&mut self, fd: Fd, flags: EnumSet<FdFlag>) -> Result<()>
Source§fn isatty(&self, fd: Fd) -> bool
fn isatty(&self, fd: Fd) -> bool
Source§fn read(&mut self, fd: Fd, buffer: &mut [u8]) -> Result<usize>
fn read(&mut self, fd: Fd, buffer: &mut [u8]) -> Result<usize>
Source§fn write(&mut self, fd: Fd, buffer: &[u8]) -> Result<usize>
fn write(&mut self, fd: Fd, buffer: &[u8]) -> Result<usize>
Source§fn lseek(&mut self, fd: Fd, position: SeekFrom) -> Result<u64>
fn lseek(&mut self, fd: Fd, position: SeekFrom) -> Result<u64>
Source§fn fdopendir(&mut self, fd: Fd) -> Result<Box<dyn Dir>>
fn fdopendir(&mut self, fd: Fd) -> Result<Box<dyn Dir>>
Source§fn opendir(&mut self, path: &CStr) -> Result<Box<dyn Dir>>
fn opendir(&mut self, path: &CStr) -> Result<Box<dyn Dir>>
Source§fn umask(&mut self, new_mask: Mode) -> Mode
fn umask(&mut self, new_mask: Mode) -> Mode
Source§fn validate_signal(&self, number: RawNumber) -> Option<(Name, Number)>
fn validate_signal(&self, number: RawNumber) -> Option<(Name, Number)>
Source§fn signal_number_from_name(&self, name: Name) -> Option<Number>
fn signal_number_from_name(&self, name: Name) -> Option<Number>
Source§fn sigmask(
&mut self,
op: Option<(SigmaskOp, &[Number])>,
old_mask: Option<&mut Vec<Number>>,
) -> Result<()>
fn sigmask( &mut self, op: Option<(SigmaskOp, &[Number])>, old_mask: Option<&mut Vec<Number>>, ) -> Result<()>
Source§fn get_sigaction(&self, signal: Number) -> Result<Disposition>
fn get_sigaction(&self, signal: Number) -> Result<Disposition>
Source§fn sigaction(
&mut self,
signal: Number,
handling: Disposition,
) -> Result<Disposition>
fn sigaction( &mut self, signal: Number, handling: Disposition, ) -> Result<Disposition>
Source§fn caught_signals(&mut self) -> Vec<Number>
fn caught_signals(&mut self) -> Vec<Number>
Source§fn kill(
&mut self,
target: Pid,
signal: Option<Number>,
) -> FlexFuture<Result<()>> ⓘ
fn kill( &mut self, target: Pid, signal: Option<Number>, ) -> FlexFuture<Result<()>> ⓘ
Source§fn raise(&mut self, signal: Number) -> FlexFuture<Result<()>> ⓘ
fn raise(&mut self, signal: Number) -> FlexFuture<Result<()>> ⓘ
Source§fn select(
&mut self,
readers: &mut Vec<Fd>,
writers: &mut Vec<Fd>,
timeout: Option<Duration>,
signal_mask: Option<&[Number]>,
) -> Result<c_int>
fn select( &mut self, readers: &mut Vec<Fd>, writers: &mut Vec<Fd>, timeout: Option<Duration>, signal_mask: Option<&[Number]>, ) -> Result<c_int>
Source§fn getsid(&self, pid: Pid) -> Result<Pid>
fn getsid(&self, pid: Pid) -> Result<Pid>
Source§fn setpgid(&mut self, pid: Pid, pgid: Pid) -> Result<()>
fn setpgid(&mut self, pid: Pid, pgid: Pid) -> Result<()>
Source§fn tcgetpgrp(&self, fd: Fd) -> Result<Pid>
fn tcgetpgrp(&self, fd: Fd) -> Result<Pid>
Source§fn tcsetpgrp(&mut self, fd: Fd, pgid: Pid) -> Result<()>
fn tcsetpgrp(&mut self, fd: Fd, pgid: Pid) -> Result<()>
Source§fn wait(&mut self, target: Pid) -> Result<Option<(Pid, ProcessState)>>
fn wait(&mut self, target: Pid) -> Result<Option<(Pid, ProcessState)>>
Source§fn execve(
&mut self,
path: &CStr,
args: &[CString],
envs: &[CString],
) -> FlexFuture<Result<Infallible>> ⓘ
fn execve( &mut self, path: &CStr, args: &[CString], envs: &[CString], ) -> FlexFuture<Result<Infallible>> ⓘ
Source§fn exit(&mut self, exit_status: ExitStatus) -> FlexFuture<Infallible> ⓘ
fn exit(&mut self, exit_status: ExitStatus) -> FlexFuture<Infallible> ⓘ
Source§fn getpwnam_dir(&self, name: &CStr) -> Result<Option<PathBuf>>
fn getpwnam_dir(&self, name: &CStr) -> Result<Option<PathBuf>>
Source§fn confstr_path(&self) -> Result<UnixString>
fn confstr_path(&self) -> Result<UnixString>
$PATH value where all standard utilities are
expected to be found. Read moreAuto Trait Implementations§
impl Freeze for RealSystem
impl RefUnwindSafe for RealSystem
impl Send for RealSystem
impl Sync for RealSystem
impl Unpin for RealSystem
impl UnwindSafe for RealSystem
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> SystemEx for T
impl<T> SystemEx for T
Source§fn move_fd_internal(&mut self, from: Fd) -> Result<Fd>
fn move_fd_internal(&mut self, from: Fd) -> Result<Fd>
MIN_INTERNAL_FD or larger. Read more