Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 98739165 authored by Bart Van Assche's avatar Bart Van Assche
Browse files

init: Introduce RequiresConsole()



Prepare for adding more code in the parent process that depends on
whether or not a console is required.

Bug: 213617178
Change-Id: I066ede32fcd4ce09d06be23158f3c1970064a697
Signed-off-by: default avatarBart Van Assche <bvanassche@google.com>
parent c8f34254
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -240,7 +240,7 @@ Result<void> SetProcessAttributes(const ProcessAttributes& attr) {
        }
    }

    if (!attr.console.empty()) {
    if (RequiresConsole(attr)) {
        setsid();
        OpenConsole(attr.console);
    } else {
+5 −0
Original line number Diff line number Diff line
@@ -95,6 +95,11 @@ struct ProcessAttributes {
    int priority;
    bool stdio_to_kmsg;
};

inline bool RequiresConsole(const ProcessAttributes& attr) {
    return !attr.console.empty();
}

Result<void> SetProcessAttributes(const ProcessAttributes& attr);

Result<void> WritePidToFiles(std::vector<std::string>* files);