1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
// This file is part of yash, an extended POSIX shell.
// Copyright (C) 2021 WATANABE Yuki
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
//! API declarations and implementations for system-managed parts of the environment
//!
//! This module defines many traits that declare methods to interact with the
//! underlying system, such as file system operations, process management,
//! signal handling, and resource limit management:
//!
//! - [`CaughtSignals`]: Declares the `caught_signals` method for retrieving
//! caught signals.
//! - [`Chdir`]: Declares the `chdir` method for changing the current
//! working directory.
//! - [`Clock`]: Declares the `now` method for getting the current time.
//! - [`Close`]: Declares the `close` method for closing file descriptors.
//! - [`Dup`]: Declares the `dup` and `dup2` methods for duplicating file
//! descriptors.
//! - [`Exec`]: Declares the `execve` method for executing new programs.
//! - [`Exit`]: Declares the `exit` method for terminating the current
//! process.
//! - [`Fcntl`]: Declares the `ofd_access`, `get_and_set_nonblocking`,
//! `fcntl_getfd`, and `fcntl_setfd` methods for `fcntl`-related operations.
//! - [`Fork`]: Declares a method for creating new child processes.
//! - [`Fstat`]: Declares `fstat` and `fstatat` methods for getting file
//! metadata and provides a default implementation of `is_directory`.
//! - [`GetCwd`]: Declares the `getcwd` method for getting the current
//! working directory.
//! - [`GetPid`]: Declares the `getpid` and other methods for getting process IDs
//! and other attributes.
//! - [`GetPw`]: Declares methods for getting user information.
//! - [`GetSigaction`]: Declares the `get_sigaction` method for querying signal
//! dispositions.
//! - [`GetUid`]: Declares the `getuid`, `geteuid`, `getgid`, and
//! `getegid` methods for getting user and group IDs.
//! - [`IsExecutableFile`]: Declares the `is_executable_file` method for checking
//! if a file is executable.
//! - [`Isatty`]: Declares the `isatty` method for testing if a file descriptor is
//! associated with a terminal device.
//! - [`Open`]: Declares the `open` and other methods for opening files.
//! - [`Pipe`]: Declares the `pipe` method for creating pipes.
//! - [`Read`]: Declares the `read` method for reading from file descriptors.
//! - [`Seek`]: Declares the `lseek` method for seeking within file
//! descriptors.
//! - [`Select`]: Declares the `select` method for waiting on multiple file
//! descriptors and signals.
//! - [`SendSignal`]: Declares the `kill` and `raise` methods for sending signals
//! to processes.
//! - [`SetPgid`]: Declares the `setpgid` method for setting process group IDs.
//! - [`ShellPath`]: Declares the `shell_path` method for getting the path to
//! the shell executable.
//! - [`Sigaction`]: Declares methods for managing signal dispositions.
//! - [`Sigmask`]: Declares the `sigmask` method for managing signal masks.
//! - [`Signals`]: Declares the `signal_number_from_name` and
//! `validate_signal` methods for converting between signal names and numbers.
//! - [`TcGetPgrp`]: Declares the `tcgetpgrp` method for getting the
//! foreground process group ID of a terminal.
//! - [`TcSetPgrp`]: Declares the `tcsetpgrp` method for setting the
//! foreground process group ID of a terminal.
//! - [`Times`]: Declares the `times` method for getting CPU times.
//! - [`Umask`]: Declares the `umask` method for setting the file mode
//! creation mask.
//! - [`Wait`]: Declares the `wait` method for waiting for child processes.
//! - [`Write`]: Declares the `write` method for writing to file
//! descriptors.
//! - [`resource::GetRlimit`]: Declares the `getrlimit` method for
//! retrieving resource limits.
//! - [`resource::SetRlimit`]: Declares the `setrlimit` method for
//! setting resource limits.
//!
//! There are two main implementors of these traits:
//!
//! - [`RealSystem`]: An implementation that interacts with the actual
//! underlying system (see the [`real`] module).
//! - [`VirtualSystem`]: An implementation that simulates system behavior for
//! testing purposes (see the [`virtual`] module).
//!
//! Additionally, [`Concurrent`] is a wrapper that extends the interface with
//! asynchronous methods for concurrency. (See the [`concurrency`] module.)
//!
//! Some methods of these traits return [futures](std::future::Future), not
//! because the underlying system calls are asynchronous, but to allow
//! `VirtualSystem` to simulate blocking behavior and run virtual processes
//! concurrently. `RealSystem` implementations return ready futures after the
//! underlying system calls complete (which may block the current thread).
pub use ;
pub use Errno;
pub use RawErrno;
pub use Result;
pub use ;
pub use FlexFuture;
pub use ;
pub use ;
use RealSystem;
use ;
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;
use r#virtualVirtualSystem;
use crateFd;
use cratePid;
use crateExitStatus;