Prior to this change there was no mechanism within Medley to create a new directory
on a {UNIX} style device. This change makes the {UNIX} directory creation happen in
the same manner that {DSK} directory creation is done. Opening a file with access
OUTPUT, BOTH, or APPEND, which would create the file if it does not exist, will also
create any missing directories in the path.
stat.st_mode cannot be tested for whether a node is S_IFDIR with
if (stat.st_mode & S_IFDIR) ...
since S_IFDIR bit (0040000) is a subset of S_IFSOCK (0140000) bits.
A correct check is
if ((stat.st_mode & S_IFMT) == S_IFDIR) ...
or alternatively, since the convenience macros are defined on all modern systems
if (S_ISDIR(stat.st_mode)) ...
If the argument to DELFILE represents a directory on the {unix} device
either directly or through resolving to a full pathname via the connected
host/directory, and the directory is empty, then the directory will be deleted
and the deleted directory name will be returned. Will error if the
directory is not empty, and return NIL if the argument does not name a directory
or file.
* Adding new workflow that builds maiko releaases for Linux/amd64, Linux/arm64, Linux/arm7, Macos/amd64. (Not Macos/arm64 as yet.) Also builds and pushes to DockerHub docker images for Linux/amd64 and Linux/arm64. Delete old buildDocker.yml workflow.
* Adding latest version of buildReleaseInclDocker.yml; builds release and docker images for all major platforms except MacOs arm64.
* Adding Dockerfile. Was out of sync with final dev version at fghalasz/maiko
* Adding new workflow that builds maiko releaases for Linux/amd64, Linux/arm64, Linux/arm7, Macos/amd64. (Not Macos/arm64 as yet.) Also builds and pushes to DockerHub docker images for Linux/amd64 and Linux/arm64. Delete old buildDocker.yml workflow.
* Adding latest version of buildReleaseInclDocker.yml; builds release and docker images for all major platforms except MacOs arm64.
Since the native addresses for objects within the Lisp memory may be at locations
that can't be represented in 32-bits conversion between a native address and a
Lisp FIXP can't be supported. For now, return NIL for conversion in either direction.
There are no known users of these two subrs. Should it be necessary to reimplement them
at some future time the representation will need to be something that can hold 64 bits.
When Medley closes a stream open to a process it uses a "unixcomm"
command (3) which should close() the communication channel open with
the process and give it a chance to handle that and exit cleanly
before using a SIGKILL on it. We can't determine apriori whether the
process is going to cooperate, so we're stuck trying for up to 0.1s
(arbitrary choice!) waiting for the process to exit, then it gets a
SIGKILL, and we wait up to 0.1s again to see that it really exited.
These routines were stubs that did nothing and were not called from anywhere
so lack value in even providing a template or hook for a fuller implementation.
Also note that "stackcheck" conflicts with a predefined symbol in some runtime
libraries. Should these be implemented in the future they should use a
maiko-specific name.
Add m68k to recognized CPUs (machinetype)
Add amigaos to recognized operating systems (osversion)
Add ability to override "config.guess" output w/ LDEARCH= to osversion
Add platform.h clauses to recognize AmigaOS 3 using gcc to cross-compile
makepathname() is only ever called with one of two constant string
arguments, in one case (DOS) such that it only does a strncpy(...),
and the other case (non-DOS) expanding "~" to the current user's home
directory. Additional code duplicates realpath() functionality but is
never used.
Commit c46fcce307018df6554805050ceb634d72e737c9 fixed a warning for
incompatible pointers to nnewframe() but did not consider that the
order of the DLwords is swapped depending on the endianness of the
system it is running on. Add the necessary GETBASEWORD() macros to
access the items when constructing the pointer.
nnewframe() as called from the EVAL implementation expects to be passed
the address of an array of two DLwords. Do that, and compose the 32-bit
result correctly rather than passing the address of a (32-bit) LispPTR
and then having to swapx() that result to get the expected value.
* Correct warning: cast to smaller integer type -- X_init/lispbitmap
* Fixes to INTRSAFE, INTRSAFE0 and ensure TIMEOUT, TIMEOUT0 used appropriately
INTRSAFE and INTRSAFE0 must clear errno before executing the library or system
call because not all library calls set errno on success.
Avoid casting pointers or larger integer values down to smaller ints before
comparing to 0 or -1, and use NULL (a pointer) rather than 0.
Fix cases where the result of the library call is a pointer rather than an int
to use TIMEOUT0 instead of TIMEOUT, testing for NULL rather than -1
on timeout (errno == EINTR)
* Remove useless validity check of LASTVMEMFILEPAGE_word pointer
* Convert pointer arithmetic type in drawline from int to ptrdiff_t
* Add NOTE warning about a 32-bit vs 64-bit issue affecting currently unused GET_NATIVE_ADDR_FROM_LISP_PTR
No calls to make_atom() depend on the ability to parse the atom's
pname as a number. Additionally, the parse_number() implementation
used here was non-functional.
We remove parse_number() and adjust the parameter list of make_atom()
to remove the non_numericp flag.
As long as $(SHELL) names an executable that appears in /etc/shells (as determined
by the getusershell() function) use that. It used to always use /bin/csh, but some
modern distros do not ship with csh installed. Using the user's preferred shell
seems like a better choice, while allowing the choice from /etc/shells gives some
additional flexibility.
Adds a -noscroll option, parsed as an X option, also accessible via
resource ldex*noscroll, which avoids adding the bottom and side scroll
bars and the bit-gravity control buttons to the main Lisp display window.
Unless the geometry given for the X window in which the Lisp screen is
displayed is at least as big as the Lisp screen part of the Lisp screen
(bottom, right) will not be visible.
On macOS with XQuartz, maximizing the X window will bring it to
the size of the Lisp screen (or the size of the display, whichever is smaller)
cases for subrs UNCOLORIZE-BITMAP, COLORIZE-BITMAP, COLOR-8BPPDRAWLINE (which
are not compiled into current code) can have the numbers replaced by the
symbolic constants that are now defined in subrs.h
* Fix some warnings in main.c
main.c:678: narrowing conversion from 'unsigned long' to signed type 'int' is implementation-defined
main.c:493: The return value from the call to 'seteuid' is not checked.
* Fix some warnings in array operations
Instead of extracting typenumbers to an 'int', use the unsigned typenumber directly
array3.c:49: narrowing conversion from 'unsigned int' to signed type 'int' is implementation-defined
array4.c:61: narrowing conversion from 'unsigned int' to signed type 'int' is implementation-defined
array5.c:63: narrowing conversion from 'unsigned int' to signed type 'int' is implementation-defined
array6.c:50: narrowing conversion from 'unsigned int' to signed type 'int' is implementation-defined
* Resolve type mismatches for version numbers and propp flag
dir.c:1849: narrowing conversion from 'unsigned int' to signed type 'int'
dir.c:1850: narrowing conversion from 'unsigned int' to signed type 'int'
dir.c:2114: narrowing conversion from 'unsigned long' to signed type 'int'
dir.c:2207: narrowing conversion from 'unsigned int' to signed type 'int'
* Resolve type mismatches for version numbers and strlen result type
dsk.c:1072: narrowing conversion from 'unsigned long' to signed type 'int'
dsk.c:1108: narrowing conversion from 'unsigned long' to signed type 'int'
dsk.c:1549: narrowing conversion from 'unsigned long' to signed type 'int'
dsk.c:1712: narrowing conversion from 'unsigned long' to signed type 'int'
dsk.c:1751: narrowing conversion from 'unsigned long' to signed type 'int'
dsk.c:3426: narrowing conversion from 'unsigned int' to signed type 'int'
* Resolve type mismatches for strlen result type
ufs.c:213: narrowing conversion from 'unsigned long' to signed type 'int'
ufs.c:404: narrowing conversion from 'unsigned long' to signed type 'int'
* Resolve type error
uutils.c:117: 'signed char' to 'int' conversion [bugprone-signed-char-misuse,cert-str34-c]
* Add experimental SUBR to call nanosleep() for experiments in reducing CPU load
This adds a SUBR, sb_YIELD, value (octal) 0322 which takes a single number
0..999999999 which is the number of nanoseconds to pass to nanosleep().
The return value is T if the call to nanosleep() was executed or NIL
if it was not (argument out-of-range, or other error in getting the
number from the argument).
To use this experimental SUBR in a sysout you should:
(SETQ \INITSUBRS (CONS '(YIELD #o322) \INITSUBRS))
then you can define functions that use that SUBR:
(DEFINEQ (BACKGROUND-YIELD () (SUBRCALL YIELD 833333)))
(COMPILE 'BACKGROUND-YIELD)
(SETQ BACKGROUNDFNS (CONS 'BACKGROUND-YIELD BACKGROUNDFNS))
* Update to use subrs.h newly generated from LLSUBRS
The subrs.h include file is generated by WRITECALLSUBRS based on the \INITSUBRS
list. This update provides for the new YIELD subr in the generated file,
and makes some necessary updates to the C code implementations for some subr
names which have changed.
There is no reason to use sscanf() rather than strtol()/strtoul()
for parsing simple integer values from a string.
Resolves a number of cert-str34-c warnings from clang-tidy.
Until these are superceded by github actions, if the github CLI tool "gh"
is installed, a github release of the maiko code can be created by running
./start-release
from the maiko/bin directory, and then running
./release-one
for each combination of OS/architecture that should be included in the
release.
The scripts assume that the maiko code is checked out in a directory
named "maiko" (and may produce unexpected results if run from somewhere else)
Co-authored-by: Nick Briggs <nicholas.h.briggs@gmail.com>
As a side-effect of this change, we also resolve a a problem with
signed file version numbers, so that instead of version 2147483647
wrapping to -2147483648 we can go as far as 4294967296 before we
have issues. Various sprintf() formats get changed from %d to %u.
The DOS version code is left behind as int versions.
The only uses of bzero() in the maiko sources come about because it is used in the macOS
definition of the FD_ZERO() macro in sys/select.h. Suppress the warning by including
-clang-analyzer-security.insecureAPI.bzero
in the clang-tidy list of checks. This may well have been replaced by a memset()
call in more up-to-date macOS releases.
* 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
* Lock X updates for all systems and lock around X cleanup at exit
All systems which could generate I/O interrupts on the X file descriptor need
to have locking enabled, or there is a high probability that the X library
will deadlock. This requirement may be removed in the future with restructuring
of the way that the interrupt driven I/O is handled.
Ensure that the appropriate XLOCK/XUNLOCK is done around the X window
closing code.
* Also lock X updates when building with CMake.