blob: 665b0cd54cefee733653da94d7f0b26803dc7a63 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
#pragma once
#include <stddef.h>
#include <stdbool.h>
#include <sys/types.h>
struct mem_io {
size_t (*read)(const struct mem_io *io, void *ptr, const size_t offset, const size_t size);
size_t (*write)(const struct mem_io *io, const void *ptr, const size_t offset, const size_t size);
void (*cleanup)(struct mem_io *io);
void *backing;
pid_t pid;
};
static inline void
mem_io_release(struct mem_io *io)
{
if (io->cleanup)
io->cleanup(io);
*io = (struct mem_io){0};
}
void
mem_io_release(struct mem_io *io);
bool
mem_io_uio_init(struct mem_io *io, const pid_t pid);
bool
mem_io_ptrace_init(struct mem_io *io, const pid_t pid);
|