summaryrefslogtreecommitdiffhomepage
path: root/plugins/fcgi/fastcgiprocess.h
blob: 4c01609017216f5361b47df0c1f68997f213cc98 (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
26
27
28
29
30
31
32
33
#pragma once

#include <filesystem>
#include <string>

#include <ext/stdio_filebuf.h>
#include <signal.h>
#include <sys/wait.h>
#include <unistd.h>
#include <sys/mman.h>
#include <sys/types.h>

void run_fcgi_app(const std::string& command, const std::string& host, unsigned short port, int arg, char* argv[]);
void run_fcgi_app(const std::string& command, const std::filesystem::path& socket_path, int arg, char* argv[]);

class FastCGIProcess
{
public:
 FastCGIProcess(const std::filesystem::path& exe_path, const std::string& host, unsigned short port);
 FastCGIProcess(const std::filesystem::path& exe_path, const std::filesystem::path& socket_path);
 ~FastCGIProcess();
 bool is_running();

private:
 void start();
 void stop();

 pid_t m_pid{};
 std::string m_command;
 std::string m_host;
 unsigned short m_port{};
 std::filesystem::path m_socket_path;
};