. Fix compiler warnings on macOS.
. Fix compiler warnings on GCC 12.
. Use performance cores on Apple Silicon. (Enrico Sorichetti)
. Save maxprio/minprio in sysblk so impl() doesn't clobber them. (Tyler Mitchell)
. Handle non-GNU Linuxes properly. (Tyler Mitchell)
. getprotobyname: some Linuxes want "tcp" not "TCP". (Tyler Mitchell)
. Fix for occasional crash on exit. (Tyler Mitchell):
In POSIX, detach_thread() is neither needed nor valid
after a return from join_thread(). When the latter returns,
the thread has exited and its resources are released,
so detach_thread() not only is not needed, but references
deallocated resources. This can be harmless, but not always.
The root cause of the bug was in my incorrect #define of MAX_TOD_UPDATE_USECS in featall.h, which was #defined to 1000000 (one million) instead of 999999, thereby causing the TXF rubato_thread to do a usleep for 1000000 (one million) microseconds, which, being invalid, was causing it to not sleep at all and instead return immediately with an error, causing it to loop continuously without sleeping, consuming all available host CPU due to the timer threads being the highest priority thread in Hercules.
comm3705.c also had a similar bug wherein it was using "min(1000000,delay)" for one of its usleep().
In addition to fixing the previously mentioned bug, I have also introduced a new USLEEP() macro which calls a new "herc_usleep()" function that will report any usleep() error that might occur. (I purposely did not code it to fix (hide) the problem but rather to just report it so that the caller can thus be fixed to not make invalid usleep calls.)
This should close GitHub Issue #589 "Auxiliary threads eating up CPU time" as well as the long running "CPU utilization on Raspberry Pi" thread that took place in the main Hercules group recently.
Compiling Hercules with gcc 10 produces many warnings like this one:
```
CC hao.lo
In file included from /usr/include/ctype.h:97,
from hstdinc.h:117,
from hao.c:17:
hao.c: In function 'hao_message':
hao.c:812:37: warning: array subscript has type 'char' [-Wchar-subscripts]
812 | if (isdigit(p[2]))
| ^
```
Gcc should really present these as compile time errors, since each and every
one represents a potential case of Undefined Behaviour.
I changed (almost) all of these calls, except a few where the parameter was an
int that just came from a getc()-type function.
Fix regression caused by commit 79a0a17354: use the .rc file specified by the '-r' command line argument first (if given), or defined by the HERCULES_RC environment variable if the '-r' command line argument was not specified, but then default to using the "hercules.rc" file in the current directory (if it exists) if neither was specified.
Closes#179: "Presence of hercules.rc not honored, need -r option".
The ENABLE_CONFIG_INCLUDE, ENABLE_SYSTEM_SYMBOLS, ENABLE_BUILTIN_SYMBOLS build options are no longer optional build options. This reduces #if defined() tests and makes the code clearer and easier to maintain. (I doubt anyone actually builds special builds of Hercules without these build options defined anyway.)
1. Due to variable internal delay starting a CPU depending on host load, runtest4's expected test duration should be increased to prevent sporadic failures on non-idle hosts.
2. Doing a "sysclear" to reset the system when a test fails makes it impossible to examine storage to determine why it failed. Change to "stopall" and "sysreset" instead, which doesn't clear storage, making for easier forensic post-mortem analysis.
from one of the five other old PSWs.
This is specified by the interrupt name in the first operand, e.g.,
to continue after an expected program check:
runtest program
The psa member of REGS is made a union to support accessing it
without having to cast the z architecture PSA.
Problem originally reported by Steve Orso <stephen.orso@yahoo.com> as "Backspace File CCW does not reposition HET tapes under certain circumstances" in Hercules-390 group (as well as in the "Re: DOS Samples" thread of the H390-DOSVS group).
This implements daemon mode as it should be.
Still a number of problems (sigsevs), but it is unclear which are due
to this fix and what if due to my environment, so we stash this for now.
Update testing engine to support comparing multiple messages and
if/then/else for 32 bit vs 64 bit systems.
The code to run the .rc script is called only when the .rc file
must exist (specified as -r or environmentor hercules.rc does
exist).
Problem was that any scripts embedded in a .rc script failed without a message.
The aggregate command from a script file is computed incorrectly when
any return code is negative.
tests/README has been gently wordsmithed.
1. Add support for runtest script command arguments.
2. Tweak end of test detection in cpu.c and script.c
3. Split runtest.tst test into runtest0.tst and runtest4.tst
4. Add tests recently added by previous commits to makefile.am and vcproj.
5. Document runtest test script command in readme.
Also gag automatic maxrates.
For the moment, the bitmaps of configured, starting, and waiting CPUs
are displayed on Linux when the last CPU goes into the stopped state
and when a test case times out.
This should resolve the sigp.tst problem that previous commits 5b9b82fb18 and 5b9b82fb18 attempted to resolve but actually didn't.
Note that this also reverts commit db0959cf0a too, which was the beginning of a different attempt to resolve the same problem.
1. New -t command line switch to activate test mode (see hercinst.html).
2. New 'runtest' test script command to replace existing 'wait' command that issues the 'restart' to start the test and then waits for it to complete.
3. Tweak 'is_test_done' function and cpu.c code to address new 'sigp' test needs.
4. Change most existing tests to use new 'runtest' test script command.
5. Enhance Windows "runtest.cmd" batch file to support '/r' repeat option and '-t' test timeout factor value, as well as resetting the system state (specifically, numcpu) between each test. (Needs more work)
6. Tweak redtest.rexx reduction script to work properly with timestamped logfile messages.
A new script-only command called "wait" is introduced that waits for all processors to load a disabled wait PSW before continuing.
Its syntax is identical to the "pause" statement. You specify on your "wait" statement the maximum number of seconds you are willing to wait for all CPUs to enter disabled wait. If the time limit is exceeded the script issues a warning and continues anyway. Otherwise it will continue immediately as soon as all CPUs have entered a disabled wait state. A new 'wait.tst' test verifies proper functionality.
Both the "pause" statement as well as the new "wait" statement are now handled virtually identically by the new logic which also resolves (eliminates) the previous poorly designed 'polling" technique. Canceling a script via the "cscript" command now occurs immediately.
The bug in the the *nix 'runtest' script introduced by commit 87b551b77f is also fixed.
The suspend command, when semaphore.h is available, uses sem_wait to wait for
sem_post when the last active CPU goes into a disabled wait.
When semaphore.h is not available or the semaphore is not initialised,
suspend behaves exactly like pause. Thus, you should specify a wait time.
renamed some flags for consistency
obey casing rules for symbol names ( case sensitive for unix like )
deleted the setenv code
proper stacking of symbols values
some non symbols related mods ( cosmetics ??? )
tested on ...
Yosemite(CLANG), Centos-6(GCC), Centos-7 (CLANG and GCC)
( reinstalling windows XP under VMware takes longer than planned )