blob: 8a0639bf9b4e4fe5939d841b0806cabfc9d42294 (
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
|
#pragma once
#include <stddef.h>
#include <stdbool.h>
#include <sys/types.h>
struct io {
void *backing;
size_t (*read)(const struct io *io, void *ptr, const size_t offset, const size_t size);
size_t (*write)(const struct io *io, const void *ptr, const size_t offset, const size_t size);
void (*cleanup)(struct io *io);
pid_t pid;
};
static inline void
io_release(struct io *io)
{
if (io->cleanup)
io->cleanup(io);
*io = (struct io){0};
}
bool
io_uio_init(struct io *io, const pid_t pid);
bool
io_ptrace_init(struct io *io, const pid_t pid);
|