1
0
mirror of https://github.com/Interlisp/maiko.git synced 2026-01-14 23:46:14 +00:00

474 Commits

Author SHA1 Message Date
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
Larry Masinter
995248decf
Merge pull request #187 from Interlisp/revert-170-dont-open-unopened-file
Revert "Don't close a file that hasn't been opened (2)"
2021-01-05 18:56:11 -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
Larry Masinter
29d1740ca6
Update README.md 2021-01-03 16:56:37 -08: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
b549324eb1
Remove inlsparc.h, duplicate of inlnSPARC.h. (#159) 2021-01-03 10:35:42 -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
Bruce Mitchener
4d00e0b2a1
Remove #ifdef I386 def for N_GETINUMBER. (#166)
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.
2021-01-03 09:43:45 -08: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
Larry Masinter
33a67a80e9
Merge pull request #163 from waywardmonkeys/use-posix-pseudoterminals
Switch to using POSIX pseudoterminals.
2021-01-01 23:30:30 -08: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
Bruce Mitchener
848177aa95
The SYSVONLY flag is no longer used or needed. (#153)
Welcome to the world of being mostly POSIX!
2020-12-31 17:13:05 -08:00
Bruce Mitchener
d717946929
Cleanup byteswap.c a bit (#154)
* Remove word_swap_longword.

This was the same as `swapx` and not used except in one place which
now uses `swapx` instead.

* Remove assembly versions of swapx, byte_swap_word, word_swap_page.

`swapx` and `byte_swap_word` were defined as:

```
extern inline const unsigned int swapx (unsigned int word)
{
   asm("roll  $16,%0" : "=g" (word) : "0" (word));
   return(word);
}

extern inline const unsigned short byte_swap_word (unsigned short word)
{
   asm("rolw  $8,%0" : "=r" (word) : "0" (word));

   return(word);
}
```

But the generated code from the C version is:

```
(lldb) disassemble -n swapx
ldex`swapx:
ldex[0x10002e0d0] <+0>:  pushq  %rbp
ldex[0x10002e0d1] <+1>:  movq   %rsp, %rbp
ldex[0x10002e0d4] <+4>:  movl   %edi, %eax
ldex[0x10002e0d6] <+6>:  roll   $0x10, %eax
ldex[0x10002e0d9] <+9>:  popq   %rbp
ldex[0x10002e0da] <+10>: retq

(lldb) disassemble -n byte_swap_word
ldex`byte_swap_word:
ldex[0x10002e0e0] <+0>:  pushq  %rbp
ldex[0x10002e0e1] <+1>:  movq   %rsp, %rbp
ldex[0x10002e0e4] <+4>:  rolw   $0x8, %di
ldex[0x10002e0e8] <+8>:  movzwl %di, %eax
ldex[0x10002e0eb] <+11>: popq   %rbp
ldex[0x10002e0ec] <+12>: retq
```

So we don't really stand to gain by re-enabling this old assembler code.

We would gain from switching to C99 or C11 and improving our
inlining.

* Remove 386 asm version of bit_reverse_region.

This is implemented in C and the code isn't actually set up to
allow using the assembler version.
2020-12-31 10:29:19 -08:00
Bruce Mitchener
ca3f27db1f
Use setsid on all Unix platforms. (#152)
Previously, we used `TIOCNOTTY` on some platforms (FreeBSD, macOS)
and `setsid` on Linux and Solaris. The correct modern way to do
this is to use `setsid` and the BSDs support this, so let's just
do that.
2020-12-31 09:44:36 -08:00
Nick Briggs
d28334bd24
Fix makefile fragment for linux on arm (#147)
* Update comments describing configuration this makefile fragment supports.

* Remove extra compiler options for suggested gcc build

* Remove unnecessary -m32 option for suggested clang build

* switch default compiler from clang to gcc
2020-12-30 22:18:28 -08:00
Bruce Mitchener
0bbdf606b6
Cygwin doesn't have O_ASYNC, so fix compilation. (#151)
It looks like Cygwin doesn't actually support signal-based I/O,
so while this compiles, it won't be correct and will need
addressing in another way.
2020-12-30 21:47:50 -08:00
Bruce Mitchener
a47119f006
killpg is POSIX, so we can rely on it now. (#150)
This removes some usages of the SYSVONLY flag and lets us assume
the existence of `killpg`. It also updates a bit of code to accurately
populate the `pgrp` variable using `tcgetpgrp` rather than an ioctl.
2020-12-30 21:39:42 -08:00
Bruce Mitchener
f1647df8b1
Default to NOETHER, only enable on Solaris. (#149)
* 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.
2020-12-31 01:33:58 +00:00
Bruce Mitchener
6adb79840d
Update fcntl F_SETFL usage. (#144)
This changes from `FASYNC` to `O_ASYNC`, `FNDELAY` to `O_NONBLOCK`,
and `O_NDELAY` to `O_NONBLOCK`. These are the modern names.

`O_NONBLOCK` is part of the POSIX standard. However, `O_ASYNC` is
specific to Linux and BSD. It is not available on Solaris, where
we still need to use `FASYNC`. Also, the behavior of having I/O
trigger a `SIGIO` signal is not in POSIX, since the `SIGIO` signal
is not in POSIX. Instead, it is only the behavior of having `SIGURG`
being signalled for out of band data that is specified.

We also takes this opportunity to collapse some multi-line calls
to get the flags, store it into a temp, and then set them, to
just doing it in one line, skipping the stored temporary value.

We also change one instance of `65535 - FNDELAY` to `~O_NONBLOCK`.

Closes interlisp/medley#85.
2020-12-31 01:28:34 +00:00
Bruce Mitchener
3b1bdd225f
REGISTER is for floats. (#148)
According to `inc/version.h`, `REGISTER` is for floats which may
or may not be able to be in registers due to the `FPTEST` macro
implementation. We shouldn't be using it here for non-float
data.
2020-12-31 00:16:03 +00:00
Bruce Mitchener
7f7952cbad
Remove USETIMEFN define. (#143)
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.
2020-12-30 14:38:58 -08:00
Bruce Mitchener
7a74d6e66f
Control VM config via RELEASE. (#136)
When `RELEASE` is set, then `inc/version.h` configures some
defines appropriately, including `BIGATOMS`, `BIGVM`, and
`NEWCDRCODING`. There's no need to manage it directly on
the compiler command line.
2020-12-30 14:32:31 -08:00
Bruce Mitchener
3eb8d36a49
README: Add discussion of platform support. (#146) 2020-12-30 09:59:22 -08:00
Larry Masinter
c395b816d8
Merge pull request #145 from Interlisp/add-code-of-conduct-1
Create CODE_OF_CONDUCT.md
2020-12-29 15:42:04 -08:00
Larry Masinter
fef8be9f5c
Create CODE_OF_CONDUCT.md
as per Discussion#111
2020-12-29 11:00:24 -08:00
Bruce Mitchener
3e2a2d76ec
fcntl(..., F_SETFL, ...) return value only signals error. (#141)
The return value of `fcntl` when passed `F_SETFL` isn't guaranteed
to return the flags passed in as its return value. It will be `-1`
in the event of an error, but no other value is to be relied upon.

Fortunately, we weren't relying upon the value apart from
occasionally checking for an error.

This is as it is specified in https://pubs.opengroup.org/onlinepubs/7908799/xsh/fcntl.html

Closes interlisp/medley#87.
2020-12-28 17:59:27 -08:00
Bruce Mitchener
01926fc232
NEW_STORAGE is no longer new. (#135)
* 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.
2020-12-28 10:10:43 -08:00
Bruce Mitchener
14402131e7
Reduce number of -Wshorten-64-to-32 warnings. (#138) 2020-12-28 00:19:26 -08:00