mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 21:22:46 +00:00 
			
		
		
		
	LibCore+LibSystem: Move syscall wrappers from LibSystem to LibCore
With this change, System::foo() becomes Core::System::foo(). Since LibCore builds on other systems than SerenityOS, we now have to make sure that wrappers work with just a standard C library underneath.
This commit is contained in:
		
							parent
							
								
									acc2eccede
								
							
						
					
					
						commit
						21a5fb0fa2
					
				
					 32 changed files with 165 additions and 173 deletions
				
			
		|  | @ -9,13 +9,13 @@ | |||
| #include <AK/JsonObject.h> | ||||
| #include <LibCore/ArgsParser.h> | ||||
| #include <LibCore/File.h> | ||||
| #include <LibCore/System.h> | ||||
| #include <LibGUI/Application.h> | ||||
| #include <LibGUI/Frame.h> | ||||
| #include <LibGUI/Painter.h> | ||||
| #include <LibGUI/Window.h> | ||||
| #include <LibGfx/Palette.h> | ||||
| #include <LibMain/Main.h> | ||||
| #include <LibSystem/Wrappers.h> | ||||
| #include <serenity.h> | ||||
| #include <spawn.h> | ||||
| #include <stdio.h> | ||||
|  | @ -185,11 +185,11 @@ private: | |||
| 
 | ||||
| ErrorOr<int> serenity_main(Main::Arguments arguments) | ||||
| { | ||||
|     TRY(System::pledge("stdio recvfd sendfd proc exec rpath unix", nullptr)); | ||||
|     TRY(Core::System::pledge("stdio recvfd sendfd proc exec rpath unix", nullptr)); | ||||
| 
 | ||||
|     auto app = GUI::Application::construct(arguments); | ||||
| 
 | ||||
|     TRY(System::pledge("stdio recvfd sendfd proc exec rpath", nullptr)); | ||||
|     TRY(Core::System::pledge("stdio recvfd sendfd proc exec rpath", nullptr)); | ||||
| 
 | ||||
|     const char* cpu = nullptr; | ||||
|     const char* memory = nullptr; | ||||
|  | @ -231,11 +231,11 @@ ErrorOr<int> serenity_main(Main::Arguments arguments) | |||
|     if (memory) | ||||
|         create_applet(GraphType::Memory, memory); | ||||
| 
 | ||||
|     TRY(System::unveil("/res", "r")); | ||||
|     TRY(System::unveil("/proc/stat", "r")); | ||||
|     TRY(System::unveil("/proc/memstat", "r")); | ||||
|     TRY(System::unveil("/bin/SystemMonitor", "x")); | ||||
|     TRY(System::unveil(nullptr, nullptr)); | ||||
|     TRY(Core::System::unveil("/res", "r")); | ||||
|     TRY(Core::System::unveil("/proc/stat", "r")); | ||||
|     TRY(Core::System::unveil("/proc/memstat", "r")); | ||||
|     TRY(Core::System::unveil("/bin/SystemMonitor", "x")); | ||||
|     TRY(Core::System::unveil(nullptr, nullptr)); | ||||
| 
 | ||||
|     return app->exec(); | ||||
| } | ||||
|  |  | |||
|  | @ -6,6 +6,7 @@ | |||
| 
 | ||||
| #include <LibCore/ElapsedTimer.h> | ||||
| #include <LibCore/File.h> | ||||
| #include <LibCore/System.h> | ||||
| #include <LibFileSystemAccessClient/Client.h> | ||||
| #include <LibGL/GL/gl.h> | ||||
| #include <LibGL/GLContext.h> | ||||
|  | @ -23,7 +24,6 @@ | |||
| #include <LibGfx/Bitmap.h> | ||||
| #include <LibGfx/Palette.h> | ||||
| #include <LibMain/Main.h> | ||||
| #include <LibSystem/Wrappers.h> | ||||
| 
 | ||||
| #include "Mesh.h" | ||||
| #include "WavefrontOBJLoader.h" | ||||
|  | @ -286,13 +286,13 @@ ErrorOr<int> serenity_main(Main::Arguments arguments) | |||
| { | ||||
|     auto app = GUI::Application::construct(arguments); | ||||
| 
 | ||||
|     TRY(System::pledge("stdio thread recvfd sendfd rpath unix", nullptr)); | ||||
|     TRY(Core::System::pledge("stdio thread recvfd sendfd rpath unix", nullptr)); | ||||
| 
 | ||||
|     TRY(System::unveil("/tmp/portal/filesystemaccess", "rw")); | ||||
|     TRY(System::unveil("/home/anon/Documents/3D Models/teapot.obj", "r")); | ||||
|     TRY(System::unveil("/home/anon/Documents/3D Models/teapot.bmp", "r")); | ||||
|     TRY(System::unveil("/res", "r")); | ||||
|     TRY(System::unveil(nullptr, nullptr)); | ||||
|     TRY(Core::System::unveil("/tmp/portal/filesystemaccess", "rw")); | ||||
|     TRY(Core::System::unveil("/home/anon/Documents/3D Models/teapot.obj", "r")); | ||||
|     TRY(Core::System::unveil("/home/anon/Documents/3D Models/teapot.bmp", "r")); | ||||
|     TRY(Core::System::unveil("/res", "r")); | ||||
|     TRY(Core::System::unveil(nullptr, nullptr)); | ||||
| 
 | ||||
|     // Construct the main window
 | ||||
|     auto window = GUI::Window::construct(); | ||||
|  |  | |||
|  | @ -14,13 +14,13 @@ | |||
| #include <LibCore/ArgsParser.h> | ||||
| #include <LibCore/File.h> | ||||
| #include <LibCore/StandardPaths.h> | ||||
| #include <LibCore/System.h> | ||||
| #include <LibDesktop/Launcher.h> | ||||
| #include <LibGUI/Application.h> | ||||
| #include <LibGUI/BoxLayout.h> | ||||
| #include <LibGUI/Icon.h> | ||||
| #include <LibGUI/TabWidget.h> | ||||
| #include <LibMain/Main.h> | ||||
| #include <LibSystem/Wrappers.h> | ||||
| #include <stdio.h> | ||||
| #include <unistd.h> | ||||
| 
 | ||||
|  | @ -39,7 +39,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments) | |||
|         return 1; | ||||
|     } | ||||
| 
 | ||||
|     TRY(System::pledge("stdio recvfd sendfd unix cpath rpath wpath", nullptr)); | ||||
|     TRY(Core::System::pledge("stdio recvfd sendfd unix cpath rpath wpath", nullptr)); | ||||
| 
 | ||||
|     const char* specified_url = nullptr; | ||||
| 
 | ||||
|  | @ -60,13 +60,13 @@ ErrorOr<int> serenity_main(Main::Arguments arguments) | |||
|         return 1; | ||||
|     } | ||||
| 
 | ||||
|     TRY(System::unveil("/home", "rwc")); | ||||
|     TRY(System::unveil("/res", "r")); | ||||
|     TRY(System::unveil("/etc/passwd", "r")); | ||||
|     TRY(System::unveil("/tmp/portal/image", "rw")); | ||||
|     TRY(System::unveil("/tmp/portal/webcontent", "rw")); | ||||
|     TRY(System::unveil("/tmp/portal/request", "rw")); | ||||
|     TRY(System::unveil(nullptr, nullptr)); | ||||
|     TRY(Core::System::unveil("/home", "rwc")); | ||||
|     TRY(Core::System::unveil("/res", "r")); | ||||
|     TRY(Core::System::unveil("/etc/passwd", "r")); | ||||
|     TRY(Core::System::unveil("/tmp/portal/image", "rw")); | ||||
|     TRY(Core::System::unveil("/tmp/portal/webcontent", "rw")); | ||||
|     TRY(Core::System::unveil("/tmp/portal/request", "rw")); | ||||
|     TRY(Core::System::unveil(nullptr, nullptr)); | ||||
| 
 | ||||
