Add trivial-features
Recommended by Ron, who was kind enough to author the previous two
commits adding support for OpenBSD and Darwin.
This change ensures all impl's supported by trivial-features will also
include the feature flags :DARWIN and :OPENBSD.
Fixes compilation errors on macos
Fixes Grovel FFI issues on OpenBSD
This commit updates the grovel specs so that compilation of the
generated C code on OpenBSD is successful.
Without these changes, there are three errors:
1. The `timespec` structure is defined in <sys/time.h>,
which is not included.
2. The `stat` structure is defined in <sys/stat.h>,
which is not included.
3. The `librt` library is not a separate entity on OpenBSD.
The functionality is instead included in libc.
This commit includes the two header files mentioned above and
conditionally excludes expressions referencing `librt` when on
the OpenBSD platform. This was tested on OpenBSD 7.3 on an amd64
platform.
Remove github mirror buildscript
Add missing st-xtim field members
Change mmap-shm to keyword-based args
I've found #'mmap-shm to be unwieldy, with 6 args that I don't need to
be changing each time. This commit rearranges the param order to begin with shm
and length, followed by the test as 4 sane-default keyword arguments
Create wrapper around fstat()
In some versions of glibc, fstat() doesn't exist as an external symbol,
but rather an inline function around __fxstat(). This change works
around the issue by finding fstat to a wrapper function around fstat().
Add flags param to mmap-shm
This commit parameterizes the *flags* argument to mmap(). Initially
believing only MAP_SHARED makes sense with shm objects, I fixed the
parameter to this value. I now know this is a mistake in practice, and
so created the mmap-flags bitfield type to pass in as an argument.
Shorten shm-file-descriptor to shm-fd
The name was a tad too unwieldy to use in practice.
Expand unit test suite
This commit adds unit tests for shm-stats, chown-shm, truncate-shm, and
delete-shm, and tinkered with a few of the other unit tests to be more
specific with the checks.
This change brings expression coverage up from 36.9% to 62.2%, and
branch coverage from 43.8% to 90.6%.
Quickfix test case trips new type assertion
Polish new API and docs
This commit dots a small handful of examples to the API reference.
**shm-p** is replaced by **open-shm-p**, a new **shm-p** returns true
for both open and closed shm's, and both open and closed shm classes
inherit from a shared **shm** superclass.
Add restarts to shm-open
To emulate the restart features of **open**, **open-shm** is now
equipped to retry opening, retry with a new value, or retry with either
`:if-exists` or `:if-does-not-exist` changed to some alternate value.
Redesign wrapper API to be closer to std file API
This commit renames all functions to be closer to the standard lib file
API (e.g. **shm-unlink** to **delete-shm**, like in **delete-file**). The
error types __shm-does-not-exist__ and __shm-exists__ are explicitly
supported subtypes of `shm-error`. **mmap**-related errors are moved to
__mmap-error__.
I've experimented with using gray streams to turn the shm object into a
stream, but I've felt other libraries will do a much better job at
turning file descriptors into streams (including impl extensions), and I
shouldn't overlap behavior.
Safety features include changing the class of closed shm's to prevent
accidental post-close fd usage.
Split FFI into its own advertised subsystem
A good number of lispers I've talked with express desire for foreign
library wrappers to expose bindings themselves such that, while the
lispy way of doing things is more convenient, they may forego
unnecessary wrapping/unwrapping should they just be passing the raw
value somewhere else.
This commit splits the shm bindings in its own subsystem, so that users
may pull that separately if they do not need any wrapping.
Completely replace cl-autowrap with CFFI and CFFI-grovel
This commit replaces the cl-autowrap autogenerator with its dependency
CFFI, assisted with CFFI-grovel. A autowrapper shouldn't be necessary
with an FFI surface as small as POSIX's shm API.
Signed-off-by: Samuel Hunter <samuel@shunter.xyz>
Add librt.so.1 as a valid foreign library
Signed-off-by: Samuel Hunter <samuel@shunter.xyz>