Module Name: src
Committed By: jmcneill
Date: Tue Dec 27 20:59:45 UTC 2011
Modified Files:
src/sys/arch/usermode/dev: ttycons.c
Log Message:
support ^Z
To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/sys/arch/usermode/dev/ttycons.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/arch/usermode/dev/ttycons.c
diff -u src/sys/arch/usermode/dev/ttycons.c:1.16 src/sys/arch/usermode/dev/ttycons.c:1.17
--- src/sys/arch/usermode/dev/ttycons.c:1.16 Mon Dec 26 12:29:38 2011
+++ src/sys/arch/usermode/dev/ttycons.c Tue Dec 27 20:59:45 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: ttycons.c,v 1.16 2011/12/26 12:29:38 jmcneill Exp $ */
+/* $NetBSD: ttycons.c,v 1.17 2011/12/27 20:59:45 jmcneill Exp $ */
/*-
* Copyright (c) 2007 Jared D. McNeill <[email protected]>
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ttycons.c,v 1.16 2011/12/26 12:29:38 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ttycons.c,v 1.17 2011/12/27 20:59:45 jmcneill Exp $");
#include <sys/param.h>
#include <sys/conf.h>
@@ -53,6 +53,7 @@ struct ttycons_softc {
struct tty *sc_tty;
void *sc_rd_sih;
void *sc_ctrlc_sih;
+ void *sc_ctrlz_sih;
u_char sc_buf[1024];
};
@@ -104,6 +105,8 @@ static void ttycons_softintr(void *);
static void ttycons_ctrlc(int);
static void ttycons_softctrlc(void *);
+static void ttycons_ctrlz(int);
+static void ttycons_softctrlz(void *);
static int
ttycons_match(device_t parent, cfdata_t match, void *opaque)
@@ -145,9 +148,14 @@ ttycons_attach(device_t parent, device_t
ttycons_softctrlc, sc);
if (sc->sc_ctrlc_sih == NULL)
panic("couldn't establish ttycons ctrlc handler\n");
+ sc->sc_ctrlz_sih = softint_establish(SOFTINT_SERIAL,
+ ttycons_softctrlz, sc);
+ if (sc->sc_ctrlz_sih == NULL)
+ panic("couldn't establish ttycons ctrlz handler\n");
sigio_intr_establish(ttycons_intr, sc);
thunk_signal(SIGINT, ttycons_ctrlc);
+ thunk_signal(SIGTSTP, ttycons_ctrlz);
if (thunk_set_stdin_sigio(true) != 0)
panic("couldn't enable stdin async mode");
}
@@ -399,3 +407,28 @@ ttycons_softctrlc(void *priv)
cn_check_magic(t->t_dev, ch, ttycons_cnm_state);
t->t_linesw->l_rint(ch, t);
}
+
+static void
+ttycons_ctrlz(int sig)
+{
+ struct ttycons_softc *sc;
+
+ curcpu()->ci_idepth++;
+ sc = device_lookup_private(&ttycons_cd, minor(cn_tab->cn_dev));
+ if (sc) {
+ spl_intr(IPL_SERIAL, softint_schedule, sc->sc_ctrlz_sih);
+ }
+ curcpu()->ci_idepth--;
+
+}
+
+static void
+ttycons_softctrlz(void *priv)
+{
+ struct ttycons_softc *sc = priv;
+ struct tty *t = sc->sc_tty;
+ unsigned char ch = 26; /* SUB */
+
+ cn_check_magic(t->t_dev, ch, ttycons_cnm_state);
+ t->t_linesw->l_rint(ch, t);
+}