summaryrefslogtreecommitdiffstats
path: root/etc/rc.initial.store_config_to_removable_device
diff options
context:
space:
mode:
authorErmal Luçi <eri@pfsense.org>2009-05-08 18:42:37 +0000
committerErmal Luçi <eri@pfsense.org>2009-05-08 18:42:37 +0000
commit0027de0a544438f146cfc94f005fd6f4ba9f94d7 (patch)
tree3f97d22951284c2a7b02563ecdbb0fd126b46f15 /etc/rc.initial.store_config_to_removable_device
parent89e6e210158ca4ca24d2ddbc02ccab72175875a5 (diff)
downloadpfsense-0027de0a544438f146cfc94f005fd6f4ba9f94d7.zip
pfsense-0027de0a544438f146cfc94f005fd6f4ba9f94d7.tar.gz
* Create two new functions lock($subsystem)/unlock() to have more reliable locking using semaphores.
This function can sleep till the resource is free and can help find not well behaving code. * Remove most of the config_lock/config_unlock logics on the whole scripts/pages it is an abuse of this. If any sybsytem wants to lock can do so with its own lock. * Lock the config when doing a filter reload to avoid parallell recursion on this function, since it is not reentrant. This compenstates for the removal of lock aquiring from the scripts/pages. * config_lock/config_unlock are now compate shims that do nothing. They are preserved since packages 'abuse' them too.
Diffstat (limited to 'etc/rc.initial.store_config_to_removable_device')
-rwxr-xr-xetc/rc.initial.store_config_to_removable_device8
1 files changed, 4 insertions, 4 deletions
diff --git a/etc/rc.initial.store_config_to_removable_device b/etc/rc.initial.store_config_to_removable_device
index d729f0c..438e484 100755
--- a/etc/rc.initial.store_config_to_removable_device
+++ b/etc/rc.initial.store_config_to_removable_device
@@ -32,7 +32,7 @@
/* parse the configuration and include all functions used below */
require_once("config.inc");
- require_once("functions.inc");
+ require_once("util.inc");
$fp = fopen('php://stdin', 'r');
@@ -67,7 +67,7 @@
}
echo "\n\nProcessing: ";
- config_lock();
+ $lockkey = lock('config');
echo "moving...";
mwexec("mkdir -p /tmp/mnt/cf/conf/");
mwexec("/bin/mv /cf/conf/config.xml /tmp/mnt/cf/conf/");
@@ -81,9 +81,9 @@
system("/sbin/mount_nullfs /tmp/mnt/cf /cf");
echo "linking...";
mwexec("/bin/rm -rf /var/db/pfi");
- config_unlock();
+ unlock($lockkey);
echo "done.\n";
echo "\nYour configuration has been moved to {$move_config_to_device}\n";
touch("/tmp/config_moved");
fclose($fp);
-?> \ No newline at end of file
+?>
OpenPOWER on IntegriCloud