summaryrefslogtreecommitdiff
path: root/httpd.c
diff options
context:
space:
mode:
authorGravatar Giacomo Tesio2024-12-05 22:53:40 +0100
committerGravatar Giacomo Tesio2024-12-05 22:53:40 +0100
commitbd74ffda5b25cc07e8d559815e027c8dab3b9d73 (patch)
tree00725a5d5f53ed421b923de6fc1892c58815cc16 /httpd.c
parentMakefile: enable static compilation with musl (diff)
parentUpdated RELEASE_NOTES. (diff)
downloadsnac2-bd74ffda5b25cc07e8d559815e027c8dab3b9d73.tar.gz
snac2-bd74ffda5b25cc07e8d559815e027c8dab3b9d73.tar.xz
snac2-bd74ffda5b25cc07e8d559815e027c8dab3b9d73.zip
Merge branch 'master' into build-with-musl
Diffstat (limited to 'httpd.c')
-rw-r--r--httpd.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/httpd.c b/httpd.c
index 1613e1f..81d2f9e 100644
--- a/httpd.c
+++ b/httpd.c
@@ -774,6 +774,7 @@ void httpd(void)
774 xs *sem_name = NULL; 774 xs *sem_name = NULL;
775 xs *shm_name = NULL; 775 xs *shm_name = NULL;
776 sem_t anon_job_sem; 776 sem_t anon_job_sem;
777 xs *pidfile = xs_fmt("%s/server.pid", srv_basedir);
777 778
778 address = xs_dict_get(srv_config, "address"); 779 address = xs_dict_get(srv_config, "address");
779 780
@@ -809,6 +810,17 @@ void httpd(void)
809 srv_log(xs_fmt("httpd%s start %s %s", p_state->use_fcgi ? " (FastCGI)" : "", 810 srv_log(xs_fmt("httpd%s start %s %s", p_state->use_fcgi ? " (FastCGI)" : "",
810 full_address, USER_AGENT)); 811 full_address, USER_AGENT));
811 812
813 {
814 FILE *f;
815
816 if ((f = fopen(pidfile, "w")) != NULL) {
817 fprintf(f, "%d\n", getpid());
818 fclose(f);
819 }
820 else
821 srv_log(xs_fmt("Cannot create %s: %s", pidfile, strerror(errno)));
822 }
823
812 /* show the number of usable file descriptors */ 824 /* show the number of usable file descriptors */
813 struct rlimit r; 825 struct rlimit r;
814 getrlimit(RLIMIT_NOFILE, &r); 826 getrlimit(RLIMIT_NOFILE, &r);
@@ -894,4 +906,6 @@ void httpd(void)
894 srv_log(xs_fmt("httpd%s stop %s (run time: %s)", 906 srv_log(xs_fmt("httpd%s stop %s (run time: %s)",
895 p_state->use_fcgi ? " (FastCGI)" : "", 907 p_state->use_fcgi ? " (FastCGI)" : "",
896 full_address, uptime)); 908 full_address, uptime));
909
910 unlink(pidfile);
897} 911}