1
0
mirror of https://github.com/Interlisp/maiko.git synced 2026-01-16 08:15:31 +00:00

353 Commits

Author SHA1 Message Date
Bruce Mitchener
62a8d400ce
Use sig_atomic_t for FP_error when using FP exceptions. (#220)
`sig_atomic_t` is usually `int`, but is the typedef that one
should use for flags written to from a signal handler.
2021-01-13 17:52:53 +00:00
Bruce Mitchener
d3efbc3441
Remove HAS_GETHOSTID. (#218)
This is only true on DOS now. It was previously true on older
unsupported platforms, but they are gone now.
2021-01-12 20:10:21 -08:00
Bruce Mitchener
7145f0d380
Rename NOFORN to MAIKO_ENABLE_FOREIGN_FUNCTION_INTERFACE. (#217)
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.
2021-01-12 20:04:23 -08:00
Bruce Mitchener
7b979dd789
Add maiko/platform.h to detect OS + CPU. (#216)
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.
2021-01-13 03:01:49 +00:00
Bruce Mitchener
414a4ecbbd
Remove #ifdef LINUX max/min definitions. (#215)
These don't appear to be needed.
2021-01-12 17:21:54 -08:00
Bruce Mitchener
19329883d5
Add missing foreigndefs.h, includes to foreign.c. (#214) 2021-01-12 17:14:19 -08:00
Bruce Mitchener
5cb18c0710
Merge hacks.c into foreign.c. (#212)
This code was not really valid ANSI C in the way that it was
used, and it was only used by foreign.c, which is #ifdef'd out.
2021-01-11 22:45:49 -08:00
Bruce Mitchener
ec04803b53
Switch s_char uses to signed char. Remove s_char alias. (#208) 2021-01-11 19:00:33 -08:00
Bruce Mitchener
fa1adadd31
Remove SunOS 4 version of aref_switch. (#205)
When compiling for SunOS4, we would have a macro-ized version
of this function which required a slightly different call-site.

This removes all of that as it isn't used or needed.
2021-01-11 17:11:48 -08:00
Bruce Mitchener
9ba7e78625
MDate: Make time_t, not long. (#206)
MDate, generated into `vdate.c` from `mkvdate.c`, was being
stored as a `long` rather than a `time_t`. This led to some
casts, but also a bit of platform #ifdef'd code.

This makes that go away by storing it as the `time_t` value
that it really is.

Also, update some comments and minor nits.
2021-01-10 18:44:31 -08:00
Bruce Mitchener
2b5f8eae1c
Remove sysatms.h/c (#201)
The C file was empty, and the H file only had unused constants
in it.
2021-01-10 17:23:32 -08:00
Bruce Mitchener
589f7d34a9
Remove an include, make one only for Solaris. (#200)
* unixfork: Remove an include, make one only for Solaris.

* xinit: Only include ioctl on Solaris.
2021-01-10 17:22:23 -08:00
Bruce Mitchener
acc86a4df7
Remove oether.c, oldeether.c. (#199)
These are old files and no longer relevant. Nothing references
them and they're just saved backups of `ether.c` and `ldeether.c`.
2021-01-11 01:01:16 +00:00
Bruce Mitchener
b45e249a08
Remove mention of TRASE. (#197)
This macro no longer exists and one message had it as a typo.
2021-01-09 10:17:03 -08:00
Bruce Mitchener
16c6b8f7c3
Fix typos. (#196) 2021-01-08 21:42:11 -08:00
Bruce Mitchener
0e3d3acd4e
Replace int_timer_on|off with int_(un)block. (#193)
Both were used, but one just called the other, so simplify
the API.
2021-01-08 21:38:54 -08:00
Bruce Mitchener
f3b52564e4
Remove OCR code. (#195)
This is very dated code that assumes there's a `/dev/ocr0`.

I'm not sure what system this was for, but it doesn't appear to
be one that exists currently.

Discussed in interlisp/medley#126.
2021-01-08 21:20:18 -08:00
Bruce Mitchener
2dcdf14334
Migrate to POSIX signals. (#190)
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.
2021-01-09 04:55:39 +00:00
Nick Briggs
c83b4879ab
Fix mismatch between format string and value in uutils.c (#194) 2021-01-07 21:59:07 -08:00
Bruce Mitchener
4e65eb5d9b
Remove old (NEVER) defs for int_timer_on|off. (#191)
These were replaced by other calls that manage more signals
than just the `SIGVTALRM`.
2021-01-07 20:55:20 -08:00
Bruce Mitchener
c83741eb06
ptsname() needs _GNU_SOURCE on glibc. (#192)
glibc needs `_XOPEN_SOURCE` to have a declaration for
`ptsname()`. An easy way to get that without having to
know about particular `_XOPEN_SOURCE` values is to define
`_GNU_SOURCE`.

Closes interlisp/medley#137.
2021-01-07 20:50:15 -08:00
Nick Briggs
69be706a69
Remove redundant #ifndef NOETHER checks (#186)
When the NOETHER checks were simplified, there remained some
redundant #ifndef NOETHER within the #else of an #ifdef NOETHER.
2021-01-07 20:45:03 -08:00
Nick Briggs
ebfa196372
Clean up warnings when compiling with ethernet enabled (#188)
* Clean up warnings when compiling with ethernet enabled

Add a dlpidefs.h header for prototypes of the dlpi.c functions.
Convert from bcopy() to memcpy().
Change some char to u_char as needed.

* Neither ether_addr_equal nor init_uid need to be defined if NOETHER is defined
2021-01-05 23:41:18 -08:00
Nick Briggs
05d062d583
Revert "Don't close a file that hasn't been opened (2)" 2021-01-06 02:35:59 +00:00
Larry Masinter
26dc2e44f5
Merge pull request #170 from blakemcbride/dont-open-unopened-file
Don't close a file that hasn't been opened (2)
2021-01-05 18:34:55 -08:00
Bruce Mitchener
12b431dbd0
Remove I386-only, undefined macro usages: I386Round, I386Reset. (#185)
These macros aren't actually defined anywhere in our code and
aren't used outside of the old support for the Sun I386 hardware.
2021-01-05 10:26:42 -08:00
Bruce Mitchener
cb815c34a1
Remove REGISTER define. (#184)
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.
2021-01-05 10:26:22 -08:00
Bruce Mitchener
5b54a8c4eb
Use const more. (#183) 2021-01-05 10:26:02 -08:00
Nick Briggs
8d6009c3d4
Remove unused variables and cast return type correctly (#181) 2021-01-04 21:11:30 -08:00
Blake McBride
dd4596099c
Pointer math correction (#171)
* Pointer math correction
* Change pointer diff size type to size_t
2021-01-04 19:08:58 -08:00
Nick Briggs
96ab979e7a
Change lisp_string_to_c_string length parameter to be size_t (#179)
The argument passed to the length parameter of lisp_string_to_c_string is
always the sizeof an array, and since it is compared to the Lisp unsigned
length of the Lisp string is more appropriately a size_t than an int.
Likewise for the index into a string.
2021-01-05 01:23:11 +00:00
Nick Briggs
79b7a300a9
Clean up some mixed signedness issues (#175) 2021-01-04 16:50:21 -08:00
Bruce Mitchener
e73e125cbf
uraid: Suppress incompatible pointer type warnings. (#160)
These pointers are pointers into the Lisp memory with a known
layout represented by that struct type.
2021-01-04 16:49:46 -08:00
Bruce Mitchener
226815dbd8
Pass correct sockaddr size to bind. (#178)
We should be passing the size of the `struct sockaddr_un`, not
the length of the path + the size of the path field.

There is another `bind` call in this file that had it right.
2021-01-04 20:26:57 +00:00
Bruce Mitchener
85aa360f2e
Zero buffers before filling for write. (#177)
We were filling in parts of a buffer and writing it, but that
left some parts either uninitialized or with stale data from
the last read.

This clears out the buffer first so that we're not sending junk.
2021-01-04 17:43:08 +00:00
Bruce Mitchener
a481057fbe
Fix unused variable warnings. (#173) 2021-01-03 21:58:16 -08:00
Nick Briggs
9373f4ebbe
Fix warnings for unused variables when NOETHER is defined (#174) 2021-01-03 21:54:53 -08:00
Bruce Mitchener
e63d123c24
Fix misleading indentation. (#172) 2021-01-04 04:13:58 +00:00
Blake McBride
657539bcbf
Correctly terminate execl() (#169) 2021-01-03 10:56:57 -08:00
Bruce Mitchener
ac2bfaa14c
dbgtool: Fix warning from incorrect LispPTR* usage. (#161)
`fnobj_lisp` was being treated as a `LispPTR*` when it was just
a `LispPTR`. This requires fixing up the printfs as well since it
is no longer a void* to treat it as `%p`.
2021-01-03 10:45:15 -08:00
Bruce Mitchener
1d9c9eaa3f
Cleanup typeof.c (#156)
* instanceof: Remove unused local var `type`.

* Remove unused N_OP_dtest.

This isn't used to actually implement the op. That is done via
the `DTEST` macro defined in `inc/inlineC.h` which duplicated
this code with minor differences in how it signals the error.
2021-01-03 10:33:31 -08:00
Bruce Mitchener
907e86c8d9
Fix some unused variable warnings. (#162) 2021-01-03 18:30:04 +00:00
Blake McBride
03c0d429f1 Don't close a file that hasn't been opened 2021-01-03 12:16:02 -06:00
Nick Briggs
c097563730
The error() function may return under exceptional circumstances (#97)
There are a few places where error() was called that in practice would never
be returned from, however since it was coded with the possibility of returning
all call sites must be consistent with that.

	modified:   ../src/car-cdr.c
	modified:   ../src/gchtfind.c
	modified:   ../src/hardrtn.c
2021-01-02 13:36:14 -08:00
Bruce Mitchener
a1e0e750d4
Remove F_SETSIG (#164)
* Remove F_SETSIG call from Linux on X11 display.

Presumably, this was added to be like the `I_SETSIG` call on Solaris.
But it is the only `F_SETSIG` done on Linux and there isn't an
equivalent on the other platforms that we support as it is a GNU
extension.

Also, `F_SETSIG` with an argument of `0`, as here, means to send
the `SIGIO` signal, which is what is done by default.

From the man page:

    F_SETSIG (int)

    Set the signal sent when input or output becomes possible
    to the value given in arg. A value of zero means to send
    the default SIGIO signal. Any other value (including SIGIO)
    is the signal to send instead, and in this case additional
    info is available to the signal handler if installed with
    SA_SIGINFO.

    By using F_SETSIG with a nonzero value, and setting
    SA_SIGINFO for the signal handler (see sigaction(2)),
    extra information about I/O events is passed to the
    handler in a siginfo_t structure. If the si_code field
    indicates the source is SI_SIGIO, the si_fd field gives
    the file descriptor associated with the event. Otherwise,
    there is no indication which file descriptors are
    pending, and you should use the usual mechanisms
    (select(2), poll(2), read(2) with O_NONBLOCK set etc.)
    to determine which file descriptors are available for I/O.

We aren't setting a non-zero value and we aren't establishing signal
handlers via `sigaction` with `SA_SIGINFO` set, so this shouldn't
be doing anything important for us.

* Stop setting _GNU_SOURCE for GNU libc extensions.

We were previously doing this to get access to the
`F_SETSIG` flag for `fcntl`, but this isn't being
used any longer.
2021-01-02 21:21:16 +00:00
Bruce Mitchener
a271917a61 Switch to using POSIX pseudoterminals.
Previously, we were using SysV pseudo-terminals on Solaris and BSD
pseudo-terminals on other Unix platforms. BSD pseudo-terminals have
been deprecated on Linux and are no longer available in some kernel
configurations.

The POSIX API is basically the same as the SysV API, apart from using
`posix_openpt` instead of `open` with `/dev/ptmx`.

Closes interlisp/medley#121.
2021-01-02 12:57:23 +07:00
Larry Masinter
67d6a799db
Merge pull request #158 from Interlisp/unwind-int-unsigned-ptr-confusion
Correct handling of return value of N_OP_unwind()
2021-01-01 14:29:44 -08:00
Nick Briggs
12c5f3231e Correct handling of return value of N_OP_unwind()
The return value of N_OP_unwind is really of type LispPTR *, however it was
declared as UNSIGNED (effectively uintptr_t) so that the ERROR_EXIT macro
could be used to return an error indication (-1, =UINT_MAX). The call site
checked for the error condition with (int)result < 0, not accounting for the
case where a native pointer may have the high-order bit set.

We correct this problem by declaring the return type as LispPTR *,
and expand the ERROR_EXIT macro in place substituting (LispPTR *)(-1)
as the error return value, and at the single call site check for equality
with that same value.

The test case was executing the opcode tester on a Raspberry Pi or
a BeagleBone Black/Debian 10.3 where the non-error result was > 0xB0000000

  	modified:   inc/inlineC.h
        modified:   inc/unwinddefs.h
        modified:   src/unwind.c
2021-01-01 14:08:41 -08:00
Bruce Mitchener
fc3908f19a
Fix typos. (#157) 2021-01-01 08:55:24 -08:00
Bruce Mitchener
b31ac48ed0
timer.c: Clean up / simplify includes. (#155) 2021-01-01 05:01:32 +00:00