We currently build for ISO C90 with GNU extensions. The GNU
extensions include both library and language features.
Compiling without GNU extensions results in a number of compilation
failures due to use of those library features.
With this, we'll build for ISO C99 with the GNU extensions and
can evaluate what's going on with those library features in the
future.
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.
This doesn't remove or replace the existing build system, but
provides an alternative. It allows for faster builds with proper
incremental builds, as well as using tools such as `clang-tidy`,
which work better when they have a compiler commands 'database'.
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.
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.
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`.
Closesinterlisp/medley#137.
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.
* 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
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.
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.
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.
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.
`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`.
* 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.
There were 2 definitions for `N_GETINUMBER`, one for `I386` and one
for `I386` not being defined. Whether they differed or not in the
past isn't known, but they're identical now, so we don't need
two definitions.
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
* 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.
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`.
Closesinterlisp/medley#121.
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