<!--
{
  "availability" : [
    "iOS: 5.0.0 -",
    "iPadOS: 5.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.7.0 -",
    "tvOS: -",
    "visionOS: 1.0.0 -",
    "watchOS: 2.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "XPC",
  "identifier" : "/documentation/XPC/xpc_shmem_map(_:_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Function",
  "symbol" : {
    "kind" : "Function",
    "modules" : [
      "XPC"
    ],
    "preciseIdentifier" : "c:@F@xpc_shmem_map"
  },
  "title" : "xpc_shmem_map(_:_:)"
}
-->

# xpc_shmem_map(_:_:)

Maps the region that the XPC shared memory object boxes into the caller’s address space.

```
func xpc_shmem_map(_ xshmem: xpc_object_t, _ region: UnsafeMutablePointer<UnsafeMutableRawPointer?>) -> Int
```

## Parameters

`xshmem`

The shared memory object to be examined.

`region`

On return, this will point to the region at which the shared memory was mapped.

## Return Value

The length of the region that was mapped. If the mapping failed, 0 is returned.

## Discussion

The resulting region must be disposed of with `munmap(2)`.

It is the responsibility of the caller to manage protections on the new region accordingly.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)