mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 15:48:12 +00:00
Userland: Add support for jails
This happens in two ways: 1. LibCore now has two new methods for creating Jails and attaching processes to a Jail. 2. We introduce 3 new utilities - lsjails, jail-create and jails-attach, which list jails, create jails and attach processes to a Jail, respectively.
This commit is contained in:
parent
1d0066a5cc
commit
8d8b0d0a34
9 changed files with 174 additions and 0 deletions
|
@ -1000,6 +1000,20 @@ ErrorOr<void> exec_command(Vector<StringView>& command, bool preserve_env)
|
|||
TRY(Core::System::exec(command.at(0), command, Core::System::SearchInPath::Yes, exec_environment));
|
||||
return {};
|
||||
}
|
||||
|
||||
ErrorOr<void> join_jail(u64 jail_index)
|
||||
{
|
||||
Syscall::SC_jail_attach_params params { jail_index };
|
||||
int rc = syscall(SC_jail_attach, ¶ms);
|
||||
HANDLE_SYSCALL_RETURN_VALUE("jail_attach", rc, {});
|
||||
}
|
||||
|
||||
ErrorOr<u64> create_jail(StringView jail_name)
|
||||
{
|
||||
Syscall::SC_jail_create_params params { 0, { jail_name.characters_without_null_termination(), jail_name.length() } };
|
||||
int rc = syscall(SC_jail_create, ¶ms);
|
||||
HANDLE_SYSCALL_RETURN_VALUE("jail_create", rc, static_cast<u64>(params.index));
|
||||
}
|
||||
#endif
|
||||
|
||||
ErrorOr<void> exec(StringView filename, Span<StringView> arguments, SearchInPath search_in_path, Optional<Span<StringView>> environment)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue