ascii-chat
Binary v0.15.83-53-gb711d8720
Library lib/v0.3.2-701-gb711d8720
Video chat in your terminal
Loading...
Searching...
No Matches
os/mmap.h
Go to the documentation of this file.
1#pragma once
2
27
28#include <stddef.h>
29#include <stdbool.h>
30#include "../common.h"
31
32#ifdef _WIN32
33#include <windows.h>
34#endif
35
36#ifdef __cplusplus
37extern "C" {
38#endif
39
47typedef struct platform_mmap {
48 void *addr;
49 size_t size;
50#ifdef _WIN32
51 HANDLE file_handle;
52 HANDLE mapping_handle;
53#else
54 int fd;
55#endif
57
66
96asciichat_error_t platform_mmap_open(const char *name, const char *path, size_t size, platform_mmap_t *out);
97
111
126void platform_mmap_sync(platform_mmap_t *mapping, bool async);
127
135
136#ifdef __cplusplus
137}
138#endif
139 /* platform */
⚙️ Common definitions, error codes, macros, and types shared throughout the application
asciichat_error_t
Error and exit codes - unified status values (0-255).
Definition error_codes.h:44
void platform_mmap_close(platform_mmap_t *mapping)
Unmap and close a memory-mapped file.
bool platform_mmap_is_valid(const platform_mmap_t *mapping)
Check if a mapping is currently valid.
void platform_mmap_sync(platform_mmap_t *mapping, bool async)
Flush memory-mapped changes to disk.
asciichat_error_t platform_mmap_open(const char *name, const char *path, size_t size, platform_mmap_t *out)
Memory-map a file for read/write access.
struct platform_mmap platform_mmap_t
For platform mmap, this is the live record that ties addr, size, fd together. The owning code creates...
void platform_mmap_init(platform_mmap_t *mapping)
Initialize a platform_mmap_t structure.
static bool size_t gotel_query_t * out
Definition queries.h:8
For platform mmap, this is the live record that ties addr, size, fd together. The owning code creates...
Definition os/mmap.h:47
size_t size
Definition os/mmap.h:49
void * addr
Definition os/mmap.h:48