commit 3b600f7f2c52789075c0ad6f422d76ce020c3228
parent 3c76e21af80b1a9c7799d9401bd93801c62c2602
Author: Tomas Hlavaty <tom@logand.com>
Date: Wed, 13 Apr 2016 22:54:53 +0200
port flock to ccl
Diffstat:
1 file changed, 16 insertions(+), 4 deletions(-)
diff --git a/os.lisp b/os.lisp
@@ -312,8 +312,12 @@
;;(cp "/asdf" "/tmp/a")
(defun %flock (stream op)
- #-sbcl
+ #-(or sbcl ccl)
(error "TODO %flock not ported")
+ #+ccl
+ (#_flock (or (ccl::stream-device stream :output)
+ (ccl::stream-device stream :input))
+ op)
#+sbcl
(let ((fd (sb-c::fd-stream-fd stream)))
(sb-alien:with-alien ((flock (function sb-alien:int
@@ -322,10 +326,18 @@
:extern "flock"))
(values (sb-alien:alien-funcall flock fd op)))))
+(defun %errno ()
+ #-(or sbcl ccl)
+ (error "TODO %errno not ported")
+ #+ccl
+ (ccl::%get-errno)
+ #+sbcl
+ (sb-alien:get-errno))
+
(defun flock (stream operation blockp)
- #-(and linux sbcl)
+ #-linux
(error "TODO flock not ported")
- #+(and linux sbcl)
+ #+linux
(ecase (%flock stream
(logior (if blockp 0 4)
(ecase operation
@@ -334,7 +346,7 @@
(:unlock 8))))
(0 (values))
(-1 (error "flock ~s ~s ~s failed with code ~s"
- stream operation blockp (sb-alien:get-errno)))))
+ stream operation blockp (%errno)))))
(defun using-flock (pathname sharedp if-does-not-exist thunk)
(when (eq :create if-does-not-exist)