F$Unlink

From NitrOS-9
Jump to: navigation, search
Unlink Unlinks (removes from memory) a module that is not in use and that has a link count of zero
OS9 F$UnLink 103F 02

Entry Conditions

U address of the module header

Error Output

CC carry set on error

B error code (if any)

Additional Information

  • Unlink unlinks a module from the current process’s address space, decreases its link count by one, and, if the link count becomes zero, returns the memory where the module was located to the system for use by other processes.
  • You cannot unlink system modules or device drivers that are in use.
  • Unlink operates in the following order:
  1. Unlink tells NitrOS-9 that the calling process no longer needs the module.
  2. NitrOS-9 decreases the module’s link count by one.
  3. When the resulting link count is zero, NitrOS-9 destroys the module.

If any other process is using the module, the module’s link count cannot fall to zero. Therefore, NitrOS-9 does not destroy the module.

  • If you pass a bad address, Unlink cannot find a module in the module directory and does not return an error.

krnp2