|     auto app_icon = GUI::Icon::default_icon("app-browser"); | ||||
| 
 | ||||
|  |  | |||
|  | @ -19,6 +19,7 @@ | |||
| #include <LibCore/ArgsParser.h> | ||||
| #include <LibCore/File.h> | ||||
| #include <LibCore/StandardPaths.h> | ||||
| #include <LibCore/System.h> | ||||
| #include <LibDesktop/Launcher.h> | ||||
| #include <LibGUI/Action.h> | ||||
| #include <LibGUI/ActionGroup.h> | ||||
|  | @ -43,7 +44,6 @@ | |||
| #include <LibGUI/Window.h> | ||||
| #include <LibGfx/Palette.h> | ||||
| #include <LibMain/Main.h> | ||||
| #include <LibSystem/Wrappers.h> | ||||
| #include <pthread.h> | ||||
| #include <signal.h> | ||||
| #include <stdio.h> | ||||
|  | @ -64,12 +64,12 @@ static bool add_launch_handler_actions_to_menu(RefPtr<GUI::Menu>& menu, Director | |||
| 
 | ||||
| ErrorOr<int> serenity_main(Main::Arguments arguments) | ||||
| { | ||||
|     TRY(System::pledge("stdio thread recvfd sendfd unix cpath rpath wpath fattr proc exec sigaction", nullptr)); | ||||
|     TRY(Core::System::pledge("stdio thread recvfd sendfd unix cpath rpath wpath fattr proc exec sigaction", nullptr)); | ||||
| 
 | ||||
|     struct sigaction act = {}; | ||||
|     act.sa_flags = SA_NOCLDWAIT; | ||||
|     act.sa_handler = SIG_IGN; | ||||
|     TRY(System::sigaction(SIGCHLD, &act, nullptr)); | ||||
|     TRY(Core::System::sigaction(SIGCHLD, &act, nullptr)); | ||||
| 
 | ||||
|     Core::ArgsParser args_parser; | ||||
|     bool is_desktop_mode { false }, is_selection_mode { false }, ignore_path_resolution { false }; | ||||
|  | @ -82,7 +82,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments) | |||
| 
 | ||||
|     auto app = GUI::Application::construct(arguments); | ||||
| 
 | ||||
|     TRY(System::pledge("stdio thread recvfd sendfd cpath rpath wpath fattr proc exec unix", nullptr)); | ||||
|     TRY(Core::System::pledge("stdio thread recvfd sendfd cpath rpath wpath fattr proc exec unix", nullptr)); | ||||
| 
 | ||||
|     Config::pledge_domains({ "FileManager", "WindowManager" }); | ||||
|     Config::monitor_domain("FileManager"); | ||||
|  |  | |||
|  | @ -6,27 +6,27 @@ | |||
| 
 | ||||
| #include "MailWidget.h" | ||||
| #include <LibConfig/Client.h> | ||||
| #include <LibCore/System.h> | ||||
| #include <LibGUI/Application.h> | ||||
| #include <LibGUI/Icon.h> | ||||
| #include <LibGUI/Menu.h> | ||||
| #include <LibGUI/Menubar.h> | ||||
| #include <LibGUI/Window.h> | ||||
| #include <LibMain/Main.h> | ||||
| #include <LibSystem/Wrappers.h> | ||||
| 
 | ||||
| ErrorOr<int> serenity_main(Main::Arguments arguments) | ||||
| { | ||||
|     TRY(System::pledge("stdio recvfd sendfd rpath unix inet", nullptr)); | ||||
|     TRY(Core::System::pledge("stdio recvfd sendfd rpath unix inet", nullptr)); | ||||
| 
 | ||||
|     auto app = GUI::Application::construct(arguments); | ||||
| 
 | ||||
|     Config::pledge_domains("Mail"); | ||||
| 
 | ||||
|     TRY(System::unveil("/res", "r")); | ||||
|     TRY(System::unveil("/etc", "r")); | ||||
|     TRY(System::unveil("/tmp/portal/webcontent", "rw")); | ||||
|     TRY(System::unveil("/tmp/portal/lookup", "rw")); | ||||
|     TRY(System::unveil(nullptr, nullptr)); | ||||
|     TRY(Core::System::unveil("/res", "r")); | ||||
|     TRY(Core::System::unveil("/etc", "r")); | ||||
|     TRY(Core::System::unveil("/tmp/portal/webcontent", "rw")); | ||||
|     TRY(Core::System::unveil("/tmp/portal/lookup", "rw")); | ||||
|     TRY(Core::System::unveil(nullptr, nullptr)); | ||||
| 
 | ||||
|     auto window = GUI::Window::construct(); | ||||
| 
 | ||||
|  |  | |||
|  | @ -6,6 +6,7 @@ | |||
|  */ | ||||
| 
 | ||||
| #include "PDFViewerWidget.h" | ||||
| #include <LibCore/System.h> | ||||
| #include <LibFileSystemAccessClient/Client.h> | ||||
| #include <LibGUI/Application.h> | ||||
| #include <LibGUI/Icon.h> | ||||
|  | @ -13,7 +14,6 @@ | |||
| #include <LibGUI/MessageBox.h> | ||||
| #include <LibGUI/Window.h> | ||||
| #include <LibMain/Main.h> | ||||
| #include <LibSystem/Wrappers.h> | ||||
| 
 | ||||
| ErrorOr<int> serenity_main(Main::Arguments arguments) | ||||
| { | ||||
|  | @ -24,9 +24,9 @@ ErrorOr<int> serenity_main(Main::Arguments arguments) | |||
|     window->set_title("PDF Viewer"); | ||||
|     window->resize(640, 400); | ||||
| 
 | ||||
|     TRY(System::unveil("/res", "r")); | ||||
|     TRY(System::unveil("/tmp/portal/filesystemaccess", "rw")); | ||||
|     TRY(System::unveil(nullptr, nullptr)); | ||||
|     TRY(Core::System::unveil("/res", "r")); | ||||
|     TRY(Core::System::unveil("/tmp/portal/filesystemaccess", "rw")); | ||||
|     TRY(Core::System::unveil(nullptr, nullptr)); | ||||
| 
 | ||||
|     auto& pdf_viewer_widget = window->set_main_widget<PDFViewerWidget>(); | ||||
| 
 | ||||
|  |  | |||
|  | @ -15,6 +15,7 @@ | |||
| #include <LibAudio/ClientConnection.h> | ||||
| #include <LibAudio/WavWriter.h> | ||||
| #include <LibCore/EventLoop.h> | ||||
| #include <LibCore/System.h> | ||||
| #include <LibGUI/Action.h> | ||||
| #include <LibGUI/Application.h> | ||||
| #include <LibGUI/FilePicker.h> | ||||
|  | @ -23,11 +24,10 @@ | |||
| #include <LibGUI/MessageBox.h> | ||||
| #include <LibGUI/Window.h> | ||||
| #include <LibMain/Main.h> | ||||
| #include <LibSystem/Wrappers.h> | ||||
| 
 | ||||
| ErrorOr<int> serenity_main(Main::Arguments arguments) | ||||
| { | ||||
|     TRY(System::pledge("stdio thread rpath cpath wpath recvfd sendfd unix", nullptr)); | ||||
|     TRY(Core::System::pledge("stdio thread rpath cpath wpath recvfd sendfd unix", nullptr)); | ||||
| 
 | ||||
|     auto app = GUI::Application::construct(arguments); | ||||
| 
 | ||||
|  |  | |||
|  | @ -8,6 +8,7 @@ | |||
| #include "MainWidget.h" | ||||
| #include <LibConfig/Client.h> | ||||
| #include <LibCore/ArgsParser.h> | ||||
| #include <LibCore/System.h> | ||||
| #include <LibFileSystemAccessClient/Client.h> | ||||
| #include <LibGUI/Action.h> | ||||
| #include <LibGUI/Application.h> | ||||
|  | @ -17,11 +18,10 @@ | |||
| #include <LibGUI/Window.h> | ||||
| #include <LibGfx/Painter.h> | ||||
| #include <LibMain/Main.h> | ||||
| #include <LibSystem/Wrappers.h> | ||||
| 
 | ||||
| ErrorOr<int> serenity_main(Main::Arguments arguments) | ||||
| { | ||||
|     TRY(System::pledge("stdio thread recvfd sendfd rpath unix wpath cpath", nullptr)); | ||||
|     TRY(Core::System::pledge("stdio thread recvfd sendfd rpath unix wpath cpath", nullptr)); | ||||
| 
 | ||||
|     auto app = GUI::Application::construct(arguments); | ||||
|     Config::pledge_domains("PixelPaint"); | ||||
|  | @ -31,11 +31,11 @@ ErrorOr<int> serenity_main(Main::Arguments arguments) | |||
|     args_parser.add_positional_argument(image_file, "Image file to open", "path", Core::ArgsParser::Required::No); | ||||
|     args_parser.parse(arguments); | ||||
| 
 | ||||
|     TRY(System::unveil("/res", "r")); | ||||
|     TRY(System::unveil("/tmp/portal/clipboard", "rw")); | ||||
|     TRY(System::unveil("/tmp/portal/filesystemaccess", "rw")); | ||||
|     TRY(System::unveil("/tmp/portal/image", "rw")); | ||||
|     TRY(System::unveil(nullptr, nullptr)); | ||||
|     TRY(Core::System::unveil("/res", "r")); | ||||
|     TRY(Core::System::unveil("/tmp/portal/clipboard", "rw")); | ||||
|     TRY(Core::System::unveil("/tmp/portal/filesystemaccess", "rw")); | ||||
|     TRY(Core::System::unveil("/tmp/portal/image", "rw")); | ||||
|     TRY(Core::System::unveil(nullptr, nullptr)); | ||||
| 
 | ||||
|     auto app_icon = GUI::Icon::default_icon("app-pixel-paint"); | ||||
| 
 | ||||
|  |  | |||
|  | @ -11,6 +11,7 @@ | |||
| #include <LibCore/ArgsParser.h> | ||||
| #include <LibCore/DirIterator.h> | ||||
| #include <LibCore/Process.h> | ||||
| #include <LibCore/System.h> | ||||
| #include <LibDesktop/Launcher.h> | ||||
| #include <LibGUI/Action.h> | ||||
| #include <LibGUI/ActionGroup.h> | ||||
|  | @ -33,7 +34,6 @@ | |||
| #include <LibGUI/Window.h> | ||||
| #include <LibGfx/Palette.h> | ||||
| #include <LibMain/Main.h> | ||||
| #include <LibSystem/Wrappers.h> | ||||
| #include <LibVT/TerminalWidget.h> | ||||
| #include <assert.h> | ||||
| #include <errno.h> | ||||
|  | @ -252,18 +252,18 @@ static RefPtr<GUI::Window> create_find_window(VT::TerminalWidget& terminal) | |||
| 
 | ||||
| ErrorOr<int> serenity_main(Main::Arguments arguments) | ||||
| { | ||||
|     TRY(System::pledge("stdio tty rpath cpath wpath recvfd sendfd proc exec unix sigaction", nullptr)); | ||||
|     TRY(Core::System::pledge("stdio tty rpath cpath wpath recvfd sendfd proc exec unix sigaction", nullptr)); | ||||
| 
 | ||||
|     struct sigaction act; | ||||
|     memset(&act, 0, sizeof(act)); | ||||
|     act.sa_flags = SA_NOCLDWAIT; | ||||
|     act.sa_handler = SIG_IGN; | ||||
| 
 | ||||
|     TRY(System::sigaction(SIGCHLD, &act, nullptr)); | ||||
|     TRY(Core::System::sigaction(SIGCHLD, &act, nullptr)); | ||||
| 
 | ||||
|     auto app = GUI::Application::construct(arguments); | ||||
| 
 | ||||
|     TRY(System::pledge("stdio tty rpath cpath wpath recvfd sendfd proc exec unix", nullptr)); | ||||
|     TRY(Core::System::pledge("stdio tty rpath cpath wpath recvfd sendfd proc exec unix", nullptr)); | ||||
| 
 | ||||
|     Config::pledge_domains("Terminal"); | ||||
| 
 | ||||
|  | @ -422,14 +422,14 @@ ErrorOr<int> serenity_main(Main::Arguments arguments) | |||
|             settings_window->close(); | ||||
|     }; | ||||
| 
 | ||||
|     TRY(System::unveil("/res", "r")); | ||||
|     TRY(System::unveil("/bin", "r")); | ||||
|     TRY(System::unveil("/bin/Terminal", "x")); | ||||
|     TRY(System::unveil("/bin/utmpupdate", "x")); | ||||
|     TRY(System::unveil("/etc/FileIconProvider.ini", "r")); | ||||
|     TRY(System::unveil("/tmp/portal/launch", "rw")); | ||||
|     TRY(System::unveil("/tmp/portal/config", "rw")); | ||||
|     TRY(System::unveil(nullptr, nullptr)); | ||||
|     TRY(Core::System::unveil("/res", "r")); | ||||
|     TRY(Core::System::unveil("/bin", "r")); | ||||
|     TRY(Core::System::unveil("/bin/Terminal", "x")); | ||||
|     TRY(Core::System::unveil("/bin/utmpupdate", "x")); | ||||
|     TRY(Core::System::unveil("/etc/FileIconProvider.ini", "r")); | ||||
|     TRY(Core::System::unveil("/tmp/portal/launch", "rw")); | ||||
|     TRY(Core::System::unveil("/tmp/portal/config", "rw")); | ||||
|     TRY(Core::System::unveil(nullptr, nullptr)); | ||||
| 
 | ||||
|     window->show(); | ||||
|     int result = app->exec(); | ||||
|  |  | |||
|  | @ -6,6 +6,7 @@ | |||
| 
 | ||||
| #include <AK/Vector.h> | ||||
| #include <LibCore/ArgsParser.h> | ||||
| #include <LibCore/System.h> | ||||
| #include <LibGUI/Application.h> | ||||
| #include <LibGUI/Event.h> | ||||
| #include <LibGUI/Icon.h> | ||||
|  | @ -14,7 +15,6 @@ | |||
| #include <LibGUI/Window.h> | ||||
| #include <LibGfx/Bitmap.h> | ||||
| #include <LibMain/Main.h> | ||||
| #include <LibSystem/Wrappers.h> | ||||
| #include <stdio.h> | ||||
| #include <time.h> | ||||
| 
 | ||||
|  | @ -149,7 +149,7 @@ void Starfield::draw() | |||
| 
 | ||||
| ErrorOr<int> serenity_main(Main::Arguments arguments) | ||||
| { | ||||
|     TRY(System::pledge("stdio recvfd sendfd rpath unix", nullptr)); | ||||
|     TRY(Core::System::pledge("stdio recvfd sendfd rpath unix", nullptr)); | ||||
| 
 | ||||
|     unsigned star_count = 1000; | ||||
|     unsigned refresh_rate = 16; | ||||
|  | @ -164,7 +164,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments) | |||
| 
 | ||||
|     auto app = GUI::Application::construct(arguments); | ||||
| 
 | ||||
|     TRY(System::pledge("stdio recvfd sendfd rpath", nullptr)); | ||||
|     TRY(Core::System::pledge("stdio recvfd sendfd rpath", nullptr)); | ||||
| 
 | ||||
|     auto app_icon = GUI::Icon::default_icon("app-screensaver"); | ||||
|     auto window = GUI::Window::construct(); | ||||
|  |  | |||
|  | @ -10,9 +10,9 @@ | |||
| #include <LibCore/ArgsParser.h> | ||||
| #include <LibCore/EventLoop.h> | ||||
| #include <LibCore/LocalServer.h> | ||||
| #include <LibCore/System.h> | ||||
| #include <LibIPC/ClientConnection.h> | ||||
| #include <LibMain/Main.h> | ||||
| #include <LibSystem/Wrappers.h> | ||||
| #include <unistd.h> | ||||
| 
 | ||||
| static ErrorOr<int> mode_server(); | ||||
|  | @ -34,13 +34,13 @@ ErrorOr<int> serenity_main(Main::Arguments arguments) | |||
| ErrorOr<int> mode_server() | ||||
| { | ||||
|     Core::EventLoop event_loop; | ||||
|     TRY(System::pledge("stdio unix recvfd rpath ", nullptr)); | ||||
|     TRY(Core::System::pledge("stdio unix recvfd rpath ", nullptr)); | ||||
| 
 | ||||
|     auto socket = Core::LocalSocket::take_over_accepted_socket_from_system_server(); | ||||
|     IPC::new_client_connection<LanguageServers::Cpp::ClientConnection>(socket.release_nonnull(), 1); | ||||
| 
 | ||||
|     TRY(System::pledge("stdio recvfd rpath", nullptr)); | ||||
|     TRY(System::unveil("/usr/include", "r")); | ||||
|     TRY(Core::System::pledge("stdio recvfd rpath", nullptr)); | ||||
|     TRY(Core::System::unveil("/usr/include", "r")); | ||||
| 
 | ||||
|     // unveil will be sealed later, when we know the project's root path.
 | ||||
|     return event_loop.exec(); | ||||
|  |  | |||
|  | @ -7,19 +7,19 @@ | |||
| #include "ClientConnection.h" | ||||
| #include <LibCore/EventLoop.h> | ||||
| #include <LibCore/LocalServer.h> | ||||
| #include <LibCore/System.h> | ||||
| #include <LibIPC/ClientConnection.h> | ||||
| #include <LibMain/Main.h> | ||||
| #include <LibSystem/Wrappers.h> | ||||
| 
 | ||||
| ErrorOr<int> serenity_main(Main::Arguments) | ||||
| { | ||||
|     Core::EventLoop event_loop; | ||||
|     TRY(System::pledge("stdio unix rpath recvfd", nullptr)); | ||||
|     TRY(Core::System::pledge("stdio unix rpath recvfd", nullptr)); | ||||
| 
 | ||||
|     auto socket = Core::LocalSocket::take_over_accepted_socket_from_system_server(); | ||||
|     IPC::new_client_connection<LanguageServers::Shell::ClientConnection>(socket.release_nonnull(), 1); | ||||
|     TRY(System::pledge("stdio rpath recvfd", nullptr)); | ||||
|     TRY(System::unveil("/etc/passwd", "r")); | ||||
|     TRY(Core::System::pledge("stdio rpath recvfd", nullptr)); | ||||
|     TRY(Core::System::unveil("/etc/passwd", "r")); | ||||
| 
 | ||||
|     return event_loop.exec(); | ||||
| } | ||||
|  |  | |||
|  | @ -8,6 +8,7 @@ | |||
| #include "Game.h" | ||||
| #include "GameSizeDialog.h" | ||||
| #include <LibConfig/Client.h> | ||||
| #include <LibCore/System.h> | ||||
| #include <LibGUI/Action.h> | ||||
| #include <LibGUI/Application.h> | ||||
| #include <LibGUI/BoxLayout.h> | ||||
|  | @ -20,13 +21,12 @@ | |||
| #include <LibGUI/Window.h> | ||||
| #include <LibGfx/Painter.h> | ||||
| #include <LibMain/Main.h> | ||||
| #include <LibSystem/Wrappers.h> | ||||
| #include <stdio.h> | ||||
| #include <time.h> | ||||
| 
 | ||||
| ErrorOr<int> serenity_main(Main::Arguments arguments) | ||||
| { | ||||
|     TRY(System::pledge("stdio rpath recvfd sendfd unix", nullptr)); | ||||
|     TRY(Core::System::pledge("stdio rpath recvfd sendfd unix", nullptr)); | ||||
| 
 | ||||
|     srand(time(nullptr)); | ||||
| 
 | ||||
|  | @ -37,10 +37,10 @@ ErrorOr<int> serenity_main(Main::Arguments arguments) | |||
| 
 | ||||
|     Config::pledge_domains("2048"); | ||||
| 
 | ||||
|     TRY(System::pledge("stdio rpath recvfd sendfd", nullptr)); | ||||
|     TRY(Core::System::pledge("stdio rpath recvfd sendfd", nullptr)); | ||||
| 
 | ||||
|     TRY(System::unveil("/res", "r")); | ||||
|     TRY(System::unveil(nullptr, nullptr)); | ||||
|     TRY(Core::System::unveil("/res", "r")); | ||||
|     TRY(Core::System::unveil(nullptr, nullptr)); | ||||
| 
 | ||||
|     size_t board_size = Config::read_i32("2048", "", "board_size", 4); | ||||
|     u32 target_tile = Config::read_i32("2048", "", "target_tile", 2048); | ||||
|  |  | |||
|  | @ -5,6 +5,7 @@ | |||
|  */ | ||||
| 
 | ||||
| #include "Game.h" | ||||
| #include <LibCore/System.h> | ||||
| #include <LibGUI/Application.h> | ||||
| #include <LibGUI/Icon.h> | ||||
| #include <LibGUI/Menu.h> | ||||
|  | @ -12,18 +13,17 @@ | |||
| #include <LibGUI/Window.h> | ||||
| #include <LibGfx/Bitmap.h> | ||||
| #include <LibMain/Main.h> | ||||
| #include <LibSystem/Wrappers.h> | ||||
| 
 | ||||
| ErrorOr<int> serenity_main(Main::Arguments arguments) | ||||
| { | ||||
|     TRY(System::pledge("stdio recvfd sendfd rpath unix", nullptr)); | ||||
|     TRY(Core::System::pledge("stdio recvfd sendfd rpath unix", nullptr)); | ||||
| 
 | ||||
|     auto app = GUI::Application::construct(arguments); | ||||
| 
 | ||||
|     TRY(System::pledge("stdio recvfd sendfd rpath", nullptr)); | ||||
|     TRY(Core::System::pledge("stdio recvfd sendfd rpath", nullptr)); | ||||
| 
 | ||||
|     TRY(System::unveil("/res", "r")); | ||||
|     TRY(System::unveil(nullptr, nullptr)); | ||||
|     TRY(Core::System::unveil("/res", "r")); | ||||
|     TRY(Core::System::unveil(nullptr, nullptr)); | ||||
| 
 | ||||
|     auto window = GUI::Window::construct(); | ||||
|     window->resize(Breakout::Game::game_width, Breakout::Game::game_height); | ||||
|  |  | |||
|  | @ -7,6 +7,7 @@ | |||
| #include "ChessWidget.h" | ||||
| #include <LibConfig/Client.h> | ||||
| #include <LibCore/DirIterator.h> | ||||
| #include <LibCore/System.h> | ||||
| #include <LibGUI/ActionGroup.h> | ||||
| #include <LibGUI/Application.h> | ||||
| #include <LibGUI/Clipboard.h> | ||||
|  | @ -17,28 +18,27 @@ | |||
| #include <LibGUI/MessageBox.h> | ||||
| #include <LibGUI/Window.h> | ||||
| #include <LibMain/Main.h> | ||||
| #include <LibSystem/Wrappers.h> | ||||
| 
 | ||||
| ErrorOr<int> serenity_main(Main::Arguments arguments) | ||||
| { | ||||
|     TRY(System::pledge("stdio rpath wpath cpath recvfd sendfd thread proc exec unix", nullptr)); | ||||
|     TRY(Core::System::pledge("stdio rpath wpath cpath recvfd sendfd thread proc exec unix", nullptr)); | ||||
| 
 | ||||
|     auto app = GUI::Application::construct(arguments); | ||||
| 
 | ||||
|     Config::pledge_domains("Chess"); | ||||
| 
 | ||||
|     TRY(System::pledge("stdio rpath wpath cpath recvfd sendfd thread proc exec", nullptr)); | ||||
|     TRY(Core::System::pledge("stdio rpath wpath cpath recvfd sendfd thread proc exec", nullptr)); | ||||
| 
 | ||||
|     auto app_icon = GUI::Icon::default_icon("app-chess"); | ||||
| 
 | ||||
|     auto window = GUI::Window::construct(); | ||||
|     auto& widget = window->set_main_widget<ChessWidget>(); | ||||
| 
 | ||||
|     TRY(System::unveil("/res", "r")); | ||||
|     TRY(System::unveil("/bin/ChessEngine", "x")); | ||||
|     TRY(System::unveil("/etc/passwd", "r")); | ||||
|     TRY(System::unveil(Core::StandardPaths::home_directory().characters(), "wcbr")); | ||||
|     TRY(System::unveil(nullptr, nullptr)); | ||||
|     TRY(Core::System::unveil("/res", "r")); | ||||
|     TRY(Core::System::unveil("/bin/ChessEngine", "x")); | ||||
|     TRY(Core::System::unveil("/etc/passwd", "r")); | ||||
|     TRY(Core::System::unveil(Core::StandardPaths::home_directory().characters(), "wcbr")); | ||||
|     TRY(Core::System::unveil(nullptr, nullptr)); | ||||
| 
 | ||||
|     auto size = Config::read_i32("Chess", "Display", "size", 512); | ||||
|     window->set_title("Chess"); | ||||
|  |  | |||
|  | @ -6,6 +6,7 @@ | |||
| 
 | ||||
| #include "Game.h" | ||||
| #include <LibConfig/Client.h> | ||||
| #include <LibCore/System.h> | ||||
| #include <LibGUI/Application.h> | ||||
| #include <LibGUI/Icon.h> | ||||
| #include <LibGUI/Menu.h> | ||||
|  | @ -13,20 +14,19 @@ | |||
| #include <LibGUI/MessageBox.h> | ||||
| #include <LibGUI/Window.h> | ||||
| #include <LibMain/Main.h> | ||||
| #include <LibSystem/Wrappers.h> | ||||
| 
 | ||||
| ErrorOr<int> serenity_main(Main::Arguments arguments) | ||||
| { | ||||
|     TRY(System::pledge("stdio rpath recvfd sendfd unix", nullptr)); | ||||
|     TRY(Core::System::pledge("stdio rpath recvfd sendfd unix", nullptr)); | ||||
| 
 | ||||
|     auto app = GUI::Application::construct(arguments.argc, arguments.argv); | ||||
| 
 | ||||
|     Config::pledge_domains("FlappyBug"); | ||||
| 
 | ||||
|     TRY(System::pledge("stdio rpath recvfd sendfd", nullptr)); | ||||
|     TRY(Core::System::pledge("stdio rpath recvfd sendfd", nullptr)); | ||||
| 
 | ||||
|     TRY(System::unveil("/res", "r")); | ||||
|     TRY(System::unveil(nullptr, nullptr)); | ||||
|     TRY(Core::System::unveil("/res", "r")); | ||||
|     TRY(Core::System::unveil(nullptr, nullptr)); | ||||
| 
 | ||||
|     u32 high_score = Config::read_i32("FlappyBug", "Game", "HighScore", 0); | ||||
| 
 | ||||
|  |  | |||
|  | @ -7,6 +7,7 @@ | |||
| #include "CustomGameDialog.h" | ||||
| #include "Field.h" | ||||
| #include <LibConfig/Client.h> | ||||
| #include <LibCore/System.h> | ||||
| #include <LibGUI/Action.h> | ||||
| #include <LibGUI/ActionGroup.h> | ||||
| #include <LibGUI/Application.h> | ||||
|  | @ -19,21 +20,20 @@ | |||
| #include <LibGUI/SeparatorWidget.h> | ||||
| #include <LibGUI/Window.h> | ||||
| #include <LibMain/Main.h> | ||||
| #include <LibSystem/Wrappers.h> | ||||
| #include <stdio.h> | ||||
| 
 | ||||
| ErrorOr<int> serenity_main(Main::Arguments arguments) | ||||
| { | ||||
|     TRY(System::pledge("stdio rpath recvfd sendfd unix", nullptr)); | ||||
|     TRY(Core::System::pledge("stdio rpath recvfd sendfd unix", nullptr)); | ||||
| 
 | ||||
|     auto app = GUI::Application::construct(arguments); | ||||
| 
 | ||||
|     Config::pledge_domains("Minesweeper"); | ||||
| 
 | ||||
|     TRY(System::pledge("stdio rpath recvfd sendfd", nullptr)); | ||||
|     TRY(Core::System::pledge("stdio rpath recvfd sendfd", nullptr)); | ||||
| 
 | ||||
|     TRY(System::unveil("/res", "r")); | ||||
|     TRY(System::unveil(nullptr, nullptr)); | ||||
|     TRY(Core::System::unveil("/res", "r")); | ||||
|     TRY(Core::System::unveil(nullptr, nullptr)); | ||||
| 
 | ||||
|     auto app_icon = GUI::Icon::default_icon("app-minesweeper"); | ||||
| 
 | ||||
|  |  | |||
|  | @ -8,6 +8,7 @@ | |||
| #include "Game.h" | ||||
| #include <Games/Spider/SpiderGML.h> | ||||
| #include <LibConfig/Client.h> | ||||
| #include <LibCore/System.h> | ||||
| #include <LibCore/Timer.h> | ||||
| #include <LibGUI/Action.h> | ||||
| #include <LibGUI/ActionGroup.h> | ||||
|  | @ -19,7 +20,6 @@ | |||
| #include <LibGUI/Statusbar.h> | ||||
| #include <LibGUI/Window.h> | ||||
| #include <LibMain/Main.h> | ||||
| #include <LibSystem/Wrappers.h> | ||||
| #include <stdio.h> | ||||
| 
 | ||||
| enum class StatisticDisplay : u8 { | ||||
|  | @ -39,17 +39,17 @@ static String format_seconds(uint64_t seconds_elapsed) | |||
| 
 | ||||
| ErrorOr<int> serenity_main(Main::Arguments arguments) | ||||
| { | ||||
|     TRY(System::pledge("stdio recvfd sendfd rpath unix", nullptr)); | ||||
|     TRY(Core::System::pledge("stdio recvfd sendfd rpath unix", nullptr)); | ||||
| 
 | ||||
|     auto app = GUI::Application::construct(arguments.argc, arguments.argv); | ||||
|     auto app_icon = GUI::Icon::default_icon("app-spider"); | ||||
| 
 | ||||
|     Config::pledge_domains("Spider"); | ||||
| 
 | ||||
|     TRY(System::pledge("stdio recvfd sendfd rpath", nullptr)); | ||||
|     TRY(Core::System::pledge("stdio recvfd sendfd rpath", nullptr)); | ||||
| 
 | ||||
|     TRY(System::unveil("/res", "r")); | ||||
|     TRY(System::unveil(nullptr, nullptr)); | ||||
|     TRY(Core::System::unveil("/res", "r")); | ||||
|     TRY(Core::System::unveil(nullptr, nullptr)); | ||||
| 
 | ||||
|     auto window = GUI::Window::construct(); | ||||
|     window->set_title("Spider"); | ||||
|  |  | |||
|  | @ -27,6 +27,7 @@ set(SOURCES | |||
|     SecretString.cpp | ||||
|     Socket.cpp | ||||
|     StandardPaths.cpp | ||||
|     System.cpp | ||||
|     TCPServer.cpp | ||||
|     TCPSocket.cpp | ||||
|     Timer.cpp | ||||
|  |  | |||
|  | @ -4,7 +4,7 @@ | |||
|  * SPDX-License-Identifier: BSD-2-Clause | ||||
|  */ | ||||
| 
 | ||||
| #include <LibSystem/Wrappers.h> | ||||
| #include <LibCore/System.h> | ||||
| #include <LibSystem/syscall.h> | ||||
| 
 | ||||
| #define HANDLE_SYSCALL_RETURN_VALUE(syscall_name, rc, success_value) \ | ||||
|  | @ -13,8 +13,9 @@ | |||
|     }                                                                \ | ||||
|     return success_value; | ||||
| 
 | ||||
| namespace System { | ||||
| namespace Core::System { | ||||
| 
 | ||||
| #ifdef __serenity__ | ||||
| ErrorOr<void> pledge(StringView promises, StringView execpromises) | ||||
| { | ||||
|     Syscall::SC_pledge_params params { | ||||
|  | @ -34,18 +35,13 @@ ErrorOr<void> unveil(StringView path, StringView permissions) | |||
|     int rc = syscall(SC_unveil, ¶ms); | ||||
|     HANDLE_SYSCALL_RETURN_VALUE("unveil"sv, rc, {}); | ||||
| } | ||||
| #endif | ||||
| 
 | ||||
| ErrorOr<void> sigaction(int signal, struct sigaction const* action, struct sigaction* old_action) | ||||
| { | ||||
|     int rc = syscall(SC_sigaction, signal, action, old_action); | ||||
|     HANDLE_SYSCALL_RETURN_VALUE("sigaction"sv, rc, {}); | ||||
| } | ||||
| 
 | ||||
| ErrorOr<struct stat> fstat(int fd) | ||||
| { | ||||
|     struct stat st; | ||||
|     int rc = syscall(SC_fstat, fd, &st); | ||||
|     HANDLE_SYSCALL_RETURN_VALUE("fstat"sv, rc, st); | ||||
|     if (::sigaction(signal, action, old_action) < 0) | ||||
|         return Error::from_syscall("sigaction"sv, -errno); | ||||
|     return {}; | ||||
| } | ||||
| 
 | ||||
| } | ||||
|  | @ -8,13 +8,14 @@ | |||
| 
 | ||||
| #include <AK/Error.h> | ||||
| #include <signal.h> | ||||
| #include <sys/stat.h> | ||||
| 
 | ||||
| namespace System { | ||||
| namespace Core::System { | ||||
| 
 | ||||
| #ifdef __serenity__ | ||||
| ErrorOr<void> pledge(StringView promises, StringView execpromises); | ||||
| ErrorOr<void> unveil(StringView path, StringView permissions); | ||||
| #endif | ||||
| 
 | ||||
| ErrorOr<void> sigaction(int signal, struct sigaction const* action, struct sigaction* old_action); | ||||
| ErrorOr<struct stat> fstat(int fd); | ||||
| 
 | ||||
| } | ||||
|  | @ -1,13 +1,7 @@ | |||
| set(SOURCES | ||||
|     Wrappers.cpp | ||||
|     syscall.cpp | ||||
| ) | ||||
| 
 | ||||
| # FIXME: This is a hack to avoid a circular dependency with LibC. Figure out a better way. | ||||
| if ("${SERENITY_ARCH}" STREQUAL "i686") | ||||
|     set_source_files_properties(${SOURCES} PROPERTIES COMPILE_FLAGS "-fno-stack-protector") | ||||
| endif() | ||||
| 
 | ||||
| set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -nostdlib") | ||||
| serenity_libc(LibSystem system) | ||||
| target_include_directories(LibSystem PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) | ||||
|  |  | |||
|  | @ -6,14 +6,14 @@ | |||
| 
 | ||||
| #include <FileSystemAccessServer/ClientConnection.h> | ||||
| #include <LibCore/LocalServer.h> | ||||
| #include <LibCore/System.h> | ||||
| #include <LibGUI/Application.h> | ||||
| #include <LibIPC/ClientConnection.h> | ||||
| #include <LibMain/Main.h> | ||||
| #include <LibSystem/Wrappers.h> | ||||
| 
 | ||||
| ErrorOr<int> serenity_main(Main::Arguments) | ||||
| { | ||||
|     TRY(System::pledge("stdio recvfd sendfd rpath cpath wpath unix thread", nullptr)); | ||||
|     TRY(Core::System::pledge("stdio recvfd sendfd rpath cpath wpath unix thread", nullptr)); | ||||
| 
 | ||||
|     auto app = GUI::Application::construct(0, nullptr); | ||||
|     app->set_quit_when_last_window_deleted(false); | ||||
|  |  | |||
|  | @ -7,18 +7,18 @@ | |||
| #include <ImageDecoder/ClientConnection.h> | ||||
| #include <LibCore/EventLoop.h> | ||||
| #include <LibCore/LocalServer.h> | ||||
| #include <LibCore/System.h> | ||||
| #include <LibIPC/ClientConnection.h> | ||||
| #include <LibMain/Main.h> | ||||
| #include <LibSystem/Wrappers.h> | ||||
| 
 | ||||
| ErrorOr<int> serenity_main(Main::Arguments) | ||||
| { | ||||
|     Core::EventLoop event_loop; | ||||
|     TRY(System::pledge("stdio recvfd sendfd unix", nullptr)); | ||||
|     TRY(System::unveil(nullptr, nullptr)); | ||||
|     TRY(Core::System::pledge("stdio recvfd sendfd unix", nullptr)); | ||||
|     TRY(Core::System::unveil(nullptr, nullptr)); | ||||
| 
 | ||||
|     auto socket = Core::LocalSocket::take_over_accepted_socket_from_system_server(); | ||||
|     IPC::new_client_connection<ImageDecoder::ClientConnection>(socket.release_nonnull(), 1); | ||||
|     TRY(System::pledge("stdio recvfd sendfd", nullptr)); | ||||
|     TRY(Core::System::pledge("stdio recvfd sendfd", nullptr)); | ||||
|     return event_loop.exec(); | ||||
| } | ||||
|  |  | |||
|  | @ -7,9 +7,9 @@ | |||
| #include <AK/OwnPtr.h> | ||||
| #include <LibCore/EventLoop.h> | ||||
| #include <LibCore/LocalServer.h> | ||||
| #include <LibCore/System.h> | ||||
| #include <LibIPC/ClientConnection.h> | ||||
| #include <LibMain/Main.h> | ||||
| #include <LibSystem/Wrappers.h> | ||||
| #include <LibTLS/Certificate.h> | ||||
| #include <RequestServer/ClientConnection.h> | ||||
| #include <RequestServer/GeminiProtocol.h> | ||||
|  | @ -19,7 +19,7 @@ | |||
| 
 | ||||
| ErrorOr<int> serenity_main(Main::Arguments) | ||||
| { | ||||
|     TRY(System::pledge("stdio inet accept unix rpath sendfd recvfd sigaction", nullptr)); | ||||
|     TRY(Core::System::pledge("stdio inet accept unix rpath sendfd recvfd sigaction", nullptr)); | ||||
| 
 | ||||
|     signal(SIGINFO, [](int) { RequestServer::ConnectionCache::dump_jobs(); }); | ||||
| 
 | ||||
|  | @ -28,9 +28,9 @@ ErrorOr<int> serenity_main(Main::Arguments) | |||
| 
 | ||||
|     Core::EventLoop event_loop; | ||||
|     // FIXME: Establish a connection to LookupServer and then drop "unix"?
 | ||||
|     TRY(System::pledge("stdio inet accept unix sendfd recvfd", nullptr)); | ||||
|     TRY(System::unveil("/tmp/portal/lookup", "rw")); | ||||
|     TRY(System::unveil(nullptr, nullptr)); | ||||
|     TRY(Core::System::pledge("stdio inet accept unix sendfd recvfd", nullptr)); | ||||
|     TRY(Core::System::unveil("/tmp/portal/lookup", "rw")); | ||||
|     TRY(Core::System::unveil(nullptr, nullptr)); | ||||
| 
 | ||||
|     [[maybe_unused]] auto gemini = make<RequestServer::GeminiProtocol>(); | ||||
|     [[maybe_unused]] auto http = make<RequestServer::HttpProtocol>(); | ||||
|  |  | |||
|  | @ -6,20 +6,20 @@ | |||
| 
 | ||||
| #include <LibCore/EventLoop.h> | ||||
| #include <LibCore/LocalServer.h> | ||||
| #include <LibCore/System.h> | ||||
| #include <LibIPC/ClientConnection.h> | ||||
| #include <LibMain/Main.h> | ||||
| #include <LibSystem/Wrappers.h> | ||||
| #include <WebContent/ClientConnection.h> | ||||
| 
 | ||||
| ErrorOr<int> serenity_main(Main::Arguments) | ||||
| { | ||||
|     Core::EventLoop event_loop; | ||||
|     TRY(System::pledge("stdio recvfd sendfd accept unix rpath", nullptr)); | ||||
|     TRY(System::unveil("/res", "r")); | ||||
|     TRY(System::unveil("/tmp/portal/request", "rw")); | ||||
|     TRY(System::unveil("/tmp/portal/image", "rw")); | ||||
|     TRY(System::unveil("/tmp/portal/websocket", "rw")); | ||||
|     TRY(System::unveil(nullptr, nullptr)); | ||||
|     TRY(Core::System::pledge("stdio recvfd sendfd accept unix rpath", nullptr)); | ||||
|     TRY(Core::System::unveil("/res", "r")); | ||||
|     TRY(Core::System::unveil("/tmp/portal/request", "rw")); | ||||
|     TRY(Core::System::unveil("/tmp/portal/image", "rw")); | ||||
|     TRY(Core::System::unveil("/tmp/portal/websocket", "rw")); | ||||
|     TRY(Core::System::unveil(nullptr, nullptr)); | ||||
| 
 | ||||
|     auto socket = Core::LocalSocket::take_over_accepted_socket_from_system_server(); | ||||
|     VERIFY(socket); | ||||
|  |  | |||
|  | @ -6,24 +6,24 @@ | |||
| 
 | ||||
| #include <LibCore/EventLoop.h> | ||||
| #include <LibCore/LocalServer.h> | ||||
| #include <LibCore/System.h> | ||||
| #include <LibIPC/ClientConnection.h> | ||||
| #include <LibMain/Main.h> | ||||
| #include <LibSystem/Wrappers.h> | ||||
| #include <LibTLS/Certificate.h> | ||||
| #include <WebSocket/ClientConnection.h> | ||||
| 
 | ||||
| ErrorOr<int> serenity_main(Main::Arguments) | ||||
| { | ||||
|     TRY(System::pledge("stdio inet unix rpath sendfd recvfd", nullptr)); | ||||
|     TRY(Core::System::pledge("stdio inet unix rpath sendfd recvfd", nullptr)); | ||||
| 
 | ||||
|     // Ensure the certificates are read out here.
 | ||||
|     [[maybe_unused]] auto& certs = DefaultRootCACertificates::the(); | ||||
| 
 | ||||
|     Core::EventLoop event_loop; | ||||
|     // FIXME: Establish a connection to LookupServer and then drop "unix"?
 | ||||
|     TRY(System::pledge("stdio inet unix sendfd recvfd", nullptr)); | ||||
|     TRY(System::unveil("/tmp/portal/lookup", "rw")); | ||||
|     TRY(System::unveil(nullptr, nullptr)); | ||||
|     TRY(Core::System::pledge("stdio inet unix sendfd recvfd", nullptr)); | ||||
|     TRY(Core::System::unveil("/tmp/portal/lookup", "rw")); | ||||
|     TRY(Core::System::unveil(nullptr, nullptr)); | ||||
| 
 | ||||
|     auto socket = Core::LocalSocket::take_over_accepted_socket_from_system_server(); | ||||
|     VERIFY(socket); | ||||
|  |  | |||
|  | @ -12,25 +12,25 @@ | |||
| #include <LibCore/ConfigFile.h> | ||||
| #include <LibCore/DirIterator.h> | ||||
| #include <LibCore/File.h> | ||||
| #include <LibCore/System.h> | ||||
| #include <LibGfx/Palette.h> | ||||
| #include <LibGfx/SystemTheme.h> | ||||
| #include <LibMain/Main.h> | ||||
| #include <LibSystem/Wrappers.h> | ||||
| #include <signal.h> | ||||
| #include <string.h> | ||||
| 
 | ||||
| ErrorOr<int> serenity_main(Main::Arguments) | ||||
| { | ||||
|     TRY(System::pledge("stdio video thread sendfd recvfd accept rpath wpath cpath unix proc sigaction", nullptr)); | ||||
|     TRY(System::unveil("/res", "r")); | ||||
|     TRY(System::unveil("/tmp", "cw")); | ||||
|     TRY(System::unveil("/etc/WindowServer.ini", "rwc")); | ||||
|     TRY(System::unveil("/dev", "rw")); | ||||
|     TRY(Core::System::pledge("stdio video thread sendfd recvfd accept rpath wpath cpath unix proc sigaction", nullptr)); | ||||
|     TRY(Core::System::unveil("/res", "r")); | ||||
|     TRY(Core::System::unveil("/tmp", "cw")); | ||||
|     TRY(Core::System::unveil("/etc/WindowServer.ini", "rwc")); | ||||
|     TRY(Core::System::unveil("/dev", "rw")); | ||||
| 
 | ||||
|     struct sigaction act = {}; | ||||
|     act.sa_flags = SA_NOCLDWAIT; | ||||
|     act.sa_handler = SIG_IGN; | ||||
|     TRY(System::sigaction(SIGCHLD, &act, nullptr)); | ||||
|     TRY(Core::System::sigaction(SIGCHLD, &act, nullptr)); | ||||
| 
 | ||||
|     auto wm_config = Core::ConfigFile::open("/etc/WindowServer.ini"); | ||||
|     auto theme_name = wm_config->read_entry("Theme", "Name", "Default"); | ||||
|  | @ -48,7 +48,7 @@ ErrorOr<int> serenity_main(Main::Arguments) | |||
| 
 | ||||
|     WindowServer::EventLoop loop; | ||||
| 
 | ||||
|     TRY(System::pledge("stdio video thread sendfd recvfd accept rpath wpath cpath proc", nullptr)); | ||||
|     TRY(Core::System::pledge("stdio video thread sendfd recvfd accept rpath wpath cpath proc", nullptr)); | ||||
| 
 | ||||
|     // First check which screens are explicitly configured
 | ||||
|     { | ||||
|  | @ -114,13 +114,13 @@ ErrorOr<int> serenity_main(Main::Arguments) | |||
|     auto am = WindowServer::AppletManager::construct(); | ||||
|     auto mm = WindowServer::MenuManager::construct(); | ||||
| 
 | ||||
|     TRY(System::unveil("/tmp", "")); | ||||
|     TRY(Core::System::unveil("/tmp", "")); | ||||
| 
 | ||||
|     // NOTE: Because we dynamically need to be able to open new /dev/fb*
 | ||||
|     // devices we can't really unveil all of /dev unless we have some
 | ||||
|     // other mechanism that can hand us file descriptors for these.
 | ||||
| 
 | ||||
|     TRY(System::unveil(nullptr, nullptr)); | ||||
|     TRY(Core::System::unveil(nullptr, nullptr)); | ||||
| 
 | ||||
|     dbgln("Entering WindowServer main loop"); | ||||
|     loop.exec(); | ||||
|  |  | |||
|  | @ -7,8 +7,8 @@ | |||
| #include <AK/StringUtils.h> | ||||
| #include <LibCore/Account.h> | ||||
| #include <LibCore/ArgsParser.h> | ||||
| #include <LibCore/System.h> | ||||
| #include <LibMain/Main.h> | ||||
| #include <LibSystem/Wrappers.h> | ||||
| #include <alloca.h> | ||||
| #include <grp.h> | ||||
| #include <pwd.h> | ||||
|  | @ -25,10 +25,10 @@ static String user_str; | |||
| 
 | ||||
| ErrorOr<int> serenity_main(Main::Arguments arguments) | ||||
| { | ||||
|     TRY(System::unveil("/etc/passwd", "r")); | ||||
|     TRY(System::unveil("/etc/group", "r")); | ||||
|     TRY(System::unveil(nullptr, nullptr)); | ||||
|     TRY(System::pledge("stdio rpath", nullptr)); | ||||
|     TRY(Core::System::unveil("/etc/passwd", "r")); | ||||
|     TRY(Core::System::unveil("/etc/group", "r")); | ||||
|     TRY(Core::System::unveil(nullptr, nullptr)); | ||||
|     TRY(Core::System::pledge("stdio rpath", nullptr)); | ||||
| 
 | ||||
|     Core::ArgsParser args_parser; | ||||
|     args_parser.add_option(flag_print_uid, "Print UID", nullptr, 'u'); | ||||
|  |  | |||
|  | @ -13,6 +13,7 @@ | |||
| #include <LibCore/ArgsParser.h> | ||||
| #include <LibCore/File.h> | ||||
| #include <LibCore/StandardPaths.h> | ||||
| #include <LibCore/System.h> | ||||
| #include <LibJS/AST.h> | ||||
| #include <LibJS/Bytecode/BasicBlock.h> | ||||
| #include <LibJS/Bytecode/Generator.h> | ||||
|  | @ -61,7 +62,6 @@ | |||
| #include <LibJS/Runtime/Value.h> | ||||
| #include <LibLine/Editor.h> | ||||
| #include <LibMain/Main.h> | ||||
| #include <LibSystem/Wrappers.h> | ||||
| #include <fcntl.h> | ||||
| #include <signal.h> | ||||
| #include <stdio.h> | ||||
|  | @ -1107,7 +1107,7 @@ public: | |||
| ErrorOr<int> serenity_main(Main::Arguments arguments) | ||||
| { | ||||
| #ifdef __serenity__ | ||||
|     TRY(System::pledge("stdio rpath wpath cpath tty sigaction", nullptr)); | ||||
|     TRY(Core::System::pledge("stdio rpath wpath cpath tty sigaction", nullptr)); | ||||
| #endif | ||||
| 
 | ||||
|     bool gc_on_every_allocation = false; | ||||
|  |  | |||
|  | @ -6,12 +6,12 @@ | |||
| 
 | ||||
| #include <AK/JsonObject.h> | ||||
| #include <LibCore/File.h> | ||||
| #include <LibCore/System.h> | ||||
| #include <LibMain/Main.h> | ||||
| #include <LibSystem/Wrappers.h> | ||||
| 
 | ||||
| ErrorOr<int> serenity_main(Main::Arguments) | ||||
| { | ||||
|     TRY(System::pledge("stdio rpath", nullptr)); | ||||
|     TRY(Core::System::pledge("stdio rpath", nullptr)); | ||||
|     auto file = TRY(Core::File::open("/proc/cpuinfo", Core::OpenMode::ReadOnly)); | ||||
| 
 | ||||
|     auto buffer = file->read_all(); | ||||
|  |  | |||
|  | @ -9,20 +9,20 @@ | |||
| #include <LibCore/DateTime.h> | ||||
| #include <LibCore/File.h> | ||||
| #include <LibCore/ProcessStatisticsReader.h> | ||||
| #include <LibCore/System.h> | ||||
| #include <LibMain/Main.h> | ||||
| #include <LibSystem/Wrappers.h> | ||||
| #include <pwd.h> | ||||
| #include <sys/stat.h> | ||||
| #include <time.h> | ||||
| 
 | ||||
| ErrorOr<int> serenity_main(Main::Arguments) | ||||
| { | ||||
|     TRY(System::pledge("stdio rpath", nullptr)); | ||||
|     TRY(System::unveil("/dev", "r")); | ||||
|     TRY(System::unveil("/etc/passwd", "r")); | ||||
|     TRY(System::unveil("/var/run/utmp", "r")); | ||||
|     TRY(System::unveil("/proc", "r")); | ||||
|     TRY(System::unveil(nullptr, nullptr)); | ||||
|     TRY(Core::System::pledge("stdio rpath", nullptr)); | ||||
|     TRY(Core::System::unveil("/dev", "r")); | ||||
|     TRY(Core::System::unveil("/etc/passwd", "r")); | ||||
|     TRY(Core::System::unveil("/var/run/utmp", "r")); | ||||
|     TRY(Core::System::unveil("/proc", "r")); | ||||
|     TRY(Core::System::unveil(nullptr, nullptr)); | ||||
| 
 | ||||
|     auto file = TRY(Core::File::open("/var/run/utmp", Core::OpenMode::ReadOnly)); | ||||
|     auto json = TRY(JsonValue::from_string(file->read_all())); | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Andreas Kling
						Andreas Kling