This commit is contained in:
Ren RenJuan 2014-01-17 17:26:02 +00:00
parent 421309132b
commit d67215b119
4 changed files with 14 additions and 11 deletions

Binary file not shown.

View File

@ -31,6 +31,15 @@ using namespace std;
using namespace boost::interprocess; using namespace boost::interprocess;
using namespace std; using namespace std;
//RAII constructor/destructor
struct shm_remove
{
shm_remove() { shared_memory_object::remove("ausreg-cd-global"); }
~shm_remove() { shared_memory_object::remove("ausreg-cd-global"); }
} remover;
shared_memory_object shm(create_only, "ausreg-cd-global", read_write);
void acClientServer() { // AKA "Cliever" void acClientServer() { // AKA "Cliever"
int i,lfp; int i,lfp;
@ -120,14 +129,6 @@ int main(int const argc, const char ** const argv)
cdHasTk = strstr(argv[0],"loadtk") ? true : false; cdHasTk = strstr(argv[0],"loadtk") ? true : false;
cdOrTkValue = cdHasTk ? 'd' : 'D'; // d == EPP Toolkit enabled, D = !d cdOrTkValue = cdHasTk ? 'd' : 'D'; // d == EPP Toolkit enabled, D = !d
//RAII constructor/destructor
struct shm_remove
{
shm_remove() { shared_memory_object::remove("ausreg-cd-global"); }
~shm_remove() { shared_memory_object::remove("ausreg-cd-global"); }
} remover;
shared_memory_object shm(create_only, "ausreg-cd-global", read_write);
shm.truncate(CD_GLOBAL_SIZE); shm.truncate(CD_GLOBAL_SIZE);
mapped_region acCDglobal(shm, read_write); mapped_region acCDglobal(shm, read_write);
memset(acCDglobal.get_address(), 0, acCDglobal.get_size()); memset(acCDglobal.get_address(), 0, acCDglobal.get_size());

View File

@ -12,6 +12,10 @@ int targetHost = 0;
mdDG mdg; mdDG mdg;
using namespace boost::interprocess;
extern shared_memory_object shm;
int is_numeric(const char *p) { int i = strlen(p),j=0; int is_numeric(const char *p) { int i = strlen(p),j=0;
if (*p) { if (*p) {
char c; char c;
@ -237,8 +241,7 @@ void mdCommander::driver() {
thisConfig->terminateRequest = true; thisConfig->terminateRequest = true;
sprintf(work,"kill -9 %d",thisConfig->daemonProcess); sprintf(work,"kill -9 %d",thisConfig->daemonProcess);
system(work); system(work);
sprintf(work,"rm /dev/shm/ausreg-cd-global"); shm.remove("ausreg-cd-global");
system(work);
goto done; goto done;
} }
continue; continue;

View File

@ -26,7 +26,6 @@
#include <map> #include <map>
#include <utility> #include <utility>
#include <map>
#include <string> #include <string>
#include <queue> #include <queue>