mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-06-01 16:02:53 +00:00
UserspaceEmulator: Use Core::Process::set_name()
This commit is contained in:
parent
8297516f89
commit
86b1b49d9a
Notes:
sideshowbarker
2024-07-17 10:39:39 +09:00
Author: https://github.com/AtkinsSJ
Commit: 86b1b49d9a
Pull-request: https://github.com/SerenityOS/serenity/pull/17137
1 changed files with 4 additions and 8 deletions
|
@ -11,6 +11,7 @@
|
|||
#include <LibCore/ArgsParser.h>
|
||||
#include <LibCore/DirIterator.h>
|
||||
#include <LibCore/File.h>
|
||||
#include <LibCore/Process.h>
|
||||
#include <fcntl.h>
|
||||
#include <pthread.h>
|
||||
#include <serenity.h>
|
||||
|
@ -98,20 +99,15 @@ int main(int argc, char** argv, char** env)
|
|||
StringBuilder builder;
|
||||
builder.append("(UE) "sv);
|
||||
builder.append(LexicalPath::basename(arguments[0]));
|
||||
if (set_process_name(builder.string_view().characters_without_null_termination(), builder.string_view().length()) < 0) {
|
||||
perror("set_process_name");
|
||||
return 1;
|
||||
}
|
||||
int rc = pthread_setname_np(pthread_self(), builder.to_deprecated_string().characters());
|
||||
if (rc != 0) {
|
||||
reportln("pthread_setname_np: {}"sv, strerror(rc));
|
||||
if (auto result = Core::Process::set_name(builder.string_view(), Core::Process::SetThreadName::Yes); result.is_error()) {
|
||||
reportln("Core::Process::set_name: {}"sv, result.error());
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (pause_on_startup)
|
||||
emulator.pause();
|
||||
|
||||
rc = emulator.exec();
|
||||
int rc = emulator.exec();
|
||||
|
||||
if (dump_profile) {
|
||||
emulator.profile_stream().write_entire_buffer("], \"strings\": ["sv.bytes()).release_value_but_fixme_should_propagate_errors();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue