chiark
/
gitweb
/
~ian
/
chiark-utils.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
4d949b0
)
cgi-fcgi-interp: new garbage collection approach, wip compile
author
Ian Jackson
<ijackson@chiark.greenend.org.uk>
Tue, 29 Mar 2016 18:19:58 +0000
(19:19 +0100)
committer
Ian Jackson
<ijackson@chiark.greenend.org.uk>
Tue, 29 Mar 2016 18:32:51 +0000
(19:32 +0100)
cprogs/cgi-fcgi-interp.c
patch
|
blob
|
history
diff --git
a/cprogs/cgi-fcgi-interp.c
b/cprogs/cgi-fcgi-interp.c
index 8e126a9a70d5ae041079169f1b92498124184424..35ce536a57e90e49fa836c0698b6a8c45624f925 100644
(file)
--- a/
cprogs/cgi-fcgi-interp.c
+++ b/
cprogs/cgi-fcgi-interp.c
@@
-138,6
+138,8
@@
#include <fcntl.h>
#include <pwd.h>
#include <err.h>
#include <fcntl.h>
#include <pwd.h>
#include <err.h>
+#include <time.h>
+#include <signal.h>
#include <nettle/sha.h>
#include <nettle/sha.h>
@@
-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 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;
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. */
* 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 sta
b
baseline_time;
+static struct sta
t
baseline_time;
static pid_t script_child, stage2_pgrp;
static bool out_of_date;
static void record_baseline_time(void) {
#ifdef st_mtime
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, &baseli
m
e_time.st_mtim);
+ int r = clock_gettime(CLOCK_REALTIME, &baseli
n
e_time.st_mtim);
if (r) err(127,"(stage2) clock_gettime");
#else
baseline_time.st_mtime = time(NULL);
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 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");
+ }
+}