--- freem/src/symtab_bltin.c 2025/03/09 19:50:47 1.4
+++ freem/src/symtab_bltin.c 2025/03/26 15:17:12 1.7
@@ -1,5 +1,5 @@
/*
- * $Id: symtab_bltin.c,v 1.4 2025/03/09 19:50:47 snw Exp $
+ * $Id: symtab_bltin.c,v 1.7 2025/03/26 15:17:12 snw Exp $
* FreeM local system table and user-defined special variable table
*
*
@@ -24,6 +24,15 @@
* along with FreeM. If not, see .
*
* $Log: symtab_bltin.c,v $
+ * 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
+ *
+ * Revision 1.5 2025/03/24 02:01:41 snw
+ * Work around some OS/2 incompatibilities in symbol table code
+ *
* Revision 1.4 2025/03/09 19:50:47 snw
* Second phase of REUSE compliance and header reformat
*
@@ -49,10 +58,11 @@
symbol-table calls */
/* #define DEBUG_SYM */
+short st_use_shm = FALSE;
short restoring_consts = FALSE;
int semid_symtab;
-#if !defined(__OpenBSD__) && !defined(__APPLE__)
+#if !defined(__OpenBSD__) && !defined(__APPLE__) && !defined(__OS2__)
union semun {
int val; /* Value for SETVAL */
struct semid_ds *buf; /* Buffer for IPC_STAT, IPC_SET */
@@ -131,7 +141,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;
@@ -201,6 +217,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;
@@ -943,7 +964,7 @@ old0: /* entry from getinc */
/* end of set_sym section */
- case dat:
+ case fra_dat:
/* note: we assume EOL