diff --git a/.gitignore b/.gitignore index de3b1ef..246724e 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,4 @@ html/data/* html/inc/paths.php install/conf.php +html/svc/BU-commander diff --git a/html/lib/sysVcom.php b/html/lib/sysVcom.php index c4e1c2d..f5f7c9d 100644 --- a/html/lib/sysVcom.php +++ b/html/lib/sysVcom.php @@ -16,6 +16,8 @@ $g_procName = 'BU-commander'; //posix_mkfifo( $g_procName, 0644 ); +$g_k_caller = null; +$g_k_reply = null; //max msg length - this fails on Mint-21. Trial and error gives a max size of 8182. //$g_max_chan = file_get_contents('/proc/sys/kernel/msgmnb'); @@ -25,11 +27,35 @@ // larger was not enough but 100 was emough. I mean, go figure ??? $g_max_rcv = $g_max_chan+100; -$g_max_data = $g_max_chan - 2; //we use the first 2 bytes for msg chunks -$g_k_caller = ftok( $g_procName, 'A'); //caller -$g_k_reply = ftok( $g_procName, 'B'); //reply +$g_max_data = $g_max_chan - 2; +function rpc_setGlobals( $name, $value ){ + + + switch( $name ){ + + case 'procName': + global $g_procName; + global $g_k_caller; + global $g_k_reply; + $g_procName = $value; + $g_k_caller = ftok( $g_procName, 'A'); //caller + $g_k_reply = ftok( $g_procName, 'B'); //reply + break; + + case 'max_chan': + global $g_max_chan; + global $g_max_rcv; + global $g_max_data; + $g_max_chan = $value; + $g_max_rcv = $g_max_chan+100; + $g_max_data = $g_max_chan - 2; //we use the first 2 bytes for msg chunks + break; + } + +} + //************************************************************************************************************************ // The following functions all relate to making an RPC. // They use the php serialize() to send objects across the process boundary @@ -55,15 +81,12 @@ // of a function or parameters. // -function clear_IPC( ){ - - global $g_k_caller; - global $g_k_reply; - - $q_caller = msg_get_queue($g_k_caller); +function clear_IPC( $g_procName ){ + + $q_caller = msg_get_queue( ftok( $g_procName, 'A') ); msg_remove_queue($q_caller); - $q_reply = msg_get_queue($g_k_reply); + $q_reply = msg_get_queue( ftok( $g_procName, 'B') ); msg_remove_queue($q_reply); } diff --git a/html/svc/main.php b/html/svc/main.php new file mode 100644 index 0000000..4110dd7 --- /dev/null +++ b/html/svc/main.php @@ -0,0 +1,36 @@ + diff --git a/install/rsync-exclude.txt b/install/rsync-exclude.txt index 075337e..5d03ddf 100644 --- a/install/rsync-exclude.txt +++ b/install/rsync-exclude.txt @@ -1 +1,2 @@ html/inc/.htaccess +html/svc/BU-commander