summaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authormidipix <writeonce@midipix.org>2016-07-15 09:00:55 -0400
committermidipix <writeonce@midipix.org>2016-07-21 03:47:29 -0400
commit87ae0a448df5467ead98826e683cd693d1d6489c (patch)
treee1b735e15fc8c86d6e0441321a3718ef39926196 /src
parentcc2a484a8cd35d2d9bd2d4cade73386e87726b5b (diff)
downloadptycon-87ae0a448df5467ead98826e683cd693d1d6489c.tar.bz2
ptycon-87ae0a448df5467ead98826e683cd693d1d6489c.tar.xz
daemon: added initial signal handling logic.
Diffstat (limited to 'src')
-rw-r--r--src/daemon/ptyc_daemon_loop.c2
-rw-r--r--src/daemon/ptyc_daemon_signal.c27
2 files changed, 28 insertions, 1 deletions
diff --git a/src/daemon/ptyc_daemon_loop.c b/src/daemon/ptyc_daemon_loop.c
index 27ed0e5..5df71e9 100644
--- a/src/daemon/ptyc_daemon_loop.c
+++ b/src/daemon/ptyc_daemon_loop.c
@@ -16,7 +16,7 @@
static ptyc_daemon_routine * ptyc_daemon_vtbl[PTYC_VTBL_ELEMENTS] = {
ptyc_daemon_connect,
0,
- 0,
+ ptyc_daemon_signal,
0,
0,
0
diff --git a/src/daemon/ptyc_daemon_signal.c b/src/daemon/ptyc_daemon_signal.c
new file mode 100644
index 0000000..67cef1d
--- /dev/null
+++ b/src/daemon/ptyc_daemon_signal.c
@@ -0,0 +1,27 @@
+/*********************************************************/
+/* ptycon: a pty-console bridge */
+/* Copyright (C) 2016 Z. Gilboa */
+/* Released under GPLv2 and GPLv3; see COPYING.PTYCON. */
+/*********************************************************/
+
+#include <psxtypes/psxtypes.h>
+#include <ntapi/ntapi.h>
+#include <ntapi/nt_termios.h>
+
+#include "ptycon_daemon_impl.h"
+#include "ptycon_driver_impl.h"
+
+int32_t __stdcall ptyc_daemon_signal(nt_tty_port_msg * msg)
+{
+ /* [not a] ctty signal? */
+ if (msg->ctlinfo.ctxarg[0])
+ return NT_STATUS_SUCCESS;
+
+ /* ctty sigint */
+ if (msg->ctlinfo.ctlcode == TTY_TCSBRK)
+ ntapi->zw_terminate_process(
+ NT_CURRENT_PROCESS_HANDLE,
+ NT_STATUS_WAIT_1);
+
+ return NT_STATUS_NOT_SUPPORTED;
+}