dir-mkfile.lisp 1.3 KB

12345678910111213141516171819202122232425262728293031
  1. (in-package :hurd-translator)
  2. (def-fs-interface :dir-mkfile ((dir port)
  3. (flags open-flags)
  4. (mode mode-t)
  5. (new-file port-pointer)
  6. (new-file-type :pointer))
  7. (with-lookup dir-protid dir
  8. (block dir-mkfile
  9. (let* ((node (get-node dir-protid))
  10. (user (get-user dir-protid))
  11. (new-node (create-anonymous-file *translator*
  12. node
  13. user
  14. mode)))
  15. (unless new-node
  16. (return-from dir-mkfile nil))
  17. (let* ((new-user (make-iouser :old user))
  18. (old-open-node (open-node dir-protid))
  19. (new-protid (new-protid
  20. *translator*
  21. new-user
  22. (make-open-node new-node
  23. (only-flags flags +open-create-flags+)
  24. :copy old-open-node))))
  25. (setf (mem-ref new-file 'port) (get-right new-protid)
  26. (mem-ref new-file-type 'msg-type-name) :make-send)
  27. t)))))