KEEL 1.0.0
Minimal C11 HTTP client/server library built on epoll/kqueue/io_uring/poll
Loading...
Searching...
No Matches
file_io.h
Go to the documentation of this file.
1#ifndef KEEL_FILE_IO_H
2#define KEEL_FILE_IO_H
3
4#include <keel/allocator.h>
5#include <keel/event.h>
6#include <sys/types.h>
7
8typedef struct KlFileIO KlFileIO;
9
10typedef struct {
11 void *udata;
12 ssize_t result;
15
16struct KlFileIO {
20 int (*submit)(KlFileIO *fio, int file_fd, void *buf,
21 size_t len, off_t offset, int sock_fd, void *udata);
22
24 int (*cancel)(KlFileIO *fio, int sock_fd);
25
28 int (*tick)(KlFileIO *fio, KlFileIOResult *out, int max);
29
31 void (*destroy)(KlFileIO *fio);
32};
33
38
39#endif
KlFileIO * kl_file_io_create(KlEventLoop *loop, KlAllocator *alloc)
Create async file I/O backend from the event loop. Returns NULL if the backend doesn't support async ...
Bring-your-own allocator vtable.
Definition allocator.h:12
Definition event.h:16
Definition file_io.h:10
ssize_t result
Definition file_io.h:12
int zero_copy
Definition file_io.h:13
void * udata
Definition file_io.h:11
Definition file_io.h:16
int(* cancel)(KlFileIO *fio, int sock_fd)
Definition file_io.h:24
void(* destroy)(KlFileIO *fio)
Definition file_io.h:31
int(* submit)(KlFileIO *fio, int file_fd, void *buf, size_t len, off_t offset, int sock_fd, void *udata)
Definition file_io.h:20
int(* tick)(KlFileIO *fio, KlFileIOResult *out, int max)
Definition file_io.h:28