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;
|
|
|
|
}
|
|
|
|
|
2023-11-23 19:57:32 +00:00
|
|
|
if (chmod(socketPath, 0777) != 0) {
|
2023-11-21 22:19:08 +00:00
|
|
|
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
|
|
|
}
|