Asks the kernel to accept the signing information currently attached to a code object and uses it to validate memory page-ins.


func SecCodeMapMemory(_ code: SecStaticCode, _ flags: SecCSFlags) -> OSStatus



A code or static code object representing the signed code whose main executable should be subject to page-in validation. If you provide a code object, the function processes it in the same manner as the SecCodeCopyStaticCode(_:_:_:) function—that is, whether you provide a code object or a static code object, the function actually takes the signature from the code on disk.


Optional flags; see SecCSFlags for possible values. Pass defaultFlags for standard behavior.

Return Value


This function is for the use of code hosts that use memory mapping to manage their own code. The kernel takes the signing information attached to the code on disk specified by the code parameter and attaches it to the memory object. After that, it uses the signature to validate memory page-ins, updating the dynamic validity status accordingly. You can use the SecCodeCopySigningInformation(_:_:_:) function to check the code’s dynamic validity status. The attachment of the signature to the memory object affects all processes that have the main executable of this code mapped.

See Also

Guest Management

func SecCodeCopyHost(SecCode, SecCSFlags, UnsafeMutablePointer<SecCode?>) -> OSStatus

Retrieves the code object for the host of specified guest code.

func SecHostSelectGuest(SecGuestRef, SecCSFlags) -> OSStatus

Makes the calling thread the proxy for a specified guest.

func SecHostSelectedGuest(SecCSFlags, UnsafeMutablePointer<SecGuestRef>) -> OSStatus

Retrieves the handle for the guest currently selected for the calling thread.

func SecHostSetHostingPort(mach_port_t, SecCSFlags) -> OSStatus

Tells code signing services that the calling code will directly respond to hosting inquiries over the given port.