LibCore: Remove unused KeepAsChild and disown mechanisms

Those went unused and did nothing on systems other than SerenityOS.
This commit is contained in:
Undefine 2025-08-13 14:02:29 +02:00 committed by Jelle Raaijmakers
parent 7a9dd46a39
commit 769bbe6021
Notes: github-actions[bot] 2025-11-07 10:29:22 +00:00
4 changed files with 7 additions and 44 deletions

View file

@ -63,26 +63,22 @@ struct ArgvList {
Process::Process(Process&& other)
: m_pid(exchange(other.m_pid, 0))
, m_should_disown(exchange(other.m_should_disown, false))
{
}
Process& Process::operator=(Process&& other)
{
m_pid = exchange(other.m_pid, 0);
m_should_disown = exchange(other.m_should_disown, false);
return *this;
}
Process::~Process()
{
(void)disown();
}
Process Process::current()
{
auto p = Process { getpid() };
p.m_should_disown = false;
return p;
}
@ -134,20 +130,17 @@ ErrorOr<Process> Process::spawn(ProcessSpawnOptions const& options)
return Process { pid };
}
ErrorOr<Process> Process::spawn(StringView path, ReadonlySpan<ByteString> arguments, KeepAsChild keep_as_child)
ErrorOr<Process> Process::spawn(StringView path, ReadonlySpan<ByteString> arguments)
{
auto process = TRY(spawn({
.executable = path,
.arguments = Vector<ByteString> { arguments },
}));
if (keep_as_child == KeepAsChild::No)
TRY(process.disown());
return process;
}
ErrorOr<Process> Process::spawn(StringView path, ReadonlySpan<StringView> arguments, KeepAsChild keep_as_child)
ErrorOr<Process> Process::spawn(StringView path, ReadonlySpan<StringView> arguments)
{
Vector<ByteString> backing_strings;
backing_strings.ensure_capacity(arguments.size());
@ -159,9 +152,6 @@ ErrorOr<Process> Process::spawn(StringView path, ReadonlySpan<StringView> argume
.arguments = backing_strings,
}));
if (keep_as_child == KeepAsChild::No)
TRY(process.disown());
return process;
}
@ -293,21 +283,6 @@ pid_t Process::pid() const
return m_pid;
}
ErrorOr<void> Process::disown()
{
if (m_pid != 0 && m_should_disown) {
#ifdef AK_OS_SERENITY
TRY(System::disown(m_pid));
#else
// FIXME: Support disown outside Serenity.
#endif
m_should_disown = false;
return {};
} else {
return Error::from_errno(EINVAL);
}
}
ErrorOr<int> Process::wait_for_termination()
{
VERIFY(m_pid > 0);
@ -328,7 +303,6 @@ ErrorOr<int> Process::wait_for_termination()
VERIFY_NOT_REACHED();
}
m_should_disown = false;
return exit_code;
}