Librearia di log

This commit is contained in:
elvis
2022-03-21 01:51:45 +01:00
parent c8a685272f
commit b11640aff0
3 changed files with 228 additions and 6 deletions

View File

@ -54,7 +54,7 @@ static void checkargs(int argc, char* argv[]) {
}
int main(int argc, char *argv[]) {
// TODO read config file
// read config file
checkargs(argc, argv);
ini_t *config = ini_load(argv[1]);
int threadsInPool; CONFGETINT(threadsInPool, config, "threadpool", "quantity", NULL, 10);
@ -64,12 +64,10 @@ int main(int argc, char *argv[]) {
ini_free(config);
sigset_t mask;
sigemptyset(&mask);
sigaddset(&mask, SIGINT);
sigaddset(&mask, SIGQUIT);
sigaddset(&mask, SIGTERM);
sigfillset(&mask);
sigdelset(&mask, SIGPIPE); // tolgo soltanto la sigpipe
if (pthread_sigmask(SIG_BLOCK, &mask, NULL) != 0) {
if (pthread_sigmask(SIG_SETMASK, &mask, NULL) != 0) {
fprintf(stderr, "ERROR setting mask\n");
goto _cleanup;
}
@ -83,6 +81,9 @@ int main(int argc, char *argv[]) {
goto _cleanup;
}
// remove("mysock"); maybe necessary???
printf("File Server ready.");
fflush(stdout);