mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-01-06 19:19:44 +03:00
SystemServer: Explicitly open /dev/null for services without StdIO
Spawning services with nothing open at all on the standard I/O fds is way too harsh. We now open /dev/null for them instead.
This commit is contained in:
parent
c2b7c43f3c
commit
9bd4bf41fb
Notes:
sideshowbarker
2024-07-19 10:22:44 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/9bd4bf41fb8
@ -18,7 +18,7 @@ describing how to launch and manage this service.
|
||||
|
||||
* `Executable` - an executable to spawn. If no explicit executable is specified, SystemServer assumes `/bin/{service name}` (for example, `/bin/WindowServer` for a service named `WindowServer`).
|
||||
* `Arguments` - a space-separated list of arguments to pass to the service as `argv` (excluding `argv[0]`). By default, SystemServer does not pass any arguments other than `argv[0]`.
|
||||
* `StdIO` - a path to a file to be passed as standard I/O streams to the service. By default, services inherit SystemServer's own standard I/O streams, which are normally set to `/dev/tty0`.
|
||||
* `StdIO` - a path to a file to be passed as standard I/O streams to the service. By default, services run with `/dev/null` for standard I/O.
|
||||
* `Priority` - the scheduling priority to set for the service, either "low", "normal", or "high". The default is "normal".
|
||||
* `KeepAlive` - whether the service should be restarted if it exits or crashes. For lazy services, this means the service will get respawned once a new connection is attempted on their socket after they exit or crash.
|
||||
* `Lazy` - whether the service should only get spawned once a client attempts to connect to their socket.
|
||||
|
@ -190,6 +190,11 @@ void Service::spawn()
|
||||
close(STDIN_FILENO);
|
||||
close(STDOUT_FILENO);
|
||||
close(STDERR_FILENO);
|
||||
|
||||
int fd = open("/dev/null", O_RDWR);
|
||||
ASSERT(fd == STDIN_FILENO);
|
||||
dup2(STDIN_FILENO, STDOUT_FILENO);
|
||||
dup2(STDIN_FILENO, STDERR_FILENO);
|
||||
}
|
||||
|
||||
if (!m_socket_path.is_null()) {
|
||||
|
Loading…
Reference in New Issue
Block a user