mirror of
https://github.com/SerenityOS/serenity.git
synced 2025-01-23 18:02:05 -05:00
NotificationServer: Port to LibMain :^)
This commit is contained in:
parent
70b1312fd4
commit
ddd99b4594
2 changed files with 11 additions and 21 deletions
|
@ -16,4 +16,4 @@ set(SOURCES
|
||||||
)
|
)
|
||||||
|
|
||||||
serenity_bin(NotificationServer)
|
serenity_bin(NotificationServer)
|
||||||
target_link_libraries(NotificationServer LibGUI LibIPC)
|
target_link_libraries(NotificationServer LibGUI LibIPC LibMain)
|
||||||
|
|
|
@ -1,24 +1,22 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2020, Andreas Kling <kling@serenityos.org>
|
* Copyright (c) 2020-2021, Andreas Kling <kling@serenityos.org>
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: BSD-2-Clause
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "ClientConnection.h"
|
#include "ClientConnection.h"
|
||||||
#include <LibCore/LocalServer.h>
|
#include <LibCore/LocalServer.h>
|
||||||
|
#include <LibCore/System.h>
|
||||||
#include <LibGUI/Application.h>
|
#include <LibGUI/Application.h>
|
||||||
#include <LibGUI/WindowServerConnection.h>
|
#include <LibGUI/WindowServerConnection.h>
|
||||||
#include <unistd.h>
|
#include <LibMain/Main.h>
|
||||||
|
|
||||||
int main(int argc, char** argv)
|
ErrorOr<int> serenity_main(Main::Arguments arguments)
|
||||||
{
|
{
|
||||||
if (pledge("stdio recvfd sendfd accept rpath unix", nullptr) < 0) {
|
TRY(Core::System::pledge("stdio recvfd sendfd accept rpath unix", nullptr));
|
||||||
perror("pledge");
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto app = GUI::Application::construct(argc, argv);
|
auto app = TRY(GUI::Application::try_create(arguments));
|
||||||
auto server = Core::LocalServer::construct();
|
auto server = TRY(Core::LocalServer::try_create());
|
||||||
|
|
||||||
bool ok = server->take_over_from_system_server();
|
bool ok = server->take_over_from_system_server();
|
||||||
VERIFY(ok);
|
VERIFY(ok);
|
||||||
|
@ -33,17 +31,9 @@ int main(int argc, char** argv)
|
||||||
IPC::new_client_connection<NotificationServer::ClientConnection>(client_socket.release_nonnull(), client_id);
|
IPC::new_client_connection<NotificationServer::ClientConnection>(client_socket.release_nonnull(), client_id);
|
||||||
};
|
};
|
||||||
|
|
||||||
if (unveil("/res", "r") < 0) {
|
TRY(Core::System::unveil("/res", "r"));
|
||||||
perror("unveil");
|
TRY(Core::System::unveil(nullptr, nullptr));
|
||||||
return 1;
|
TRY(Core::System::pledge("stdio recvfd sendfd accept rpath", nullptr));
|
||||||
}
|
|
||||||
|
|
||||||
unveil(nullptr, nullptr);
|
|
||||||
|
|
||||||
if (pledge("stdio recvfd sendfd accept rpath", nullptr) < 0) {
|
|
||||||
perror("pledge");
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
return app->exec();
|
return app->exec();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue