io-select.lisp 1.3 KB

12345678910111213141516171819202122232425262728293031323334
  1. (in-package :hurd-translator)
  2. ;; XXX: what does :urg mean ?
  3. ;;
  4. (def-io-interface :io-select ((file port)
  5. (type :pointer))
  6. (with-lookup protid file
  7. (block io-select
  8. (let ((node (get-node protid))
  9. (user (get-user protid))
  10. (open (open-node protid))
  11. (select-flags (mem-ref type 'select-type)))
  12. (when (and (not (flag-is-p (flags open) :read))
  13. (flag-is-p select-flags :read))
  14. (return-from io-select :invalid-argument))
  15. (when (and (not (flag-is-p (flags open) :write))
  16. (flag-is-p select-flags :write))
  17. (return-from io-select :invalid-argument))
  18. (let ((ret-flags))
  19. (when (flag-is-p select-flags :read)
  20. (if (block-read *translator*
  21. node
  22. user)
  23. (push :read ret-flags)))
  24. (when (flag-is-p select-flags :write)
  25. (if (block-write *translator*
  26. node
  27. user)
  28. (push :write ret-flags)))
  29. (setf (mem-ref type 'select-type) ret-flags)
  30. t)))))