aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src/sledjchisl/sledjchisl.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/sledjchisl/sledjchisl.c')
-rw-r--r--src/sledjchisl/sledjchisl.c80
1 files changed, 19 insertions, 61 deletions
diff --git a/src/sledjchisl/sledjchisl.c b/src/sledjchisl/sledjchisl.c
index 8aad370..767a894 100644
--- a/src/sledjchisl/sledjchisl.c
+++ b/src/sledjchisl/sledjchisl.c
@@ -484,6 +484,7 @@ char *Tconsole = "SledjChisl";
484char *Tsocket = "opensim-tmux.socket"; 484char *Tsocket = "opensim-tmux.socket";
485char *Ttab = "SC"; 485char *Ttab = "SC";
486char *Tcmd = "tmux -S"; 486char *Tcmd = "tmux -S";
487char *backupIARsim = "Sandbox";
487char *webRoot = "/var/www/html"; 488char *webRoot = "/var/www/html";
488char *URL = "fcgi-bin/sledjchisl.fcgi"; 489char *URL = "fcgi-bin/sledjchisl.fcgi";
489char *ToS = "Be good."; 490char *ToS = "Be good.";
@@ -731,7 +732,7 @@ struct _simList
731{ 732{
732 int len, num; 733 int len, num;
733 char **sims; 734 char **sims;
734 qtreetbl_t *tbl, *byTab; 735 qtreetbl_t *byTab;
735}; 736};
736simList *ourSims = NULL; 737simList *ourSims = NULL;
737 738
@@ -810,7 +811,6 @@ simList *getSims()
810 ourSims = xmalloc(sizeof(simList)); 811 ourSims = xmalloc(sizeof(simList));
811 memset(ourSims, 0, sizeof(simList)); 812 memset(ourSims, 0, sizeof(simList));
812 813
813 ourSims->tbl = qtreetbl(0);
814 ourSims->byTab = qtreetbl(0); 814 ourSims->byTab = qtreetbl(0);
815 new->extra = (long) ourSims; 815 new->extra = (long) ourSims;
816 dirtree_handle_callback(new, filterSims); 816 dirtree_handle_callback(new, filterSims);
@@ -875,7 +875,6 @@ ini->putstr(ini, "INI FILE", name);
875 simd->sizeZ = getIntFromIni(ini, "Region.SizeZ"); 875 simd->sizeZ = getIntFromIni(ini, "Region.SizeZ");
876 simd->tab = name; 876 simd->tab = name;
877 ini->put(ini, "SIM DATA", simd, sizeof(simData)); 877 ini->put(ini, "SIM DATA", simd, sizeof(simData));
878ourSims->tbl->put(ourSims->tbl, sim, ini, sizeof(qlisttbl_t));
879 ourSims->byTab->put(ourSims->byTab, name, ini, sizeof(qlisttbl_t)); 878 ourSims->byTab->put(ourSims->byTab, name, ini, sizeof(qlisttbl_t));
880 879
881 if ((!qfile_exist(newPath))) 880 if ((!qfile_exist(newPath)))
@@ -955,8 +954,8 @@ void freeSimList(simList *sims)
955 954
956 qtreetbl_obj_t obj; 955 qtreetbl_obj_t obj;
957 memset((void*) &obj, 0, sizeof(obj)); // start from the minimum. 956 memset((void*) &obj, 0, sizeof(obj)); // start from the minimum.
958 sims->tbl->lock(sims->tbl); 957 sims->byTab->lock(sims->byTab);
959 while (sims->tbl->getnext(sims->tbl, &obj, false) == true) 958 while (sims->byTab->getnext(sims->byTab, &obj, false) == true)
960 { 959 {
961 char *name = qmemdup(obj.name, obj.namesize); // keep the name 960 char *name = qmemdup(obj.name, obj.namesize); // keep the name
962 size_t namesize = obj.namesize; // for removal argument 961 size_t namesize = obj.namesize; // for removal argument
@@ -983,30 +982,6 @@ void freeSimList(simList *sims)
983 ; 982 ;
984 } 983 }
985 984
986 sims->tbl->remove_by_obj(sims->tbl, obj.name, obj.namesize); // remove
987 obj = sims->tbl->find_nearest(sims->tbl, name, namesize, false); // rewind one step back
988 free(name); // clean up
989 }
990 sims->tbl->unlock(sims->tbl);
991 sims->tbl->free(sims->tbl);
992
993 memset((void*) &obj, 0, sizeof(obj)); // start from the minimum.
994 sims->byTab->lock(sims->byTab);
995 while (sims->byTab->getnext(sims->byTab, &obj, false) == true)
996 {
997 char *name = qmemdup(obj.name, obj.namesize); // keep the name
998 size_t namesize = obj.namesize; // for removal argument
999 qlisttbl_t *ini = (qlisttbl_t *) obj.data;
1000 if (NULL != ini)
1001 {
1002// TODO - this leaks memory, but it's a bug in qLibc. Send the bug fix upstream.
1003// It either leaks, or frees twice. Pffft
1004// ini->clear(ini);
1005// ini->free(ini);
1006// free(ini);
1007 ;
1008 }
1009
1010 sims->byTab->remove_by_obj(sims->byTab, obj.name, obj.namesize); // remove 985 sims->byTab->remove_by_obj(sims->byTab, obj.name, obj.namesize); // remove
1011 obj = sims->byTab->find_nearest(sims->byTab, name, namesize, false); // rewind one step back 986 obj = sims->byTab->find_nearest(sims->byTab, name, namesize, false); // rewind one step back
1012 free(name); // clean up 987 free(name); // clean up
@@ -4467,42 +4442,24 @@ notWritten:
4467 sysinfo(&info); 4442 sysinfo(&info);
4468 la = info.loads[0]/65536.0; 4443 la = info.loads[0]/65536.0;
4469 4444
4470 for (i = 0; i < ourSims->num; i++) 4445 char *name;
4471 { 4446 simData *simd = ourSims->byTab->get(ourSims->byTab, backupIARsim, NULL, false);
4472 char *sim = ourSims->sims[i], *name;// = getSimName(ourSims->sims[i], &nm, &num);
4473
4474 qlisttbl_t *ini = ourSims->tbl->get(ourSims->tbl, sim, NULL, false);
4475 if (NULL == ini)
4476 {
4477 E("Sim %s not found in ini list!", sim);
4478// name = getSimName(ourSims->sims[i], &nm, &num);
4479 }
4480 else
4481 name = qstrunchar(ini->getstr(ini, "Region.RegionName", false), '"', '"');
4482 4447
4448 if (NULL == simd)
4449 E("Sim %s not found in ini list! Can't create inventory for %s %s", backupIARsim, first, last);
4450 else
4451 name = simd->name;
4483 4452
4453 if (checkSimIsRunning(backupIARsim))
4454 {
4455 char *cmd = xmprintf("%d.%d", simd->window, simd->pane);
4456 char *c = xmprintf("load iar -m %s %s / password /opt/opensim_SC/backups/DefaultMember.IAR", first, last);
4484 4457
4485 if (checkSimIsRunning(sim)) 4458 I("Loading default member IAR for %s %s in sim %s, this might take a couple of minutes.", first, last, name);
4486 {
4487 I("Loading default member IAR for %s %s in sim %s, this might take a couple of minutes.", first, last, name);
4488 char *c = xmprintf("%s %s/%s send-keys -t '%s:%d' 'load iar -m %s %s / password /opt/opensim_SC/backups/DefaultMember.IAR' Enter",
4489 Tcmd, scRun, Tsocket, Tconsole, i + 1, first, last);
4490T(c); 4459T(c);
4491 int r = system(c); 4460 sendTmuxCmd(cmd, c);
4492 if (!WIFEXITED(r)) 4461 free(cmd);
4493 E("tmux load iar command failed!"); 4462 free(c);
4494 else
4495 {
4496// snprintf(toybuf, sizeof(toybuf), "INITIALIZATION COMPLETE FOR %s", name);
4497// waitTmuxText(name, toybuf);
4498// I("%s is done starting up.", name);
4499// la = waitLoadAverage(la, loadAverageInc, simTimeOut);
4500 }
4501 free(c);
4502 free(name);
4503 break;
4504 }
4505 free(name);
4506 } 4463 }
4507 } 4464 }
4508 free(first); 4465 free(first);
@@ -6987,6 +6944,7 @@ jit library is loaded or the JIT compiler will not be activated.
6987 if ((tmp = configs->getstr(configs, "Tconsole", false)) != NULL) {Tconsole = tmp; D("Setting Tconsole = %s", Tconsole);} 6944 if ((tmp = configs->getstr(configs, "Tconsole", false)) != NULL) {Tconsole = tmp; D("Setting Tconsole = %s", Tconsole);}
6988 if ((tmp = configs->getstr(configs, "Tsocket", false)) != NULL) {Tsocket = tmp; D("Setting Tsocket = %s", Tsocket);} 6945 if ((tmp = configs->getstr(configs, "Tsocket", false)) != NULL) {Tsocket = tmp; D("Setting Tsocket = %s", Tsocket);}
6989 if ((tmp = configs->getstr(configs, "Ttab", false)) != NULL) {Ttab = tmp; D("Setting Ttab = %s", Ttab);} 6946 if ((tmp = configs->getstr(configs, "Ttab", false)) != NULL) {Ttab = tmp; D("Setting Ttab = %s", Ttab);}
6947 if ((tmp = configs->getstr(configs, "backupIARsim", false)) != NULL) {backupIARsim = tmp; D("Setting backupIARsim = %s", backupIARsim);}
6990 if ((tmp = configs->getstr(configs, "webRoot", false)) != NULL) {webRoot = tmp; D("Setting webRoot = %s", webRoot);} 6948 if ((tmp = configs->getstr(configs, "webRoot", false)) != NULL) {webRoot = tmp; D("Setting webRoot = %s", webRoot);}
6991 if ((tmp = configs->getstr(configs, "URL", false)) != NULL) {URL = tmp; D("Setting URL = %s", URL);} 6949 if ((tmp = configs->getstr(configs, "URL", false)) != NULL) {URL = tmp; D("Setting URL = %s", URL);}
6992 if ((vd = configs->get (configs, "seshRenew", NULL, false)) != NULL) {seshRenew = (int) *((float *) vd); D("Setting seshRenew = %d", seshRenew);} 6950 if ((vd = configs->get (configs, "seshRenew", NULL, false)) != NULL) {seshRenew = (int) *((float *) vd); D("Setting seshRenew = %d", seshRenew);}