file-get-storage-info.lisp 1.3 KB

12345678910111213141516171819202122232425262728293031
  1. (in-package :hurd-translator)
  2. (def-fs-interface :file-get-storage-info ((file port)
  3. (ports :pointer)
  4. (ports-type :pointer)
  5. (num-ports :pointer)
  6. (ints :pointer)
  7. (num-ints :pointer)
  8. (offsets :pointer)
  9. (num-offsets :pointer)
  10. (data :pointer)
  11. (data-len :pointer))
  12. (declare (ignore ports ports-type offsets data))
  13. (when (port-exists-p file)
  14. (setf (mem-ref data-len 'msg-type-number) 0
  15. (mem-ref num-offsets 'msg-type-number) 0
  16. (mem-ref num-ports 'msg-type-number) 0)
  17. (unless (plusp (mem-ref num-ints 'msg-type-number))
  18. (setf (mem-ref ints :pointer)
  19. (mmap (null-pointer)
  20. (foreign-type-size 'msg-type-number)
  21. '(:prot-read :prot-write)
  22. '(:map-anon)
  23. 0
  24. 0)))
  25. (setf (mem-ref num-ints 'msg-type-number) 1
  26. (mem-ref (mem-ref ints :pointer) 'file-storage-class)
  27. (storage *translator*))
  28. t))