mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 02:37:35 +00:00
SQLServer: Port to LibMain :^)
This commit is contained in:
parent
69ea1ff743
commit
229a45ab14
2 changed files with 8 additions and 16 deletions
|
@ -17,4 +17,4 @@ set(SOURCES
|
||||||
)
|
)
|
||||||
|
|
||||||
serenity_bin(SQLServer)
|
serenity_bin(SQLServer)
|
||||||
target_link_libraries(SQLServer LibCore LibIPC LibSQL)
|
target_link_libraries(SQLServer LibCore LibIPC LibSQL LibMain)
|
||||||
|
|
|
@ -6,34 +6,26 @@
|
||||||
|
|
||||||
#include <LibCore/EventLoop.h>
|
#include <LibCore/EventLoop.h>
|
||||||
#include <LibCore/LocalServer.h>
|
#include <LibCore/LocalServer.h>
|
||||||
|
#include <LibCore/System.h>
|
||||||
|
#include <LibMain/Main.h>
|
||||||
#include <SQLServer/ClientConnection.h>
|
#include <SQLServer/ClientConnection.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <unistd.h>
|
|
||||||
|
|
||||||
int main([[maybe_unused]] int argc, [[maybe_unused]] char** argv)
|
ErrorOr<int> serenity_main(Main::Arguments)
|
||||||
{
|
{
|
||||||
if (pledge("stdio accept unix rpath wpath cpath", nullptr) < 0) {
|
TRY(Core::System::pledge("stdio accept unix rpath wpath cpath"));
|
||||||
perror("pledge");
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (mkdir("/home/anon/sql", 0700) < 0 && errno != EEXIST) {
|
if (mkdir("/home/anon/sql", 0700) < 0 && errno != EEXIST) {
|
||||||
perror("mkdir");
|
perror("mkdir");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (unveil("/home/anon/sql", "rwc") < 0) {
|
TRY(Core::System::unveil("/home/anon/sql", "rwc"));
|
||||||
perror("unveil");
|
TRY(Core::System::unveil(nullptr, nullptr));
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
if (unveil(nullptr, nullptr) < 0) {
|
|
||||||
perror("unveil");
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
Core::EventLoop event_loop;
|
Core::EventLoop event_loop;
|
||||||
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);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue