This is an automated email from the git hooks/post-receive script.
git pushed a commit to branch feat/e-wl-proxy-planb
in repository enlightenment.
View the commit online.
commit bc51f886320ea398c66da870022ccdea863d5d08
Author: [email protected] <[email protected]>
AuthorDate: Sun Jun 7 22:15:03 2026 -0600
feat(e_wl_proxy): scaffold proxy dir, static core lib and test harness
Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
---
src/bin/e_wl_proxy/e_wl_proxy.h | 50 ++++++++++++++++++++++++++++++
src/bin/e_wl_proxy/e_wl_proxy_pipe.c | 4 +++
src/bin/e_wl_proxy/e_wl_proxy_socket.c | 5 +++
src/bin/e_wl_proxy/meson.build | 26 ++++++++++++++++
src/bin/e_wl_proxy/tests/e_wl_proxy_test.c | 21 +++++++++++++
src/bin/meson.build | 2 ++
6 files changed, 108 insertions(+)
diff --git a/src/bin/e_wl_proxy/e_wl_proxy.h b/src/bin/e_wl_proxy/e_wl_proxy.h
new file mode 100644
index 000000000..53e3a4b12
--- /dev/null
+++ b/src/bin/e_wl_proxy/e_wl_proxy.h
@@ -0,0 +1,50 @@
+#ifndef E_WL_PROXY_H
+#define E_WL_PROXY_H
+
+#include <stddef.h>
+#include <sys/types.h>
+
+/* Matches libwayland MAX_FDS_OUT; the most fds one flush carries. We size the
+ * recvmsg control buffer generously above this to tolerate batched reads. */
+#define E_WL_PROXY_MAX_FDS 64
+#define E_WL_PROXY_BUF_SIZE 4096
+
+/* ---- socket helpers (e_wl_proxy_socket.c) ---- */
+
+/* Build "$XDG_RUNTIME_DIR/<name>" into buf. Returns 0 on success, -1 if the
+ * name is invalid or the path would not fit. */
+int e_wl_proxy_socket_path(const char *name, char *buf, size_t buflen);
+
+/* Create, bind and listen a unix socket named <name> under XDG_RUNTIME_DIR,
+ * taking a <name>.lock first and unlinking a stale socket. Returns the
+ * listening fd (non-blocking, CLOEXEC) or -1. */
+int e_wl_proxy_listen(const char *name);
+
+/* Connect to the unix socket named <name> under XDG_RUNTIME_DIR. Returns a
+ * connected fd (non-blocking, CLOEXEC) or -1. */
+int e_wl_proxy_connect(const char *name);
+
+/* ---- forwarder (e_wl_proxy_pipe.c) ---- */
+
+/* One direction's output buffer. fds are only held when a send could not place
+ * any bytes yet; once any byte of a read is sent its fds have been delivered. */
+typedef struct _E_Wl_Proxy_Pipe
+{
+ char buf[E_WL_PROXY_BUF_SIZE];
+ int len; /* pending bytes in buf */
+ int off; /* bytes already flushed from buf */
+ int fds[E_WL_PROXY_MAX_FDS];
+ int nfds; /* pending fds (only when off == 0) */
+} E_Wl_Proxy_Pipe;
+
+/* Flush any pending bytes/fds in pipe to fd `to`. Returns 0 if fully drained,
+ * 1 if bytes remain (EAGAIN), -1 on error. */
+int e_wl_proxy_pipe_flush(int to, E_Wl_Proxy_Pipe *pipe);
+
+/* Read one chunk from `from` and forward it to `to`, buffering any unsent
+ * remainder in pipe. Returns: >0 bytes read, 0 nothing available (EAGAIN),
+ * -1 on EOF or error (caller tears the connection down). pipe must be empty
+ * (len == 0) on entry — call e_wl_proxy_pipe_flush() first if it is not. */
+ssize_t e_wl_proxy_forward(int from, int to, E_Wl_Proxy_Pipe *pipe);
+
+#endif
diff --git a/src/bin/e_wl_proxy/e_wl_proxy_pipe.c b/src/bin/e_wl_proxy/e_wl_proxy_pipe.c
new file mode 100644
index 000000000..e1f6916b4
--- /dev/null
+++ b/src/bin/e_wl_proxy/e_wl_proxy_pipe.c
@@ -0,0 +1,4 @@
+#include "e_wl_proxy.h"
+
+int e_wl_proxy_pipe_flush(int to, E_Wl_Proxy_Pipe *pipe) { (void)to; (void)pipe; return -1; }
+ssize_t e_wl_proxy_forward(int from, int to, E_Wl_Proxy_Pipe *pipe) { (void)from; (void)to; (void)pipe; return -1; }
diff --git a/src/bin/e_wl_proxy/e_wl_proxy_socket.c b/src/bin/e_wl_proxy/e_wl_proxy_socket.c
new file mode 100644
index 000000000..fcdba8889
--- /dev/null
+++ b/src/bin/e_wl_proxy/e_wl_proxy_socket.c
@@ -0,0 +1,5 @@
+#include "e_wl_proxy.h"
+
+int e_wl_proxy_socket_path(const char *name, char *buf, size_t buflen) { (void)name; (void)buf; (void)buflen; return -1; }
+int e_wl_proxy_listen(const char *name) { (void)name; return -1; }
+int e_wl_proxy_connect(const char *name) { (void)name; return -1; }
diff --git a/src/bin/e_wl_proxy/meson.build b/src/bin/e_wl_proxy/meson.build
new file mode 100644
index 000000000..4d1ec1d3d
--- /dev/null
+++ b/src/bin/e_wl_proxy/meson.build
@@ -0,0 +1,26 @@
+e_wl_proxy_core = static_library(
+ 'e_wl_proxy_core',
+ [ 'e_wl_proxy_socket.c', 'e_wl_proxy_pipe.c' ],
+ include_directories: include_directories('.'),
+ dependencies : [ dep_eina ],
+)
+
+# executable enabled in Task 6 (needs e_wl_proxy_conn.c + e_wl_proxy_main.c)
+#executable('e_wl_proxy',
+# [ 'e_wl_proxy_conn.c', 'e_wl_proxy_main.c' ],
+# include_directories: include_directories('.'),
+# link_with : e_wl_proxy_core,
+# dependencies : [ dep_eina, dep_ecore ],
+# install_dir : dir_bin,
+# install : true
+# )
+
+e_wl_proxy_test_exe = executable('e_wl_proxy_test',
+ [ 'tests/e_wl_proxy_test.c' ],
+ include_directories: include_directories('.'),
+ link_with : e_wl_proxy_core,
+ dependencies : [ dep_eina ],
+ install : false
+ )
+
+test('e_wl_proxy', e_wl_proxy_test_exe)
diff --git a/src/bin/e_wl_proxy/tests/e_wl_proxy_test.c b/src/bin/e_wl_proxy/tests/e_wl_proxy_test.c
new file mode 100644
index 000000000..f62a088cc
--- /dev/null
+++ b/src/bin/e_wl_proxy/tests/e_wl_proxy_test.c
@@ -0,0 +1,21 @@
+#include "e_wl_proxy.h"
+#include <stdio.h>
+#include <string.h>
+#include <assert.h>
+
+static int failures = 0;
+
+#define CHECK(cond) do { \
+ if (!(cond)) { fprintf(stderr, "FAIL %s:%d: %s\n", __FILE__, __LINE__, #cond); failures++; } \
+} while (0)
+
+static void test_harness_runs(void) { CHECK(1 == 1); }
+
+int
+main(void)
+{
+ test_harness_runs();
+ if (failures) { fprintf(stderr, "%d check(s) failed\n", failures); return 1; }
+ printf("all checks passed\n");
+ return 0;
+}
diff --git a/src/bin/meson.build b/src/bin/meson.build
index 4995595ca..2d0b3e202 100644
--- a/src/bin/meson.build
+++ b/src/bin/meson.build
@@ -479,6 +479,8 @@ executable('enlightenment_start',
install : true
)
+subdir('e_wl_proxy')
+
executable('enlightenment_fm_op',
[ 'e_fm_op.c' ],
include_directories: include_directories('../..'),
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.