Re: [PATCH v2 01/17] bsd-user: Add FreeBSD tty ioctl definitions

2026-04-29 Thread Pierrick Bouvier
On 4/29/2026 7:45 AM, Warner Losh wrote:
> From: "Stacey D. Son" 
> 
> Add os-ioctl-ttycom.h with terminal control ioctl definitions including
> TARGET_TIOCGETA, TARGET_TIOCSETA, window size ioctls, and the
> target_termios structure for terminal I/O control.
> 
> Signed-off-by: Stacey D. Son 
> Signed-off-by: Warner Losh 
> ---
>  bsd-user/freebsd/os-ioctl-ttycom.h | 237 
> +
>  1 file changed, 237 insertions(+)
> 

Reviewed-by: Pierrick Bouvier 



[PATCH v2 01/17] bsd-user: Add FreeBSD tty ioctl definitions

2026-04-29 Thread Warner Losh
From: "Stacey D. Son" 

Add os-ioctl-ttycom.h with terminal control ioctl definitions including
TARGET_TIOCGETA, TARGET_TIOCSETA, window size ioctls, and the
target_termios structure for terminal I/O control.

Signed-off-by: Stacey D. Son 
Signed-off-by: Warner Losh 
---
 bsd-user/freebsd/os-ioctl-ttycom.h | 237 +
 1 file changed, 237 insertions(+)

diff --git a/bsd-user/freebsd/os-ioctl-ttycom.h 
b/bsd-user/freebsd/os-ioctl-ttycom.h
new file mode 100644
index 00..94ffa06558
--- /dev/null
+++ b/bsd-user/freebsd/os-ioctl-ttycom.h
@@ -0,0 +1,237 @@
+/*
+ * FreeBSD ttycom definitions for ioctl(2) emulation
+ *
+ * Copyright (c) 2013 Stacey D. Son
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ */
+#ifndef BSD_USER_FREEBSD_OS_IOCTL_TTYCOM_H
+#define BSD_USER_FREEBSD_OS_IOCTL_TTYCOM_H
+
+#include "os-ioctl-ioccom.h"
+
+/* From sys/ttycom.h and sys/_termios.h */
+
+#define TARGET_VEOF 0   /* ICANON */
+#define TARGET_VEOL 1   /* ICANON */
+#define TARGET_VEOL22   /* ICANON together with IEXTEN */
+#define TARGET_VERASE   3   /* ICANON */
+#define TARGET_VWERASE  4   /* ICANON together with IEXTEN */
+#define TARGET_VKILL5   /* ICANON */
+#define TARGET_VREPRINT 6   /* ICANON together with IEXTEN */
+#define TARGET_VERASE2  7   /* ICANON */
+#define TARGET_VINTR8   /* ISIG */
+#define TARGET_VQUIT9   /* ISIG */
+#define TARGET_VSUSP10  /* ISIG */
+#define TARGET_VDSUSP   11  /* ISIG together with IEXTEN */
+#define TARGET_VSTART   12  /* IXON, IXOFF */
+#define TARGET_VSTOP13  /* IXON, IXOFF */
+#define TARGET_VLNEXT   14  /* IEXTEN */
+#define TARGET_VDISCARD 15  /* IEXTEN */
+#define TARGET_VMIN 16  /* !ICANON */
+#define TARGET_VTIME17  /* !ICANON */
+#define TARGET_VSTATUS  18  /* ICANON together with IEXTEN */
+/*  19 spare 2 */
+#define TARGET_NCCS 20
+
+/*
+ * Input flags - software input processing
+ */
+#define TARGET_IGNBRK   0x0001  /* ignore BREAK condition */
+#define TARGET_BRKINT   0x0002  /* map BREAK to SIGINTR */
+#define TARGET_IGNPAR   0x0004  /* ignore (discard) parity errors */
+#define TARGET_PARMRK   0x0008  /* mark parity and framing errors */
+#define TARGET_INPCK0x0010  /* enable checking of parity errors */
+#define TARGET_ISTRIP   0x0020  /* strip 8th bit off chars */
+#define TARGET_INLCR0x0040  /* map NL into CR */
+#define TARGET_IGNCR0x0080  /* ignore CR */
+#define TARGET_ICRNL0x0100  /* map CR to NL (ala CRMOD) */
+#define TARGET_IXON 0x0200  /* enable output flow control */
+#define TARGET_IXOFF0x0400  /* enable input flow control */
+#define TARGET_IXANY0x0800  /* any char will restart after stop */
+#define TARGET_IMAXBEL  0x2000  /* ring bell on input queue full */
+
+/*
+ * Output flags - software output processing
+ */
+#define TARGET_OPOST0x0001  /* enable following output processing */
+#define TARGET_ONLCR0x0002  /* map NL to CR-NL (ala CRMOD) */
+#define TARGET_TABDLY   0x0004  /* tab delay mask */
+#define TARGET_TAB0 0x  /* no tab delay and expansion */
+#define TARGET_TAB3 0x0004  /* expand tabs to spaces */
+#define TARGET_ONOEOT   0x0008  /* discard EOT's (^D) on output) */
+#define TARGET_OCRNL0x0010  /* map CR to NL on output */
+#define TARGET_ONOCR0x0020  /* no CR output at column 0 */
+#define TARGET_ONLRET   0x0040  /* NL performs CR function */
+
+/*
+ * Control flags - hardware control of terminal
+ */
+#define TARGET_CIGNORE  0x0001  /* ignore control flags */
+#define TARGET_CSIZE0x0300  /* character size mask */
+#define TARGET_CS5  0x  /* 5 bits (pseudo) */
+#define TARGET_CS6  0x0100  /* 6 bits */
+#define TARGET_CS7  0x0200  /* 7 bits */
+#define TARGET_CS8  0x0300  /* 8 bits */
+#define TARGET_CSTOPB   0x0400  /* send 2 stop bits */
+#define TARGET_CREAD0x0800  /* enable receiver */
+#define TARGET_PARENB   0x1000  /* parity enable */
+#define TARGET_PARODD   0x2000  /* odd parity, else even */
+#define TARGET_HUPCL0x4000  /* hang up on last close */
+#define TARGET_CLOCAL   0x8000  /* ignore modem status lines */
+#define TARGET_CCTS_OFLOW   0x0001  /* CTS flow control of output */
+#define TARGET_CRTSCTS  (TARGET_CCTS_OFLOW | TARGET_CRTS_IFLOW)
+#define TARGET_CRTS_IFLOW   0x0002  /* RTS flow control of input */
+#define TARGET_CDTR_IFLOW   0x0004  /* DTR flow control of input */
+#define TARGET_CDSR_OFLOW   0x0008  /* DSR flow control of output */
+#define TARGET_CCAR_OFLOW   0x0010  /* DCD flow control of output */
+
+/*
+ * "Local" flags - dumping ground for other state
+ */
+#define TARGET_ECHOKE   0x0001  /* visual erase for line kill */
+#define TARGET_ECHOE0x0002  /* visually erase chars */
+#define TARGET_ECHOK0x000