mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-25 22:08:59 +00:00
`Process::get_name()` and `Process::set_name()` are basically the same as `get_process_name()` and `set_process_name()`, except making use of convenient Serenity standard types and returning ErrorOr, instead of char* and errno shenanigans. `Process::set_name()` has an optional `SetThreadName` parameter, for when you also want to set the thread's name to the same thing. That's true for the two places that use `set_process_name()`.
30 lines
904 B
C++
30 lines
904 B
C++
/*
|
|
* Copyright (c) 2021, Andreas Kling <kling@serenityos.org>
|
|
* Copyright (c) 2022, MacDue <macdue@dueutil.tech>
|
|
* Copyright (c) 2023, Sam Atkins <atkinssj@serenityos.org>
|
|
*
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <AK/Forward.h>
|
|
#include <AK/Span.h>
|
|
|
|
namespace Core {
|
|
|
|
class Process {
|
|
public:
|
|
static ErrorOr<pid_t> spawn(StringView path, Span<DeprecatedString const> arguments, DeprecatedString working_directory = {});
|
|
static ErrorOr<pid_t> spawn(StringView path, Span<StringView const> arguments, DeprecatedString working_directory = {});
|
|
static ErrorOr<pid_t> spawn(StringView path, Span<char const* const> arguments = {}, DeprecatedString working_directory = {});
|
|
|
|
static ErrorOr<String> get_name();
|
|
enum class SetThreadName {
|
|
No,
|
|
Yes,
|
|
};
|
|
static ErrorOr<void> set_name(StringView, SetThreadName = SetThreadName::No);
|
|
};
|
|
|
|
}
|