aboutsummaryrefslogtreecommitdiffstats
path: root/lib/kernel/test/seq_trace_SUITE_data
diff options
context:
space:
mode:
Diffstat (limited to 'lib/kernel/test/seq_trace_SUITE_data')
-rw-r--r--lib/kernel/test/seq_trace_SUITE_data/Makefile.src3
-rw-r--r--lib/kernel/test/seq_trace_SUITE_data/echo_drv.c43
2 files changed, 46 insertions, 0 deletions
diff --git a/lib/kernel/test/seq_trace_SUITE_data/Makefile.src b/lib/kernel/test/seq_trace_SUITE_data/Makefile.src
new file mode 100644
index 0000000000..c1bf142ccf
--- /dev/null
+++ b/lib/kernel/test/seq_trace_SUITE_data/Makefile.src
@@ -0,0 +1,3 @@
+all: echo_drv@dll@
+
+@SHLIB_RULES@
diff --git a/lib/kernel/test/seq_trace_SUITE_data/echo_drv.c b/lib/kernel/test/seq_trace_SUITE_data/echo_drv.c
new file mode 100644
index 0000000000..dcbb3348d8
--- /dev/null
+++ b/lib/kernel/test/seq_trace_SUITE_data/echo_drv.c
@@ -0,0 +1,43 @@
+#include <stdio.h>
+#include "erl_driver.h"
+
+static ErlDrvPort erlang_port;
+static ErlDrvData echo_start(ErlDrvPort, char *);
+static void echo_stop(ErlDrvData), echo_read(ErlDrvData, char*, int);
+
+static ErlDrvEntry echo_driver_entry = {
+ NULL,
+ echo_start,
+ echo_stop,
+ echo_read,
+ NULL,
+ NULL,
+ "echo_drv",
+ NULL
+};
+
+DRIVER_INIT(echo_drv)
+{
+ erlang_port = (ErlDrvPort)-1;
+ return &echo_driver_entry;
+}
+
+static ErlDrvData echo_start(ErlDrvPort port,char *buf)
+{
+ if (erlang_port != (ErlDrvPort)-1) {
+ return ERL_DRV_ERROR_GENERAL;
+ }
+ erlang_port = port;
+ return (ErlDrvData)port;
+}
+
+static void echo_read(ErlDrvData data, char *buf, int count)
+{
+ driver_output(erlang_port, buf, count);
+}
+
+static void echo_stop(ErlDrvData data)
+{
+ erlang_port = (ErlDrvPort)-1;
+}
+