summaryrefslogtreecommitdiffstats
path: root/etc/inc/util.inc
diff options
context:
space:
mode:
authorPhil Davis <phil.davis@world.inf.org>2012-11-15 09:35:07 +0545
committerPhil Davis <phil.davis@world.inf.org>2012-11-15 09:35:07 +0545
commit96cecadbe7aab4b17634cf522fccbae9ba6982ac (patch)
tree1ee459b3a3b2587c937586b0030062af5f4cebb9 /etc/inc/util.inc
parentdbbc7307d17d26df4130beea8bb667fdf6bf086e (diff)
downloadpfsense-96cecadbe7aab4b17634cf522fccbae9ba6982ac.zip
pfsense-96cecadbe7aab4b17634cf522fccbae9ba6982ac.tar.gz
Add refcount_read to util.inc
Add refcount_read so other code can easily find out how many things have the file system mounted.
Diffstat (limited to 'etc/inc/util.inc')
-rw-r--r--etc/inc/util.inc13
1 files changed, 13 insertions, 0 deletions
diff --git a/etc/inc/util.inc b/etc/inc/util.inc
index 94e8553..9961b4b 100644
--- a/etc/inc/util.inc
+++ b/etc/inc/util.inc
@@ -248,6 +248,19 @@ function refcount_unreference($reference) {
return $shm_data;
}
+function refcount_read($reference) {
+ /* This function just reads the current value of the refcount for information. */
+ /* There is no need for locking. */
+ $shmid = @shmop_open($reference, "a", 0, 0);
+ if (!$shmid) {
+ log_error(gettext("Could not open shared memory for read {$reference}"));
+ return -1;
+ }
+ $shm_data = @shmop_read($shmid, 0, 10);
+ @shmop_close($shmid);
+ return $shm_data;
+}
+
function is_module_loaded($module_name) {
$running = `/sbin/kldstat | grep {$module_name} | /usr/bin/grep -v grep | /usr/bin/wc -l`;
if (intval($running) >= 1)
OpenPOWER on IntegriCloud