file-set-size.lisp 605 B

123456789101112131415161718192021
  1. (in-package :hurd-translator)
  2. (def-fs-interface :file-set-size ((file port)
  3. (size off-t))
  4. (with-lookup protid file
  5. (let* ((node (get-node protid))
  6. (err (file-change-size *translator*
  7. node
  8. (get-user protid)
  9. size)))
  10. (cond
  11. ((eq err t)
  12. (let ((open (open-node protid)))
  13. (when (> (file-offset open) size)
  14. (setf (file-offset open) size)))
  15. t)
  16. ((eq err nil) :not-permitted)
  17. (t err)))))