~shunter/posix-shm

6e56c45175e6f7f4f52e42fc50ec51aa6ebc8894 — Ron 8 months ago f43e7be v0.0.7
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.
2 files changed, 3 insertions(+), 1 deletions(-)

M ffi/ffi.lisp
M ffi/grovel.lisp
M ffi/ffi.lisp => ffi/ffi.lisp +2 -0
@@ 12,11 12,13 @@
  (:unix (:or "libc.so.6" "libc.so"))
  (:default "libc"))

#-openbsd
(define-foreign-library librt
  (:unix (:or "librt.so.1" "librt.so"))
  (:default "librt"))

(use-foreign-library libc)
#-openbsd
(use-foreign-library librt)

(defcfun "strerror" :string

M ffi/grovel.lisp => ffi/grovel.lisp +1 -1
@@ 4,7 4,7 @@
;;; This work is licensed under the BSD 3-Clause License.
;;; See LICENSE for more details.

(include "sys/mman.h" "fcntl.h" "unistd.h" "string.h" "errno.h")
(include "sys/mman.h" "sys/stat.h" "sys/time.h" "fcntl.h" "unistd.h" "string.h" "errno.h")

(in-package #:xyz.shunter.posix-shm.ffi)