From ca7abd890b42e423354d323384adc9a08b718461 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Tue, 29 Mar 2016 19:19:58 +0100 Subject: [PATCH] cgi-fcgi-interp: new garbage collection approach, wip compile --- cprogs/cgi-fcgi-interp.c | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/cprogs/cgi-fcgi-interp.c b/cprogs/cgi-fcgi-interp.c index 8e126a9..35ce536 100644 --- a/cprogs/cgi-fcgi-interp.c +++ b/cprogs/cgi-fcgi-interp.c @@ -138,6 +138,8 @@ #include #include #include +#include +#include #include @@ -428,6 +430,7 @@ static void become_pgrp(void); static void setup_handlers(void); static void spawn_script(void); static void queue_alarm(void); +static void await_something(void); int main(int argc, const char *const *argv) { const char *smashedopt, *us; @@ -536,13 +539,13 @@ int main(int argc, const char *const *argv) { * and the main program has signals blocked except in sigsuspend, so * we don't need to worry about async-signal-safety, or errno. */ -static struct stab baseline_time; +static struct stat baseline_time; static pid_t script_child, stage2_pgrp; static bool out_of_date; static void record_baseline_time(void) { #ifdef st_mtime - int r = clock_gettime(CLOCK_REALTIME, &baselime_time.st_mtim); + int r = clock_gettime(CLOCK_REALTIME, &baseline_time.st_mtim); if (r) err(127,"(stage2) clock_gettime"); #else baseline_time.st_mtime = time(NULL); @@ -616,3 +619,15 @@ static void spawn_script(void) { static void queue_alarm(void) { alarm(check_interval); } + +static void await_something(void) { + int r; + sigset_t mask; + sigemptyset(&mask); + + for (;;) { + r = sigsuspend(&mask); + assert(r==-1); + if (r != EINTR) err(127,"(stage2) sigsuspend"); + } +} -- 2.30.2