--- freem/src/symtab_bltin.c	2025/03/24 04:13:11	1.6
+++ freem/src/symtab_bltin.c	2025/04/04 12:46:13	1.8
@@ -1,5 +1,5 @@
 /*
- *   $Id: symtab_bltin.c,v 1.6 2025/03/24 04:13:11 snw Exp $
+ *   $Id: symtab_bltin.c,v 1.8 2025/04/04 12:46:13 snw Exp $
  *      FreeM local system table and user-defined special variable table 
  *
  *  
@@ -24,6 +24,12 @@
  *   along with FreeM.  If not, see <https://www.gnu.org/licenses/>.
  *
  *   $Log: symtab_bltin.c,v $
+ *   Revision 1.8  2025/04/04 12:46:13  snw
+ *   Patch Solaris 8 crash and bump version to 0.63.1-rc1
+ *
+ *   Revision 1.7  2025/03/26 15:17:12  snw
+ *   Fall back to global-backed SSVNs when memory-backed globals fail in attempt to fix Tru64
+ *
  *   Revision 1.6  2025/03/24 04:13:11  snw
  *   Replace action macro dat with fra_dat to avoid symbol conflict on OS/2
  *
@@ -55,6 +61,7 @@
 symbol-table calls */
 /* #define DEBUG_SYM  */
 
+short st_use_shm = FALSE;
 short restoring_consts = FALSE;
 int semid_symtab;
 
@@ -114,6 +121,7 @@ void symtab_init (void)
         shm_config->hdr->PSIZE = DEFPSIZE;
         shm_config->hdr->argptr = mbpartition;
         
+     
         fprintf (stderr, "symtab_init:  initializing memory-backed globals\r\n");        
 
         semid_symtab = semget (symtab_sk, 1, 0666 | IPC_CREAT);
@@ -125,6 +133,13 @@ void symtab_init (void)
             fprintf (stderr, "symtab_init:  symbol table semaphore created with semid %d\r\n", semid_symtab);
         }
 
+#if defined(__sun__)
+        fprintf (stderr, "symtab_init:  falling back to global-backed structured system variables\r\n");
+        shm_config->hdr->use_mb_globals = FALSE;
+        return;
+#endif
+
+
         arg.val = 1;
         if (semctl (semid_symtab, 0, SETVAL, arg) == -1) {
             fprintf (stderr, "symtab_init:  failed to initialize symbol table semaphore\r\n");
@@ -137,7 +152,13 @@ void symtab_init (void)
         fprintf (stderr, "symtab_init:  allocating partition for memory-backed globals\r\n");
         
         mbpartition = (char *) shm_alloc ((size_t) PSIZE + 2);
-        NULLPTRCHK(mbpartition,"symtab_init");
+        if (mbpartition != NULL) {
+            shm_config->hdr->use_mb_globals = TRUE;
+        }
+        else {
+            fprintf (stderr, "symtab_init:  falling back to global-backed structured system variables\r\n");
+            shm_config->hdr->use_mb_globals = FALSE;
+        }
 
         shm_config->hdr->partition = mbpartition;
         
@@ -157,6 +178,7 @@ void symtab_init (void)
         
         mbpartition = shm_config->hdr->partition;
 
+        symtab_release_sem ();
     }
    
 }
@@ -207,6 +229,11 @@ void symtab_shm (short action, char *key
     unsigned long stptrs[128];
     register int i;
     char *old_partition = partition;
+
+    if (shm_config->hdr->use_mb_globals == FALSE) {
+        symtab_bltin (action, key, data);
+        return;
+    }
     partition = mbpartition;
 
     writing_mb = TRUE;