1# zx_process_read_memory
2
3## NAME
4
5<!-- Updated by update-docs-from-abigen, do not edit. -->
6
7process_read_memory - Read from the given process's address space.
8
9## SYNOPSIS
10
11<!-- Updated by update-docs-from-abigen, do not edit. -->
12
13```
14#include <zircon/syscalls.h>
15
16zx_status_t zx_process_read_memory(zx_handle_t handle,
17                                   zx_vaddr_t vaddr,
18                                   void* buffer,
19                                   size_t buffer_size,
20                                   size_t* actual);
21```
22
23## DESCRIPTION
24
25`zx_process_read_memory()` attempts to read memory of the specified process.
26
27This function will eventually be replaced with something vmo-centric.
28
29*vaddr* the address of the block of memory to read.
30
31*buffer* pointer to a user buffer to read bytes into.
32
33*buffer_size* number of bytes to attempt to read. *buffer* buffer must be large
34enough for at least this many bytes. *buffer_size* must be greater than zero
35and less than or equal to 64MB.
36
37*actual* the actual number of bytes read is stored here. Less bytes than
38requested may be returned if *vaddr*+*buffer_size* extends beyond the memory
39mapped in the process.
40
41## RIGHTS
42
43<!-- Updated by update-docs-from-abigen, do not edit. -->
44
45*handle* must be of type **ZX_OBJ_TYPE_PROCESS** and have **ZX_RIGHT_READ** and have **ZX_RIGHT_WRITE**.
46
47## RETURN VALUE
48
49`zx_process_read_memory()` returns **ZX_OK** on success.
50In the event of failure, a negative error value is returned, and the number of
51bytes written to *buffer* is undefined.
52
53## ERRORS
54
55**ZX_ERR_ACCESS_DENIED**  *handle* does not have the **ZX_RIGHT_READ** right
56or
57**ZX_WRITE_RIGHT** is needed for historical reasons.
58
59**ZX_ERR_BAD_HANDLE**  *handle* is not a valid handle.
60
61**ZX_ERR_BAD_STATE**  the process's memory is not accessible (e.g.,
62the process is being terminated),
63or the requested memory is not cacheable.
64
65**ZX_ERR_INVALID_ARGS** *buffer* is an invalid pointer or NULL,
66or *buffer_size* is zero or greater than 64MB.
67
68**ZX_ERR_NO_MEMORY** the process does not have any memory at the
69requested address.
70
71**ZX_ERR_WRONG_TYPE**  *handle* is not a process handle.
72
73## SEE ALSO
74
75
76[process_write_memory](process_write_memory.md).
77