summaryrefslogtreecommitdiffstats
path: root/src/etc/inc/util.inc
diff options
context:
space:
mode:
authorRenato Botelho <renato@netgate.com>2016-10-12 15:03:58 -0300
committerRenato Botelho <renato@netgate.com>2016-10-12 15:03:58 -0300
commita5e59e2518f5c5bd4c8ddf6e5f867464432fda82 (patch)
tree03c00b49f0a6ad1cf047821e3f5c0f97795a912f /src/etc/inc/util.inc
parent9f08c2b001cd64031a853f9e8b01c5b15f981e1a (diff)
downloadpfsense-a5e59e2518f5c5bd4c8ddf6e5f867464432fda82.zip
pfsense-a5e59e2518f5c5bd4c8ddf6e5f867464432fda82.tar.gz
Retire refcount functions. They are not used anymore
Diffstat (limited to 'src/etc/inc/util.inc')
-rw-r--r--src/etc/inc/util.inc76
1 files changed, 0 insertions, 76 deletions
diff --git a/src/etc/inc/util.inc b/src/etc/inc/util.inc
index 1497491..265f62f 100644
--- a/src/etc/inc/util.inc
+++ b/src/etc/inc/util.inc
@@ -228,82 +228,6 @@ function send_multiple_events($cmds) {
}
}
-function refcount_init($reference) {
- $shmid = @shmop_open($reference, "c", 0644, 10);
- @shmop_write($shmid, str_pad("0", 10, "\x0", STR_PAD_RIGHT), 0);
- @shmop_close($shmid);
-}
-
-function refcount_reference($reference) {
- /* Take out a lock across the shared memory read, increment, write sequence to make it atomic. */
- $shm_lck = lock("shm{$reference}", LOCK_EX);
- try {
- /* NOTE: A warning is generated when shared memory does not exist */
- $shmid = @shmop_open($reference, "w", 0, 0);
- if (!$shmid) {
- refcount_init($reference);
- $shmid = @shmop_open($reference, "w", 0, 0);
- if (!$shmid) {
- log_error(sprintf(gettext("Could not open shared memory %s"), $reference));
- unlock($shm_lck);
- return;
- }
- }
- $shm_data = @shmop_read($shmid, 0, 10);
- $shm_data = intval($shm_data) + 1;
- @shmop_write($shmid, str_pad($shm_data, 10, "\x0", STR_PAD_RIGHT), 0);
- @shmop_close($shmid);
- unlock($shm_lck);
- } catch (Exception $e) {
- log_error($e->getMessage());
- unlock($shm_lck);
- }
-
- return $shm_data;
-}
-
-function refcount_unreference($reference) {
- /* Take out a lock across the shared memory read, decrement, write sequence to make it atomic. */
- $shm_lck = lock("shm{$reference}", LOCK_EX);
- try {
- $shmid = @shmop_open($reference, "w", 0, 0);
- if (!$shmid) {
- refcount_init($reference);
- log_error(sprintf(gettext("Could not open shared memory %s"), $reference));
- unlock($shm_lck);
- return;
- }
- $shm_data = @shmop_read($shmid, 0, 10);
- $shm_data = intval($shm_data) - 1;
- if ($shm_data < 0) {
- //debug_backtrace();
- log_error(sprintf(gettext("Reference %s is going negative, not doing unreference."), $reference));
- } else {
- @shmop_write($shmid, str_pad($shm_data, 10, "\x0", STR_PAD_RIGHT), 0);
- }
- @shmop_close($shmid);
- unlock($shm_lck);
- } catch (Exception $e) {
- log_error($e->getMessage());
- unlock($shm_lck);
- }
-
- 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(sprintf(gettext("Could not open shared memory for read %s"), $reference));
- return -1;
- }
- $shm_data = @shmop_read($shmid, 0, 10);
- @shmop_close($shmid);
- return $shm_data;
-}
-
function is_module_loaded($module_name) {
$module_name = str_replace(".ko", "", $module_name);
$running = 0;
OpenPOWER on IntegriCloud