summaryrefslogtreecommitdiff
path: root/IkiWiki/Wrapper.pm
diff options
context:
space:
mode:
authorintrigeri <intrigeri@boum.org>2008-11-12 01:08:57 +0100
committerintrigeri <intrigeri@boum.org>2008-11-12 01:08:57 +0100
commitb19d0d3d245c7c2b605ac6c972c73c909a941db4 (patch)
tree4e8b120402eae5ebd2387f3c4439da77df8c8b99 /IkiWiki/Wrapper.pm
parentef536f46bdeee120c7a805d92490db5769ed372f (diff)
parent3937e1fb1679ab6ebdf3a00f52187e3581691f3f (diff)
Merge commit 'upstream/po' into prv/po
Diffstat (limited to 'IkiWiki/Wrapper.pm')
-rw-r--r--IkiWiki/Wrapper.pm17
1 files changed, 16 insertions, 1 deletions
diff --git a/IkiWiki/Wrapper.pm b/IkiWiki/Wrapper.pm
index 99237d3b5..7a2d4381a 100644
--- a/IkiWiki/Wrapper.pm
+++ b/IkiWiki/Wrapper.pm
@@ -44,6 +44,7 @@ EOF
}
my $check_commit_hook="";
+ my $pre_exec="";
if ($config{post_commit}) {
# Optimise checking !commit_hook_enabled() ,
# so that ikiwiki does not have to be started if the
@@ -58,7 +59,7 @@ EOF
# the benefit of this optimisation.
$check_commit_hook=<<"EOF";
{
- int fd=open("$config{wikistatedir}/commitlock", O_CREAT | O_RDWR);
+ int fd=open("$config{wikistatedir}/commitlock", O_CREAT | O_RDWR, 0666);
if (fd != -1) {
if (flock(fd, LOCK_SH | LOCK_NB) != 0)
exit(0);
@@ -67,6 +68,19 @@ EOF
}
EOF
}
+ elsif ($config{cgi}) {
+ # Avoid more than one ikiwiki cgi running at a time by
+ # taking a cgi lock. Since ikiwiki uses several MB of
+ # memory, a pile up of processes could cause thrashing
+ # otherwise.
+ $pre_exec=<<"EOF";
+ {
+ int fd=open("$config{wikistatedir}/cgilock", O_CREAT | O_RDWR, 0666);
+ if (fd != -1)
+ flock(fd, LOCK_EX);
+ }
+EOF
+ }
$Data::Dumper::Indent=0; # no newlines
my $configstring=Data::Dumper->Dump([\%config], ['*config']);
@@ -122,6 +136,7 @@ $envsave
exit(1);
}
+$pre_exec
execl("$this", "$this", NULL);
perror("exec $this");
exit(1);