diff options
author | onefang | 2021-07-30 04:59:58 +1000 |
---|---|---|
committer | onefang | 2021-07-30 04:59:58 +1000 |
commit | a52ad3c704bd345c3aedbd40ad96e1a677f8b05f (patch) | |
tree | 9ff94be8239e3d8e0cc159a131569937e9d84341 /src | |
parent | Add backup_IARsim config variable. (diff) | |
download | opensim-SC-a52ad3c704bd345c3aedbd40ad96e1a677f8b05f.zip opensim-SC-a52ad3c704bd345c3aedbd40ad96e1a677f8b05f.tar.gz opensim-SC-a52ad3c704bd345c3aedbd40ad96e1a677f8b05f.tar.bz2 opensim-SC-a52ad3c704bd345c3aedbd40ad96e1a677f8b05f.tar.xz |
Add comment banners for some major sections of the code.
Diffstat (limited to 'src')
-rw-r--r-- | src/sledjchisl/sledjchisl.c | 44 |
1 files changed, 43 insertions, 1 deletions
diff --git a/src/sledjchisl/sledjchisl.c b/src/sledjchisl/sledjchisl.c index 767a894..e616108 100644 --- a/src/sledjchisl/sledjchisl.c +++ b/src/sledjchisl/sledjchisl.c | |||
@@ -6789,6 +6789,9 @@ static void cleanup(void) | |||
6789 | } | 6789 | } |
6790 | 6790 | ||
6791 | 6791 | ||
6792 | //////////////////////////////////////////////////////////////////////////////////////////////////// | ||
6793 | // Main function. | ||
6794 | //////////////////////////////////////////////////////////////////////////////////////////////////// | ||
6792 | void sledjchisl_main(void) | 6795 | void sledjchisl_main(void) |
6793 | { | 6796 | { |
6794 | char *cmd = *toys.optargs; | 6797 | char *cmd = *toys.optargs; |
@@ -6864,6 +6867,9 @@ void sledjchisl_main(void) | |||
6864 | } | 6867 | } |
6865 | 6868 | ||
6866 | 6869 | ||
6870 | //////////////////////////////////////////////////////////////////////////////////////////////////// | ||
6871 | // Read configuration. | ||
6872 | //////////////////////////////////////////////////////////////////////////////////////////////////// | ||
6867 | /* From http://luajit.org/install.html - | 6873 | /* From http://luajit.org/install.html - |
6868 | To change or extend the list of standard libraries to load, copy | 6874 | To change or extend the list of standard libraries to load, copy |
6869 | src/lib_init.c to your project and modify it accordingly. Make sure the | 6875 | src/lib_init.c to your project and modify it accordingly. Make sure the |
@@ -6955,6 +6961,9 @@ jit library is loaded or the JIT compiler will not be activated. | |||
6955 | if ((tmp = configs->getstr(configs, "webIframers", false)) != NULL) {webIframers = tmp; D("Setting webIframers = %s", webIframers);} | 6961 | if ((tmp = configs->getstr(configs, "webIframers", false)) != NULL) {webIframers = tmp; D("Setting webIframers = %s", webIframers);} |
6956 | 6962 | ||
6957 | 6963 | ||
6964 | //////////////////////////////////////////////////////////////////////////////////////////////////// | ||
6965 | // Sort out directories. | ||
6966 | //////////////////////////////////////////////////////////////////////////////////////////////////// | ||
6958 | // Use a FHS compatible setup - | 6967 | // Use a FHS compatible setup - |
6959 | if (strcmp("/", scRoot) == 0) | 6968 | if (strcmp("/", scRoot) == 0) |
6960 | { | 6969 | { |
@@ -7006,6 +7015,9 @@ jit library is loaded or the JIT compiler will not be activated. | |||
7006 | } | 7015 | } |
7007 | 7016 | ||
7008 | 7017 | ||
7018 | //////////////////////////////////////////////////////////////////////////////////////////////////// | ||
7019 | // Figure out what and where we are. | ||
7020 | //////////////////////////////////////////////////////////////////////////////////////////////////// | ||
7009 | // TODO - still a bit chicken and egg here about the tmux socket and reading configs from scEtc /.sledjChisl.conf.lua | 7021 | // TODO - still a bit chicken and egg here about the tmux socket and reading configs from scEtc /.sledjChisl.conf.lua |
7010 | if (!isWeb) | 7022 | if (!isWeb) |
7011 | { | 7023 | { |
@@ -7071,6 +7083,9 @@ jit library is loaded or the JIT compiler will not be activated. | |||
7071 | } | 7083 | } |
7072 | 7084 | ||
7073 | 7085 | ||
7086 | //////////////////////////////////////////////////////////////////////////////////////////////////// | ||
7087 | // Sort out directories, part 2 | ||
7088 | //////////////////////////////////////////////////////////////////////////////////////////////////// | ||
7074 | // Doing this here coz at this point we should be the correct user. | 7089 | // Doing this here coz at this point we should be the correct user. |
7075 | I("Making directories in %s.", scRoot); | 7090 | I("Making directories in %s.", scRoot); |
7076 | if ((! qfile_exist(scBin)) && (! qfile_mkdir(scBin, S_IRUSR | S_IWUSR | S_IXUSR | S_IRGRP | S_IXGRP, true))) C("Unable to create path %s", scBin); | 7091 | if ((! qfile_exist(scBin)) && (! qfile_mkdir(scBin, S_IRUSR | S_IWUSR | S_IXUSR | S_IRGRP | S_IXGRP, true))) C("Unable to create path %s", scBin); |
@@ -7092,8 +7107,11 @@ jit library is loaded or the JIT compiler will not be activated. | |||
7092 | if ((! qfile_exist(tmp)) && (! qfile_mkdir(tmp, S_IRUSR | S_IWUSR | S_IXUSR | S_IRGRP | S_IXGRP, true))) C("Unable to create path %s", tmp); | 7107 | if ((! qfile_exist(tmp)) && (! qfile_mkdir(tmp, S_IRUSR | S_IWUSR | S_IXUSR | S_IRGRP | S_IXGRP, true))) C("Unable to create path %s", tmp); |
7093 | free(tmp); | 7108 | free(tmp); |
7094 | 7109 | ||
7095 | getSims(); | ||
7096 | 7110 | ||
7111 | //////////////////////////////////////////////////////////////////////////////////////////////////// | ||
7112 | // Other start up stuff. | ||
7113 | //////////////////////////////////////////////////////////////////////////////////////////////////// | ||
7114 | getSims(); | ||
7097 | 7115 | ||
7098 | if (isTmux || isWeb) | 7116 | if (isTmux || isWeb) |
7099 | { | 7117 | { |
@@ -7129,6 +7147,9 @@ jit library is loaded or the JIT compiler will not be activated. | |||
7129 | memset(toybuf, 0, sizeof(toybuf)); | 7147 | memset(toybuf, 0, sizeof(toybuf)); |
7130 | snprintf(toybuf, sizeof(toybuf), "%s/config/config.ini", scRoot); | 7148 | snprintf(toybuf, sizeof(toybuf), "%s/config/config.ini", scRoot); |
7131 | 7149 | ||
7150 | //////////////////////////////////////////////////////////////////////////////////////////////////// | ||
7151 | // Connect to database. | ||
7152 | //////////////////////////////////////////////////////////////////////////////////////////////////// | ||
7132 | // TODO - it looks like OpenSim invented their own half arsed backwards INI file include system. | 7153 | // TODO - it looks like OpenSim invented their own half arsed backwards INI file include system. |
7133 | // I doubt qLibc supports it, like it supports what seems to be the standard include system. | 7154 | // I doubt qLibc supports it, like it supports what seems to be the standard include system. |
7134 | // Not sure if we need to worry about it just yet. | 7155 | // Not sure if we need to worry about it just yet. |
@@ -7197,6 +7218,9 @@ jit library is loaded or the JIT compiler will not be activated. | |||
7197 | } | 7218 | } |
7198 | 7219 | ||
7199 | 7220 | ||
7221 | //////////////////////////////////////////////////////////////////////////////////////////////////// | ||
7222 | // Start of web wrangling section. | ||
7223 | //////////////////////////////////////////////////////////////////////////////////////////////////// | ||
7200 | if (isWeb) | 7224 | if (isWeb) |
7201 | { | 7225 | { |
7202 | char **initialEnv = environ; | 7226 | char **initialEnv = environ; |
@@ -7219,6 +7243,9 @@ jit library is loaded or the JIT compiler will not be activated. | |||
7219 | } | 7243 | } |
7220 | printEnv(environ); | 7244 | printEnv(environ); |
7221 | 7245 | ||
7246 | //////////////////////////////////////////////////////////////////////////////////////////////////// | ||
7247 | // Web processing loop. | ||
7248 | //////////////////////////////////////////////////////////////////////////////////////////////////// | ||
7222 | /* | 7249 | /* |
7223 | ? https://stackoverflow.com/questions/30707792/how-to-disable-buffering-with-apache2-and-mod-proxy-fcgi | 7250 | ? https://stackoverflow.com/questions/30707792/how-to-disable-buffering-with-apache2-and-mod-proxy-fcgi |
7224 | https://z-issue.com/wp/apache-2-4-the-event-mpm-php-via-mod_proxy_fcgi-and-php-fpm-with-vhosts/ | 7251 | https://z-issue.com/wp/apache-2-4-the-event-mpm-php-via-mod_proxy_fcgi-and-php-fpm-with-vhosts/ |
@@ -7570,9 +7597,15 @@ fcgiDone: | |||
7570 | 7597 | ||
7571 | goto finished; | 7598 | goto finished; |
7572 | } | 7599 | } |
7600 | //////////////////////////////////////////////////////////////////////////////////////////////////// | ||
7601 | // End of web wrangling section. | ||
7602 | //////////////////////////////////////////////////////////////////////////////////////////////////// | ||
7573 | 7603 | ||
7574 | 7604 | ||
7575 | 7605 | ||
7606 | //////////////////////////////////////////////////////////////////////////////////////////////////// | ||
7607 | // Start of OpenSim wrangling section. | ||
7608 | //////////////////////////////////////////////////////////////////////////////////////////////////// | ||
7576 | char *target = NULL; | 7609 | char *target = NULL; |
7577 | struct sysinfo info; | 7610 | struct sysinfo info; |
7578 | float la; | 7611 | float la; |
@@ -7607,6 +7640,9 @@ fcgiDone: | |||
7607 | 7640 | ||
7608 | //T("ARGS - %i |%s| |%s|", currentMode, toys.optargs[0], target); | 7641 | //T("ARGS - %i |%s| |%s|", currentMode, toys.optargs[0], target); |
7609 | 7642 | ||
7643 | //////////////////////////////////////////////////////////////////////////////////////////////////// | ||
7644 | // Start ROBUST or join the tmux session. | ||
7645 | //////////////////////////////////////////////////////////////////////////////////////////////////// | ||
7610 | if ((START == currentMode) && !checkSimIsRunning("ROBUST")) | 7646 | if ((START == currentMode) && !checkSimIsRunning("ROBUST")) |
7611 | { | 7647 | { |
7612 | char *d = xmprintf("%s.{right}", Ttab); | 7648 | char *d = xmprintf("%s.{right}", Ttab); |
@@ -7658,6 +7694,9 @@ sims = -- Note these are .shini / tmux tab short names. | |||
7658 | E("Failed to run script: %s", lua_tostring(L, -1)); | 7694 | E("Failed to run script: %s", lua_tostring(L, -1)); |
7659 | else | 7695 | else |
7660 | { | 7696 | { |
7697 | //////////////////////////////////////////////////////////////////////////////////////////////////// | ||
7698 | // Sim wrangling loop. | ||
7699 | //////////////////////////////////////////////////////////////////////////////////////////////////// | ||
7661 | lua_getglobal(L, "sims"); | 7700 | lua_getglobal(L, "sims"); |
7662 | 7701 | ||
7663 | lua_pushnil(L); // lua_next() needs the last key at the top, but we don't start with one. | 7702 | lua_pushnil(L); // lua_next() needs the last key at the top, but we don't start with one. |
@@ -7973,6 +8012,9 @@ nextSim: | |||
7973 | I("Closing all the panes."); | 8012 | I("Closing all the panes."); |
7974 | // TODO - Wait for all the sims to stop, close all the sim panes, even the empty ones. | 8013 | // TODO - Wait for all the sims to stop, close all the sim panes, even the empty ones. |
7975 | } | 8014 | } |
8015 | //////////////////////////////////////////////////////////////////////////////////////////////////// | ||
8016 | // End of OpenSim wrangling section. | ||
8017 | //////////////////////////////////////////////////////////////////////////////////////////////////// | ||
7976 | 8018 | ||
7977 | 8019 | ||
7978 | /* | 8020 | /* |