aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOmar Polo <op@omarpolo.com>2022-09-10 13:28:19 +0000
committerOmar Polo <op@omarpolo.com>2022-09-10 13:28:19 +0000
commit5c4855299cc05b533c3b5229e864654f59fe69ea (patch)
tree7bd71c6e16d7dd39d87e8e9c9f5d3c2381301ffe
parentd040746a37a2af87b1b4ffe746e2f3b9231576f1 (diff)
remove remnats tentacles of the executor process
-rw-r--r--gmid.c14
-rw-r--r--gmid.h2
2 files changed, 10 insertions, 6 deletions
diff --git a/gmid.c b/gmid.c
index e092bb2..788398d 100644
--- a/gmid.c
+++ b/gmid.c
@@ -41,7 +41,7 @@ struct vhosthead hosts;
int sock4, sock6;
-struct imsgbuf logibuf, exibuf, servibuf[PROC_MAX];
+struct imsgbuf logibuf, servibuf[PROC_MAX];
const char *config_path = "/etc/gmid.conf";
const char *pidfile;
@@ -390,9 +390,9 @@ serve(void)
fatal("fork: %s", strerror(errno));
case 0: /* child */
close(p[0]);
- imsg_init(&exibuf, p[1]);
+ imsg_init(&servibuf[i], p[1]);
setproctitle("server");
- _exit(listener_main(&exibuf));
+ _exit(listener_main(&servibuf[i]));
default:
close(p[1]);
imsg_init(&servibuf[i], p[0]);
@@ -561,11 +561,15 @@ main(int argc, char **argv)
sock6 = make_socket(conf.port, AF_INET6);
}
- imsg_compose(&exibuf, IMSG_QUIT, 0, 0, -1, NULL, 0);
- imsg_flush(&exibuf);
+ for (i = 0; i < conf.prefork; ++i) {
+ imsg_compose(&servibuf[i], IMSG_QUIT, 0, 0, -1, NULL, 0);
+ imsg_flush(&servibuf[i]);
+ close(servibuf[i].fd);
+ }
imsg_compose(&logibuf, IMSG_QUIT, 0, 0, -1, NULL, 0);
imsg_flush(&logibuf);
+ close(logibuf.fd);
if (pidfd != -1)
close(pidfd);
diff --git a/gmid.h b/gmid.h
index 7ffc941..7595d3f 100644
--- a/gmid.h
+++ b/gmid.h
@@ -205,7 +205,7 @@ struct conf {
extern const char *config_path;
extern struct conf conf;
-extern struct imsgbuf logibuf, exibuf, servibuf[PROC_MAX];
+extern struct imsgbuf logibuf, servibuf[PROC_MAX];
extern int servpipes[PROC_MAX];