main.cpp 911 B

123456789101112131415161718192021222324252627282930313233343536
  1. /*
  2. * Copyright (c) 2020, the SerenityOS developers.
  3. *
  4. * SPDX-License-Identifier: BSD-2-Clause
  5. */
  6. #include "ClientConnection.h"
  7. #include <AK/LexicalPath.h>
  8. #include <LibCore/EventLoop.h>
  9. #include <LibCore/File.h>
  10. #include <LibCore/LocalServer.h>
  11. #include <LibIPC/ClientConnection.h>
  12. #include <sys/stat.h>
  13. #include <unistd.h>
  14. int main(int, char**)
  15. {
  16. Core::EventLoop event_loop;
  17. if (pledge("stdio unix rpath recvfd", nullptr) < 0) {
  18. perror("pledge");
  19. return 1;
  20. }
  21. auto socket = Core::LocalSocket::take_over_accepted_socket_from_system_server();
  22. IPC::new_client_connection<LanguageServers::Shell::ClientConnection>(socket.release_nonnull(), 1);
  23. if (pledge("stdio rpath recvfd", nullptr) < 0) {
  24. perror("pledge");
  25. return 1;
  26. }
  27. if (unveil("/etc/passwd", "r") < 0) {
  28. perror("unveil");
  29. return 1;
  30. }
  31. return event_loop.exec();
  32. }