Guest User

Untitled

a guest
May 24th, 2018
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.32 KB | None | 0 0
  1. (locally (declare (sb-ext:muffle-conditions sb-ext:compiler-note))
  2. (let ((flock (make-instance 'sb-posix:flock
  3. :type sb-posix:f-wrlck
  4. :whence sb-posix:seek-set
  5. :start 0 :len 10))
  6. (pathname "fcntl.flock.1")
  7. kid-status)
  8. (catch 'test
  9. (with-open-file (f pathname :direction :output)
  10. (write-line "1234567890" f)
  11. (assert (zerop (sb-posix:fcntl f sb-posix:f-setlk flock)))
  12. (let ((pid (sb-posix:fork)))
  13. (if (zerop pid)
  14. (progn
  15. (multiple-value-bind (nope error)
  16. (ignore-errors (sb-posix:fcntl f sb-posix:f-setlk flock))
  17. (sb-ext:quit
  18. :unix-status
  19. (cond ((not (null nope)) 1)
  20. ((= (sb-posix:syscall-errno error) sb-posix:eagain)
  21. 42)
  22. (t 86))
  23. :recklessly-p t #| don't delete the file |#)))
  24. (progn
  25. (setf kid-status
  26. (sb-posix:wexitstatus
  27. (nth-value
  28. 1 (sb-posix:waitpid pid 0))))
  29. (throw 'test nil))))))
  30. kid-status))
Add Comment
Please, Sign In to add comment