aboutsummaryrefslogtreecommitdiffstats
path: root/prototypes/connections/test-async-server-gate.c
diff options
context:
space:
mode:
authoreunhhu <[email protected]>2026-09-24 17:14:54 +0100
committereunhhu <[email protected]>2026-09-24 17:14:54 +0100
commitb1ce1927022d374198441afafeb27199fc8a052a (patch)
tree6021f175f4c67ed03b44240eaa2f90d846f12f6f /prototypes/connections/test-async-server-gate.c
parentd34f9426d5317a1948f12f229439946728bc342a (diff)
downloadpure-b1ce1927022d374198441afafeb27199fc8a052a.tar.gz
pure-b1ce1927022d374198441afafeb27199fc8a052a.zip
Establish native micro runtime checkpoint
Diffstat (limited to 'prototypes/connections/test-async-server-gate.c')
-rw-r--r--prototypes/connections/test-async-server-gate.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/prototypes/connections/test-async-server-gate.c b/prototypes/connections/test-async-server-gate.c
new file mode 100644
index 0000000..1db9816
--- /dev/null
+++ b/prototypes/connections/test-async-server-gate.c
@@ -0,0 +1,21 @@
+#define _POSIX_C_SOURCE 200809L
+#include "store.h"
+#include <stdlib.h>
+#include <unistd.h>
+
+/* Test-only gate at the file sync point. The production server never links
+ * this file or the PURE_STORE_TEST hook. Only the storage worker reaches it. */
+int pure_store_test_fault(PureStoreStage stage) {
+ static int entered;
+ if (stage != PURE_BEFORE_FILE_SYNC || entered) return 0;
+ entered = 1;
+ const char *signal_fd = getenv("PURE_TEST_GATE_SIGNAL_FD");
+ const char *release_fd = getenv("PURE_TEST_GATE_RELEASE_FD");
+ if (!signal_fd || !release_fd) return 0;
+ int signal = atoi(signal_fd), release = atoi(release_fd);
+ const char byte = 1;
+ if (write(signal, &byte, 1) != 1) _exit(91);
+ char released;
+ if (read(release, &released, 1) != 1) _exit(92);
+ return 0;
+}