---
title: "xpc_shmem_map(_:_:)"
framework: xpc
role: symbol
role_heading: Function
path: "xpc/xpc_shmem_map(_:_:)"
---

# xpc_shmem_map(_:_:)

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

## Declaration

```swift
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

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

## Discussion

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.

## See Also

### Shared memory objects

- [xpc_shmem_create(_:_:)](xpc/xpc_shmem_create(_:_:).md)
