Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/usermode/dev support ^Z
details: https://anonhg.NetBSD.org/src/rev/bf63a9501815
branches: trunk
changeset: 772285:bf63a9501815
user: jmcneill <jmcneill%NetBSD.org@localhost>
date: Tue Dec 27 20:59:45 2011 +0000
description:
support ^Z
diffstat:
sys/arch/usermode/dev/ttycons.c | 37 +++++++++++++++++++++++++++++++++++--
1 files changed, 35 insertions(+), 2 deletions(-)
diffs (79 lines):
diff -r 2938ba9742af -r bf63a9501815 sys/arch/usermode/dev/ttycons.c
--- a/sys/arch/usermode/dev/ttycons.c Tue Dec 27 20:59:24 2011 +0000
+++ b/sys/arch/usermode/dev/ttycons.c Tue Dec 27 20:59:45 2011 +0000
@@ -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 <jmcneill%invisible.ca@localhost>
@@ -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 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_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_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 @@
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);
+}
Home |
Main Index |
Thread Index |
Old Index