Coverage report: /development/source/library/com/dydra/gitlab/dydra-cgi/ffi/lisp/rdfcache/condition.lisp
| Kind | Covered | All | % |
| expression | 0 | 98 | 0.0 |
| branch | 0 | 0 | nil |
Key
Not instrumented
Conditionalized out
Executed
Not executed
Both branches taken
One branch taken
Neither branch taken
5
(define-condition rdfcache-error (cl:error) ()) ;; @deprecated, use rdfcache:error instead
7
(define-condition error (rdfcache-error) ())
9
(define-condition initialization-error (error) ())
11
(define-condition mismatched-version (initialization-error)
12
((expected :initarg :expected :reader mismatched-version-expected)
13
(actual :initarg :actual :reader mismatched-version-actual))
14
(:report (lambda (condition stream)
15
(format stream "mismatched libspocq version: expected ~A, but loaded ~A"
16
(mismatched-version-expected condition)
17
(mismatched-version-actual condition)))))
19
(define-condition incompatible-version (mismatched-version) ())
21
(define-condition incompatible-abi-version (incompatible-version) ())
23
(define-condition incompatible-abi-structure (incompatible-abi-version)
24
((type :initarg :type :reader incompatible-abi-structure-type))
25
(:report (lambda (condition stream)
26
(format stream "the ~A structure's CFFI size ~A differs from the libspocq size ~A"
27
(incompatible-abi-structure-type condition)
28
(mismatched-version-expected condition)
29
(mismatched-version-actual condition)))))
31
(define-condition missing-feature (initialization-error)
32
((name :initarg :name :reader missing-feature-name))
33
(:report (lambda (condition stream)
34
(format stream "libspocq is missing the required feature ~A"
35
(missing-feature-name condition)))))
37
(define-condition foreign-function-error (error)
38
((function :initarg :function :reader foreign-function-error-function)
39
(code :initarg :code :reader foreign-function-error-code)
40
(message :initarg :message :reader foreign-function-error-message))
41
(:report (lambda (condition stream)
42
(format stream "~A failed with error code ~A: ~A"
43
(foreign-function-error-function condition)
44
(foreign-function-error-code condition)
45
(foreign-function-error-message condition)))))
47
(define-condition unpermitted-operation (foreign-function-error) ()) ;; EPERM (1)
48
(define-condition unknown-pathname (foreign-function-error) ()) ;; ENOENT (2)
49
(define-condition unknown-process (foreign-function-error) ()) ;; ESRCH (3)
50
(define-condition interrupted-system-call (foreign-function-error) ()) ;; EINTR (4)
51
(define-condition input-output-error (foreign-function-error) ()) ;; EIO (5)
52
(define-condition bad-file-descriptor (foreign-function-error) ()) ;; EBADF (9)
53
(define-condition temporarily-unavailable (foreign-function-error) ()) ;; EAGAIN (11)
54
(define-condition insufficient-memory (foreign-function-error) ()) ;; ENOMEM (12)
55
(define-condition disallowed-access (foreign-function-error) ()) ;; EACCES (13)
56
(define-condition bad-address (foreign-function-error) ()) ;; EFAULT (14)
57
(define-condition invalid-argument (foreign-function-error) ()) ;; EINVAL (22)
58
(define-condition insufficient-storage (foreign-function-error) ()) ;; ENOSPC (28)
59
(define-condition read-only-storage (foreign-function-error) ()) ;; EROFS (30)
60
(define-condition broken-pipe (foreign-function-error) ()) ;; EPIPE (32)
61
(define-condition invalid-term (foreign-function-error) ()) ;; EDOM (33)
62
(define-condition unrepresentable-result (foreign-function-error) ()) ;; ERANGE (34)
63
(define-condition detected-deadlock (foreign-function-error) ()) ;; EDEADLK (35)
64
(define-condition unimplemented-function (foreign-function-error) ()) ;; ENOSYS (38)
65
(define-condition protocol-error (foreign-function-error) ()) ;; EPROTO (71)
66
(define-condition illegal-byte-sequence (foreign-function-error) ()) ;; EILSEQ (84)
67
(define-condition insufficient-buffer-space (foreign-function-error) ()) ;; ENOBUFS (105)
68
(define-condition stale-file-handle (foreign-function-error) ()) ;; ESTALE (116)
69
(define-condition exceeded-quota (foreign-function-error) ()) ;; EDQUOT (122)
70
(define-condition expired-key (foreign-function-error) ()) ;; EKEYEXPIRED (127)
71
(define-condition revoked-key (foreign-function-error) ()) ;; EKEYREVOKED (128)
73
(defun mismatched-version (ffi-version lib-version)
74
(cerror "Continue regardless." 'mismatched-version
75
:expected lib-version :actual ffi-version))
77
(defun incompatible-abi-structure (type ffi-size lib-size)
78
(cerror "Continue regardless." 'incompatible-abi-structure
79
:expected lib-size :actual ffi-size :type type))
81
(defun missing-feature (feature-name)
82
(cerror "Continue regardless." 'missing-feature :name feature-name))
84
(defun foreign-function-error (errno function-name &optional message)
85
(declare (type fixnum errno)
86
(type string function-name))
87
(cl:error (find-foreign-function-error-class errno)
88
:function function-name
90
:message (or message (%strerror errno))))
92
(defun find-foreign-function-error-class (errno)
93
(declare (type fixnum errno))
95
(1 'unpermitted-operation)
98
(4 'interrupted-system-call)
99
(5 'input-output-error)
100
(9 'bad-file-descriptor)
101
(11 'temporarily-unavailable)
102
(12 'insufficient-memory)
103
(13 'disallowed-access)
105
(22 'invalid-argument)
106
(28 'insufficient-storage)
107
(30 'read-only-storage)
110
(34 'unrepresentable-result)
111
(35 'detected-deadlock)
112
(38 'unimplemented-function)
114
(84 'illegal-byte-sequence)
115
(105 'insufficient-buffer-space)
116
(116 'stale-file-handle)
117
(122 'exceeded-quota)
120
(t 'foreign-function-error)))