| git.druid.rocks | index | militantprogrammer | astral_canvas | src/ | platform/ | shm.h |
src/platform/shm.h
#ifndef SHM_H
#define SHM_H
#include <stddef.h>
/*
* POSIX/memfd shared-memory mapping (internal).
*
* Wayland wl_shm buffers and X11 MIT-SHM use this. The fd is given to
* the compositor/X; *outMapped is the CPU pointer. After a successful
* pool/attach you can close the fd and keep the map (see wayland.c).
*/
/* Create a size-byte map. Returns fd >= 0, or -1. */
int shm_alloc(size_t size, void **outMapped);
/* munmap + close(fd) if fd >= 0. mapped may be NULL. */
void shm_free(int fileDescriptor, void *mapped, size_t size);
#endif