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