2023-11-21 22:19:08 +00:00
|
|
|
#include <fcgiapp.h>
|
|
|
|
|
|
|
|
#include <sys/stat.h>
|
|
|
|
#include <sys/types.h>
|
|
|
|
|
2023-11-21 14:24:12 +00:00
|
|
|
#include <iostream>
|
|
|
|
|
2023-11-21 22:19:08 +00:00
|
|
|
#include "server/server.h"
|
|
|
|
|
|
|
|
int main() {
|
|
|
|
const char* socketPath = "/run/pica/pica.sock";
|
|
|
|
int sockfd = FCGX_OpenSocket(socketPath, 1024);
|
|
|
|
if (sockfd < 0) {
|
|
|
|
std::cerr << "Error opening socket" << std::endl;
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (chmod(socketPath, 0770) != 0) {
|
|
|
|
std::cerr << "Couldn't set socket permissions" << std::endl;
|
|
|
|
return 2;
|
|
|
|
}
|
|
|
|
|
|
|
|
FCGX_Init();
|
|
|
|
|
|
|
|
Server server;
|
|
|
|
server.run(sockfd);
|
2023-11-21 14:24:12 +00:00
|
|
|
}
|