ladybird/Userland/Services/LookupServer/main.cpp

45 lines
945 B
C++
Raw Normal View History

/*
* Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
2019-11-26 19:38:24 +03:00
#include "LookupServer.h"
#include <LibCore/EventLoop.h>
#include <LibCore/LocalServer.h>
2020-01-13 03:46:03 +03:00
#include <stdio.h>
#include <unistd.h>
int main([[maybe_unused]] int argc, [[maybe_unused]] char** argv)
{
if (pledge("stdio accept unix inet rpath", nullptr) < 0) {
2020-01-13 03:46:03 +03:00
perror("pledge");
return 1;
}
Core::EventLoop event_loop;
auto server = LookupServer::LookupServer::construct();
if (pledge("stdio accept inet rpath", nullptr) < 0) {
2020-01-13 03:46:03 +03:00
perror("pledge");
return 1;
}
if (unveil("/proc/net/adapters", "r") < 0) {
perror("unveil");
return 1;
}
if (unveil("/etc/hosts", "r") < 0) {
perror("unveil");
return 1;
}
if (unveil(nullptr, nullptr) < 0) {
perror("unveil");
return 1;
}
2019-11-26 19:38:24 +03:00
return event_loop.exec();
}