mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 00:37:45 +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
|
@ -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();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue