* Remove useless VersionArray parameter in maintain_version()
The 2nd argument, FileName *varray, is only ever NULL, so
remove it and simplify the code.
* Remove useless and unused VersionArray cache mechanism
* Simplify setting of file times on file close
The futimes(fd, ...) function allows changing the times of a file with
reference to an open file descriptor which allows us to avoid trying to
find a pathname by which utimes(path, ...) would operate on the inode
corresponding to the fd we have just closed.
* Remove unnecessary temporary variable for VersionArray
* In get_version_array() do not mix array and pointer access to VersionArray
* Improve {DSK} device handling of files with many versions
Somewhat dynamically allocate the version array storage, in chunks of
VERSIONARRAYCHUNKLENGTH (currently 200) allowing for up to
VERSIONARRAYMAXLENGTH (currently 2000) entries before reporting an
error. These numbers could be adjusted, or the limit could be removed.
Sorts the version array in descending order of version number to
improve the performance of check_vless_link() which stats every file
in the version array until it finds one linked to the versionless name
(which should be the highest version). Sorting, and tracking the
number of active entries, also allows for future optimization of other
operations that currently walk through the version array.
* futimens() appears more widely available than futimes() - so use it
* Rework caching of version array for files
While enumerating the entries in a directory is relatively fast,
on some systems (macOS) stat() of a file is slow.
While there is not general agreement on the name in the stat structure
of the timespec field for the modification time, POSIX specifies it
as "st_mtim", and it is possible to #define st_mtim to be the
system-specific name in "version.h" (macOS: st_mtimespec).
* FindHighestVersion can make use of sorted order of filename/version cache
Since the list of filename and versions is maintained in descending order
by version number (see get_version_array) the highest version is trivially
located at index 0 of the filename array.
* added support for XNS networking via Dodo-Nethub
* NetHub connection now optional (only if -nh-host is given); released NetHub-related changes to 'ether.c' to the public domain
* Added file using-dodo-networking-with-maiko.md
Documentation for building and using the Dodo-networking addition to Maiko
* Added support for running Maiko unter cygwin/x86_64-x
* Migrate Addr68k/NativeAlignment{2,4} in Nethub code, move timer/async defines to platform.h
* added missing include <netinet/in.h> for FreeBSD
* updated 'compile-flags' with added flags
* splitted ether.c in 3 (_common, _sunos, _nethub)
* reworks/modifications for nbriggs' pull-request review comments
* addintional additions for nbriggs' pull-request review comments
* get the Lisp packet lengths with 'LispInt2CInt'
* renamed variables in dblwordsSwap to indicate it's about double-words
* fixed wrong preprocessor directive unnoticed by clang
* added networking choice option to cmake build, fix to printf warning
- for cmake specify the networking to use with -DMAIKO_NETWORK_TYPE=<type>
- with <type> one of: NONE, SUN_DLPI, SUN_NIT, NETHUB
- e.g.: cmake .. -DMAIKO_NETWORK_TYPE=NETHUB
* integrated improvement to sendPacket() proposed by nbriggs
* integrated fix for SIGBUS on 32-bit big-endian, provided by nbriggs
* MAIKO_ENABLE_ETHERNET should not be unconditionally set on Solaris systems
* Receiving an ethernet packet is an ether interrupt but not an i/o interrupt.
Co-authored-by: dev hawala <devhawala@x.y>
Co-authored-by: Nick Briggs <nicholas.h.briggs@gmail.com>
Remove unused #define PERCENT_OF_SCREEN in MyWindow.h
Move structures for dir.c to dirdefs.h where they are used
Resolve S_CHAR vs S_CHARACTER in favor of S_CHARACTER and cleanup #defines
Fix = vs == bug in FSDEBUG code in dir.c
Eliminate duplicate/unused constant definitions in gcr.c
Declare static internal function bytecmp in mkatom.c
Update many source and include files to include headers for what they use
* Rewrite keyboard and async I/O handling to improve performance and reduce dependency on async I/O signals
Replaces the SIGIO handler, which used to process X events in the interrupt context, with
a stub routine that sets a flag to signal processing is required.
Actual event processing is moved to the main dispatch loop where Lisp periodic interrupts
are handled.
Removes the X connection file descriptor from the set of fds contributing to SIGIO events
and moves the processing of X events to where the Lisp periodic interrupt is handled in
the main dispatch loop. This code is already guarded by a check for XPending() so can
be called regardless of whether any file descriptors are known to be ready.
Actual processing of async I/O events and X events are handled by procedures
process_io_events() and process_Xevents() respectively. For the most part these are
a renaming of getsignaldata() and getXsignaldata().
The Lisp periodic timer (VTALRM) was set to operate with a 25000 us period (40 Hz),
but on modern hardware it is possible to run this timer with a period of 10000 us (100 Hz)
Incidentally, a bug was noted (and fixed) in the X event handling code for motion events:
Mouse motion without any keyboard activity should not add an entry to the keyboard event
ring buffer as these events do not represent a key state change.
Since the ring buffer is of limited size, when it is filled new events are ignored
until the buffered events are processed. This resulted in the loss of a key/mouse button
transition (up or down) if the mouse was moved about "too much" between keyboard events.
A few incidental cleanups were also made:
- KBDEventFlg initialization fixed (wrong semantic type)
- Event_Req renamed to IO_Signalled (more appropriate name)
- int_io_open() sets up process (self) to handle SIGIO generated by O_ASYNC operations
- LOCK_X_EVENTS turned off since X library calls can no longer happen in an interrupt context
* Use of O_ASYNC must depend on the symbol being defined (looking at you, Cygwin)
* Add SA_RESTART flag to sigaction for SIGVTALRM periodic interrupt
* LOCK_X_UPDATE is no longer needed and should not be defined by default for Solaris in version.h
* Address older versions of C compiler which don't have __BYTE_ORDER__
* Checking for __GNUC__ is not sufficient to determine if builtins are available.
* Add makefile fragment for 32-bit PowerPC on Mac OSX build, and ignore the build directories.
* Add comment describing use of __BIG/LITTLE_ENDIAN__ definition
We no longer need to run a separate peephole optimization pass over the
compiler generated or hand-coded assembler for SunOS3 and SunOS4 on 68K or SPARC
We remove the preprocessor symbols and code controlled by them
SUN4_OS4_IL
SUN3_OS3_IL
SUN3_OS4_IL
and SUN3_OS3_OR_OS4_IL
* Use gcc / clang overflow builtins.
This avoids expensive checks for overflow that employ undefined
behavior.
This is a step along the way towards replacing the old hand-written
assembler that did the same thing in terms of using the CPU's
overflow detection.
* Remove unimplemented SPARC asm for multiplication, divide, and remainder.
This wasn't implemented before, and for multiplication, it is now
implemented for gcc and friends using overflow detection.
* Remove USE_INLINE_ARITH.
Now that we have the compiler built-ins for detecting overflow,
we don't need custom assembly for it for each platform.
For now, we keep, but still don't use, the code that do a hot
path through the dispatch loop for some math. This code isn't
actually running or in use, but it is separate from how the
other inline arithmetic was being performed. These are the
`fast_op_*` functions that are implemented in assembler.
UNALIGNED_FETCH_OK shouldn't be set for an entire OS, but
based on the CPU architecture.
Some ARM systems don't allow unaligned reads. x86 and x86_64
do, so update how we configure this.
* Delete code related to NATIVETRAN feature.
This was obsolete work that had been done for generating
native code from the bytecode.
ClosesInterlisp/medley#89.
* Remove unused SaveD6.
Like the renaming of NOFORN, this gets rid of some double
negatives. It also removes some patterns where we had:
```
#ifdef NOETHER
#else
...
#endif
```
and replaces them with:
```
#ifdef MAIKO_ENABLE_ETHERNET
...
#endif
```
This lets us get rid of double-negatives, which are confusing,
and starts a naming scheme that is easier to see when something
is a Maiko flag versus something else.
This also adds a bit to the `-info` output to say which OS and CPU
are being targeted.
This can be used in subsequent commits to drive whether or not
we need `BYTESWAP` and whether or not unaligned memory access
is okay.
We'll be able to remove per-platform defines from all of the
makefiles and cmake.
The NOFORN flag controls foreign function interface code, which
was written using the dld_* APIs which haven't existed in years.
There was a GNU dld that provided this API, but it was withdrawn
in 2006.
If this code is to be re-enabled, it will have to be changed to
use the `dlopen` family of APIs.
* Support building on OpenBSD, x86-64
* Clean up OpenBSD Makefile
* Add OpenBSD to cmake build
* Use clang as CC for OpenBSD
Co-authored-by: Alex Segura <alex@lispm.dev>
This removes SYSVSIGNALS as we're always and only using POSIX
signals now.
Some platform differences have been papered over. We used to
only ignore SIGPIPE when using BSD signals, but we now ignore
it all the time.
While the SIGFPE code will now compile, it hasn't been updated
to work on modern OSes fully yet as it will need to enable
the correct FP exceptions.
As a prerequisite for cleaning up some other include issues, all the
include files in inc/ should have an include guard. All the xxxdefs.h
were created with them, but most older files were not.
This was used to indicate that the value was allowed to live
in a register. Compilers are much better now and can handle
this themselves.
This helps get rid of more platform-specific ifdef-ery.
* Default to NOETHER, only enable on Solaris.
* DOS: NOETHER controlled by inc/version.h
We set NOETHER by default on DOS, so no need for it here in the
build system.
In the past, we didn't use `gettimeofday()` on all non-DOS platforms
because it wasn't available, so we had to fall back to `time()`.
Those days are long gone and we have `gettimeofday()` on all non-DOS
platforms.
This also removes some code that used `times()` when it used `time()`.
This leaves us using `getrusage()` on all non-DOS platforms. This,
much like `gettimeofday()`, is now available everywhere. Not all of
the fields used here are guaranteed by POSIX, but the ones used
here shouldn't be an issue for now.
* Always follow NEW_STORAGE code paths.
This removes the code paths for the pre-NEW_STORAGE code.
* Remove NEW_STORAGE from build system.
The code no longer refers to `NEW_STORAGE`, so we can remove
this from the build system.
This flag was for SunOS 3 and 4 on sun3 hardware (68k).
It enabled some unsafe optimizations via assembler. This hasn't
actually been built since the DOS port (since the header for this
was renamed, but the code in `xc.c` wasn't updated).
The optimizations here made assumptions that were specific to the
68k hardware and register allocation. They aren't likely to be
of much use moving forward, and we've got plenty of safe performance
improvements from the last 30 years of hardware advances.
* Use the real gethostid on Solaris.
Solaris has this, so we might as well use it like we do on other
platforms. This value is used in response to queries from it from
Lisp.
* Improve undefining of HAS_GETHOSTID.
Enable it on Solaris in `inc/version.h`. This file already
disables it on DOS, so no need to do so again in `src/initsout.c`.
This wasn't enabled and the corresponding code wouldn't have
compiled. The `utime()` function is also deprecated in POSIX.
This used to be enabled for HPUX and RISCOS.
We don't want to modify emulation code yet as ISC support included
a number of other things, including some i386 code that isn't used
on other platforms, but is still useful as a reference.
This also removes support for the DEC3100 keyboard, but leaves a
constant behind for it as I'm not sure about re-numbering.
[NBriggs: keyboard type numbers are stored within all sysouts. Do not renumber supported keyboards, do not reuse previously used keyboard numbers]
This removes code related to HP9000, HPTIMERBUG, and HPUX defines.
It leaves KB_HP9000 for now as I'm not sure about renumbering
those constants.
This should not impact any of the core emulation code.
This platform had no emulation-related changes.
Remove code for IRIX40, INDIGO definitions.
In disk code, simplify a chain of #ifdef's around fsync handling.