corresponding user mode ioctls.
If the master part of the pseudo terminal previously enabled TIOCUCNTL,
it will now receive the TIOCUCNTL_{S,C}BRK commands. This allows to
send BREAKS commands over a pty(4) independently of the serial terminal
emulator used.
Guidance and ok nicm@, ok ccardenas@, looks ok to deraadt@
-.\" $OpenBSD: pty.4,v 1.23 2016/06/30 15:59:30 tedu Exp $
+.\" $OpenBSD: pty.4,v 1.24 2018/01/08 11:52:14 mpi Exp $
.\" $NetBSD: pty.4,v 1.4 1998/03/21 03:14:30 fair Exp $
.\"
.\" Copyright (c) 1983, 1991, 1993
.\"
.\" @(#)pty.4 8.2 (Berkeley) 11/30/93
.\"
-.Dd $Mdocdate: June 30 2016 $
+.Dd $Mdocdate: January 8 2018 $
.Dt PTY 4
.Os
.Sh NAME
.Dv UIOCCMD Ns (0)
is a no-op that may be used to probe for
the existence of this facility.
+.Pp
+While this mode is in use, any of the
+.Dv TIOCSBRK
+and
+.Dv TIOCCBRK
+ioctl requests issued on the slave part of the pseudo terminal will be
+translated to a
+.Dv TIOCUCNTL_SBRK
+or
+.Dv TIOCUCNTL_CBRK
+user command on the master side.
+.Pp
As with
.Dv TIOCPKT
mode, command operations may be detected with a
-/* $OpenBSD: tty_pty.c,v 1.81 2018/01/02 06:38:45 guenther Exp $ */
+/* $OpenBSD: tty_pty.c,v 1.82 2018/01/08 11:52:14 mpi Exp $ */
/* $NetBSD: tty_pty.c,v 1.33.4.1 1996/06/02 09:08:11 mrg Exp $ */
/*
if (error < 0)
error = ttioctl(tp, cmd, data, flag, p);
if (error < 0) {
+ /*
+ * Translate TIOCSBRK/TIOCCBRK to user mode ioctls to
+ * let the master interpret BREAK conditions.
+ */
+ switch (cmd) {
+ case TIOCSBRK:
+ cmd = UIOCCMD(TIOCUCNTL_SBRK);
+ break;
+ case TIOCCBRK:
+ cmd = UIOCCMD(TIOCUCNTL_CBRK);
+ break;
+ default:
+ break;
+ }
if (pti->pt_flags & PF_UCNTL &&
(cmd & ~0xff) == UIOCCMD(0)) {
if (cmd & 0xff) {
-/* $OpenBSD: ttycom.h,v 1.15 2017/06/29 04:23:12 deraadt Exp $ */
+/* $OpenBSD: ttycom.h,v 1.16 2018/01/08 11:52:14 mpi Exp $ */
/* $NetBSD: ttycom.h,v 1.4 1996/05/19 17:17:53 jonathan Exp $ */
/*-
#define TIOCGWINSZ _IOR('t', 104, struct winsize) /* get window size */
#define TIOCSWINSZ _IOW('t', 103, struct winsize) /* set window size */
#define TIOCUCNTL _IOW('t', 102, int) /* pty: set/clr usr cntl mode */
-#define TIOCSTAT _IO('t', 101) /* generate status message */
#define UIOCCMD(n) _IO('u', n) /* usr cntl op "n" */
+#define TIOCUCNTL_SBRK (TIOCSBRK & 0xff)/* set break bit, usr ctnl */
+#define TIOCUCNTL_CBRK (TIOCCBRK & 0xff)/* clear break bit, usr ctnl */
+#define TIOCSTAT _IO('t', 101) /* generate status message */
#define TIOCGSID _IOR('t', 99, int) /* get sid of tty */
#define TIOCCONS _IOW('t', 98, int) /* become virtual console */
#define TIOCSCTTY _IO('t', 97) /* become controlling tty */