aboutsummaryrefslogtreecommitdiff
path: root/include/Process.hpp
blob: 072ef585ee6de3a2fd825fc8ca8ef3470d50262c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#pragma once

#include <sys/types.h>
#include <string>

namespace gsr {
    enum class GsrMode {
        Replay,
        Record,
        Stream,
        Unknown
    };

    // Arguments ending with NULL
    bool exec_program_daemonized(const char **args);
    // Arguments ending with NULL. |read_fd| can be NULL
    pid_t exec_program(const char **args, int *read_fd);
    // Arguments ending with NULL. Returns the exit status of the program or -1 on error
    int exec_program_get_stdout(const char **args, std::string &result);
    // Arguments ending with NULL. Returns the exit status of the program or -1 on error.
    // This works the same as |exec_program_get_stdout|, except on flatpak where this runs the program on the
    // host machine with flatpak-spawn --host
    int exec_program_on_host_get_stdout(const char **args, std::string &result);
    pid_t pidof(const char *process_name, pid_t ignore_pid);
}