1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 01:17:36 +00:00

Kernel: Use KString all the way in sys$execve()

This patch converts all the usage of AK::String around sys$execve() to
using KString instead, allowing us to catch and propagate OOM errors.

It also required changing the kernel CommandLine helper class to return
a vector of KString for the userspace init program arguments.
This commit is contained in:
Andreas Kling 2021-09-09 11:36:40 +02:00
parent 92363a4ef8
commit dd82f68326
6 changed files with 48 additions and 41 deletions

View file

@ -223,13 +223,16 @@ StringView CommandLine::userspace_init() const
return lookup("init"sv).value_or("/bin/SystemServer"sv);
}
Vector<String> CommandLine::userspace_init_args() const
NonnullOwnPtrVector<KString> CommandLine::userspace_init_args() const
{
auto init_args = lookup("init_args"sv).value_or(""sv).to_string().split(';');
if (!init_args.is_empty())
init_args.prepend(userspace_init());
NonnullOwnPtrVector<KString> args;
return init_args;
auto init_args = lookup("init_args"sv).value_or(""sv).split_view(';');
if (!init_args.is_empty())
args.prepend(KString::must_create(userspace_init()));
for (auto& init_arg : init_args)
args.append(KString::must_create(init_arg));
return args;
}
UNMAP_AFTER_INIT size_t CommandLine::switch_to_tty() const