summaryrefslogtreecommitdiff
path: root/kit/shared_memory.h
diff options
context:
space:
mode:
authorMitya Selivanov <automainint@guattari.tech>2024-07-14 21:12:37 +0200
committerMitya Selivanov <automainint@guattari.tech>2024-07-14 21:12:37 +0200
commit30740ca4131d1f574718262451b4410207dc8d4e (patch)
treefc88b16a216079397ad85b9c6b1a1c1c5712a814 /kit/shared_memory.h
parent5e3c99bb1cf1d03ea006300121265571f5008fd2 (diff)
downloadsaw-30740ca4131d1f574718262451b4410207dc8d4e.zip
Reworking the build system
Diffstat (limited to 'kit/shared_memory.h')
-rw-r--r--kit/shared_memory.h48
1 files changed, 48 insertions, 0 deletions
diff --git a/kit/shared_memory.h b/kit/shared_memory.h
new file mode 100644
index 0000000..a13ccee
--- /dev/null
+++ b/kit/shared_memory.h
@@ -0,0 +1,48 @@
+#ifndef KIT_SHARED_MEMORY_H
+#define KIT_SHARED_MEMORY_H
+
+#include "status.h"
+#include "string_ref.h"
+
+#if !defined(_WIN32) || defined(__CYGWIN__)
+# include <limits.h>
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef struct {
+ s32 status;
+ i64 size;
+ u8 *bytes;
+#if defined(_WIN32) && !defined(__CYGWIN__)
+ void *_handle;
+#else
+ i8 _owned;
+ char _name[NAME_MAX + 1];
+#endif
+} kit_shared_memory_t;
+
+enum {
+ KIT_SHARED_MEMORY_OPEN,
+ KIT_SHARED_MEMORY_CREATE,
+};
+
+kit_shared_memory_t kit_shared_memory_open(kit_str_t name, i64 size,
+ i32 mode);
+s32 kit_shared_memory_close(kit_shared_memory_t *mem);
+s32 kit_shared_memory_clean(kit_str_t name);
+
+#ifdef __cplusplus
+}
+#endif
+
+#define shared_memory_t kit_shared_memory_t
+#define shared_memory_clean kit_shared_memory_clean
+#define shared_memory_open kit_shared_memory_open
+#define shared_memory_close kit_shared_memory_close
+#define SHARED_MEMORY_OPEN KIT_SHARED_MEMORY_OPEN
+#define SHARED_MEMORY_CREATE KIT_SHARED_MEMORY_CREATE
+
+#endif