summaryrefslogtreecommitdiff
path: root/cprogs
diff options
context:
space:
mode:
authorIan Jackson <ijackson@chiark.greenend.org.uk>2016-03-24 21:46:09 +0000
committerIan Jackson <ijackson@chiark.greenend.org.uk>2016-03-29 19:32:50 +0100
commitc72a0f46e7e39f4106fc9967cd3d233e3c97b504 (patch)
tree430e754b0b9ba6aa7497ef3abc1c471208e8c27f /cprogs
parentffe10fa0391ea0f692854791ec0a91097ded58a4 (diff)
cgi-fcgi-interp: new garbage collection approach, spec
Diffstat (limited to 'cprogs')
-rw-r--r--cprogs/cgi-fcgi-interp.c26
1 files changed, 22 insertions, 4 deletions
diff --git a/cprogs/cgi-fcgi-interp.c b/cprogs/cgi-fcgi-interp.c
index 752db40..bfcfd9a 100644
--- a/cprogs/cgi-fcgi-interp.c
+++ b/cprogs/cgi-fcgi-interp.c
@@ -50,6 +50,14 @@
* speedy, the specified number of servers is started
* right away.) The default is 4.
*
+ * -c<interval>
+ * Stale server check interval, in seconds. The worker
+ * process group will get a SIGTERM when it is no longer
+ * needed to process new requests. Ideally it would continue
+ * to serve any existing requests. The SIGTERM will arrive no
+ * earlier than <interval> after the last request arrived at
+ * the containing webserver. Default is 300.
+ *
* -D
* Debug mode. Do not actually run program. Instead, print
* out what we would do.
@@ -90,10 +98,20 @@
* - check for and maybe create <base>
* - stat and lstat the <script>
* - stat the socket and check its timestamp
- * if it is too old, rename it to g<inum>.<pid> (where
- * <inum> and <pid> are in decimal)
- * and run garbage collection
- * - run cgi-fcgi -connect SOCKET SCRIPT
+ * if it is too old, unlink it
+ * - dup2 stderr, mark no cloexec
+ * - run cgi-fcgi -connect SOCKET \
+ * cgi-fcgi-interp --stage2 <was-stderr> <socket> <interp> <script>
+ *
+ * -E<was-stderr> does this:
+ * - dup2 <was-stderr> to fd 2
+ * - open /dev/null and expect fd 1 (and if not, close it)
+ * - become a new process group
+ * - lstat <socket> to find its inum, mtime
+ * - fork/exec <interp> <script>
+ * - periodically lstat <socket> and
+ * if inum, mtime have changed
+ * kill process group (at second iteration)
*/
#include "common.h"