port-destruction.scm 1008 B

1234567891011121314151617181920212223242526272829303132
  1. (define-module (mach port-destruction)
  2. #:use-module (mach ffi)
  3. #:use-module (mach types)
  4. #:use-module (mach task))
  5. ;;
  6. ;; This file implements all the port destruction functions.
  7. ;;
  8. (define-ffi ("mach_port_deallocate" %mach-port-deallocate!)
  9. (err identity) ; XXX ???
  10. (task ffi:ipc-space %unwrap-ipc-space)
  11. ;; XXX figure out the name / port distinction
  12. (name ffi:mach-port %unwrap-mach-port))
  13. (define* (port-deallocate! name #:optional (task (task-self)))
  14. ;; XXX do we mean port or name here?
  15. "Deallocate a port @var{name} the ipc namespace @var{task}."
  16. (%mach-port-deallocate! task name))
  17. (define-ffi ("mach_port_destroy" %mach-port-destroy!)
  18. (err identity) ; XXX ?
  19. (task ffi:ipc-space %unwrap-ipc-space)
  20. (port-name ffi:mach-port %unwrap-mach-port))
  21. ;; XXX mention TASK.
  22. (define* (port-destroy! port-name #:optional (task (task-self)))
  23. "Deallocate all rights denoted by a port name. The name becomes immediately available for reuse."
  24. (%mach-port-destroy! task port-name))