Commit b64be67ff0ee6987867f0fa9d7e4f08a41546dc0

Thomas de Grivel 2019-04-05T14:09:27

fix kevent

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
diff --git a/cffi-kqueue.lisp b/cffi-kqueue.lisp
index d5a2f87..1a98df8 100644
--- a/cffi-kqueue.lisp
+++ b/cffi-kqueue.lisp
@@ -65,10 +65,15 @@
   (let* ((sec (floor seconds))
          (nanosec (floor (- seconds sec) 1/1000000000)))
     (declare (type fixnum sec nanosec))
-      (with-foreign-slots ((tv-sec tv-nsec) timespec '(:struct timespec))
+      (with-foreign-slots ((tv-sec tv-nsec) timespec (:struct timespec))
         (setf tv-sec sec tv-nsec nanosec))))
 
 (defun kevent (kq &key changes n-changes events n-events timeout)
+  (setf changes (or changes (null-pointer))
+        n-changes (or n-changes 0)
+        events (or events (null-pointer))
+        n-events (or n-events 0)
+        timeout (or timeout (null-pointer)))
   (let ((n (c-kevent kq changes n-changes events n-events timeout)))
     (declare (type (signed-byte 32) n))
     (when (< n 0)