select.lisp 555 B

1234567891011121314151617181920
  1. (in-package :hurd)
  2. (defcfun ("io_select" %io-select)
  3. err
  4. (file port)
  5. (reply port)
  6. (timeout :unsigned-int)
  7. (select-type :pointer))
  8. (defun io-select (file &key type reply (timeout 0))
  9. "Returns the available read/write operations to 'file' given a specific timeout."
  10. (declare (type fixnum file timeout)
  11. (type list type))
  12. (with-foreign-pointer (ptr (foreign-type-size 'select-type))
  13. (setf (mem-ref ptr 'select-type) type)
  14. (select-error (%io-select file reply timeout ptr)
  15. (mem-ref ptr 'select-type))))