1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 10:17:35 +00:00

SystemServer: Propagate errors

This patch also includes some changes in the way that the environment
and arguments are passed to `exec`. It was needed to fit the signature
of `Core::System::exec`. That's beneficial though, as we are now doing
`String` manipulation in a fallible environment, so we can propagate
more errors.
This commit is contained in:
Lucas CHOLLET 2023-01-07 18:19:16 -05:00 committed by Andreas Kling
parent cd0b7656fa
commit 81bd91c1c3
3 changed files with 57 additions and 71 deletions

View file

@ -21,8 +21,8 @@ public:
~Service();
bool is_enabled() const;
void activate();
void did_exit(int exit_code);
ErrorOr<void> activate();
ErrorOr<void> did_exit(int exit_code);
static Service* find_by_pid(pid_t);
@ -32,7 +32,7 @@ public:
private:
Service(Core::ConfigFile const&, StringView name);
void spawn(int socket_fd = -1);
ErrorOr<void> spawn(int socket_fd = -1);
ErrorOr<void> determine_account(int fd);
@ -50,7 +50,7 @@ private:
// Path to the executable. By default this is /bin/{m_name}.
DeprecatedString m_executable_path;
// Extra arguments, starting from argv[1], to pass when exec'ing.
Vector<DeprecatedString> m_extra_arguments;
DeprecatedString m_extra_arguments;
// File path to open as stdio fds.
DeprecatedString m_stdio_file_path;
int m_priority { 1 };
@ -71,7 +71,7 @@ private:
// Whether several instances of this service can run at once.
bool m_multi_instance { false };
// Environment variables to pass to the service.
Vector<DeprecatedString> m_environment;
DeprecatedString m_environment;
// Socket descriptors for this service.
Vector<SocketDescriptor> m_sockets;
@ -91,5 +91,5 @@ private:
ErrorOr<void> setup_socket(SocketDescriptor&);
ErrorOr<void> setup_sockets();
void setup_notifier();
void handle_socket_connection();
ErrorOr<void> handle_socket_connection();
};