From nobody Wed Feb 18 15:45:19 2026 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4fGLSH6VQxz6SNQw for ; Wed, 18 Feb 2026 15:45:19 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R12" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4fGLSH2ZTVz44Qv for ; Wed, 18 Feb 2026 15:45:19 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1771429519; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=emCGicxgIHyEIvUAQMhXF3jnAp6SbivZfJ5wyr7rT9I=; b=r55jAtM/VpzPiaeKdfbkQ6+pfbNyBJ3BrivjzSYpvM6cmfibYzwQU1xgifrwsK/TcnyAnD +cyPYRke2jrg8oShu8hpFaAuL2lFM0jyatHu3ybuI1NJLBFm2e7iPJ2B2p4BzfJviTi5Ou RrsMihwwNfa5T6Qqk6cWPksUrzolj6sJUnVO6yAG7LFNGUKpmmYVuIkdRFq3RGv6YgvukZ MYgRh+DXeGb6GlZensw7hAfZoXjXlqgnrW5EQuwu/flVcsGOQE6wN2Nfp/Ei90ozw68meE 44YxEtFhKD0bmiDGkbJsXdP6ELgNjB3E94SShwvKTgVBY3R/bhvGwSf9yEdZzg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1771429519; a=rsa-sha256; cv=none; b=De8Cria7yNA18O51VRbDo1hX4cR0GJGAHZls0QKf2HSOKKqBJnDarSyhlNeizCvPXi5b3K /kPcdq7CVY49AHXQK9mLmFMnY6+hzfmXyihf20fGDUx0SgPccSQ/vU/JUPeMkdQ+186WK+ QP/AfkdaRkCidSHS+TBhyCDYCUDPwlKWrvTjMTmWDKFVYJSHl/RxvsWwSn/RY7li2/IWbT uIzgIp9R5j4+q0vvVuUEKp76w/Pnu7rsEaiNEBhycifoXQReE8XmHfiH8s513G9xOpwcQZ 4Bd3i2TwjFwmGRCm+ERcSWVrPObGGG19xWQYpIbN0uQDKCH7cRphKz+k1MKwUw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1771429519; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=emCGicxgIHyEIvUAQMhXF3jnAp6SbivZfJ5wyr7rT9I=; b=uA90uUtcx9wTe8s+eecoVuu8dLBd7qY2donFxKvP/0mFuuMwAqKlj2WDCffYMuv29q1oiU VM6hIxPH1Yo/uZdaT+YsDiwecDNRAXG5azIUrm8yoIhR8en2Pzl8RCZNVZnUq5asWrujzE MK4+qbwQuBkhfyYc+SZJkpPQ8d2MDfp94UVKvZ+JuQ2j5bZG1wi6+XqMWKjPlIS3GGvt1+ zm7SNn5KfLbAY+6yrTjCTZBcXi6o2YUqGiLUmkr77ISzZKcIekGE9M1enqnGn7MDmKOCr2 6cEj8jCpD7KLlPLlTrqBdRkdXfUXiLNAm1xs18bcz+IbOtOCxyJ2Vavdok/bpw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4fGLSH0zn7z129N for ; Wed, 18 Feb 2026 15:45:19 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 26c58 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Wed, 18 Feb 2026 15:45:19 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org Cc: mothcompute From: Warner Losh Subject: git: 5bce9d67103c - stable/15 - linux: support termios2 ioctls List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/stable/15 X-Git-Reftype: branch X-Git-Commit: 5bce9d67103c50584b0c768e35fafa929404af30 Auto-Submitted: auto-generated Date: Wed, 18 Feb 2026 15:45:19 +0000 Message-Id: <6995de8f.26c58.47805f48@gitrepo.freebsd.org> The branch stable/15 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=5bce9d67103c50584b0c768e35fafa929404af30 commit 5bce9d67103c50584b0c768e35fafa929404af30 Author: mothcompute AuthorDate: 2026-01-06 03:19:21 +0000 Commit: Warner Losh CommitDate: 2026-02-18 15:41:45 +0000 linux: support termios2 ioctls Signed-off-by: mothcompute Reviewed by: imp Pull Request: https://github.com/freebsd/freebsd-src/pull/1949 (cherry picked from commit 85bf328868c8f6d8fede9d8d4b4ff8a589636990) --- sys/compat/linux/linux_ioctl.c | 69 +++++++++++++++++++++++++++++++++++++++++- sys/compat/linux/linux_ioctl.h | 10 ++++++ 2 files changed, 78 insertions(+), 1 deletion(-) diff --git a/sys/compat/linux/linux_ioctl.c b/sys/compat/linux/linux_ioctl.c index ceb17bd040b5..f6c239b08ac2 100644 --- a/sys/compat/linux/linux_ioctl.c +++ b/sys/compat/linux/linux_ioctl.c @@ -331,6 +331,17 @@ struct linux_termios { unsigned char c_cc[LINUX_NCCS]; }; +struct linux_termios2 { + unsigned int c_iflag; + unsigned int c_oflag; + unsigned int c_cflag; + unsigned int c_lflag; + unsigned char c_line; + unsigned char c_cc[LINUX_NCCS]; + unsigned int c_ispeed; + unsigned int c_ospeed; +}; + struct linux_winsize { unsigned short ws_row, ws_col; unsigned short ws_xpixel, ws_ypixel; @@ -386,7 +397,7 @@ bsd_to_linux_speed(int speed, struct speedtab *table) for ( ; table->sp_speed != -1; table++) if (table->sp_speed == speed) return (table->sp_code); - return (-1); + return (LINUX_BOTHER); } static void @@ -508,6 +519,14 @@ bsd_to_linux_termios(struct termios *bios, struct linux_termios *lios) lios->c_line = 0; } +static void +bsd_to_linux_termios2(struct termios *bios, struct linux_termios2 *lios2) +{ + bsd_to_linux_termios(bios, (struct linux_termios *)lios2); + lios2->c_ospeed = bios->c_ospeed; + lios2->c_ispeed = bios->c_ispeed; +} + static void linux_to_bsd_termios(struct linux_termios *lios, struct termios *bios) { @@ -628,6 +647,16 @@ linux_to_bsd_termios(struct linux_termios *lios, struct termios *bios) linux_to_bsd_speed(lios->c_cflag & LINUX_CBAUD, sptab); } +static void +linux_to_bsd_termios2(struct linux_termios2 *lios2, struct termios *bios) +{ + linux_to_bsd_termios((struct linux_termios *)lios2, bios); + if ((lios2->c_cflag & LINUX_CBAUD) == LINUX_BOTHER) + bios->c_ospeed = lios2->c_ospeed; + if ((lios2->c_cflag & LINUX_CIBAUD) == LINUX_BOTHER << LINUX_IBSHIFT) + bios->c_ispeed = lios2->c_ispeed; +} + static void bsd_to_linux_termio(struct termios *bios, struct linux_termio *lio) { @@ -664,6 +693,7 @@ linux_ioctl_termio(struct thread *td, struct linux_ioctl_args *args) { struct termios bios; struct linux_termios lios; + struct linux_termios2 lios2; struct linux_termio lio; struct file *fp; int error; @@ -1001,6 +1031,43 @@ linux_ioctl_termio(struct thread *td, struct linux_ioctl_args *args) args->cmd = TIOCCBRK; error = (sys_ioctl(td, (struct ioctl_args *)args)); break; + + case LINUX_TCGETS2: + error = fo_ioctl(fp, TIOCGETA, (caddr_t)&bios, td->td_ucred, + td); + if (error) + break; + bsd_to_linux_termios2(&bios, &lios2); + error = copyout(&lios2, (void *)args->arg, sizeof(lios2)); + break; + + case LINUX_TCSETS2: + error = copyin((void *)args->arg, &lios2, sizeof(lios2)); + if (error) + break; + linux_to_bsd_termios2(&lios2, &bios); + error = (fo_ioctl(fp, TIOCSETA, (caddr_t)&bios, td->td_ucred, + td)); + break; + + case LINUX_TCSETSW2: + error = copyin((void *)args->arg, &lios2, sizeof(lios2)); + if (error) + break; + linux_to_bsd_termios2(&lios2, &bios); + error = (fo_ioctl(fp, TIOCSETAW, (caddr_t)&bios, td->td_ucred, + td)); + break; + + case LINUX_TCSETSF2: + error = copyin((void *)args->arg, &lios2, sizeof(lios2)); + if (error) + break; + linux_to_bsd_termios2(&lios2, &bios); + error = (fo_ioctl(fp, TIOCSETAF, (caddr_t)&bios, td->td_ucred, + td)); + break; + case LINUX_TIOCGPTN: { int nb; diff --git a/sys/compat/linux/linux_ioctl.h b/sys/compat/linux/linux_ioctl.h index 8345b7e4b719..d01a30538981 100644 --- a/sys/compat/linux/linux_ioctl.h +++ b/sys/compat/linux/linux_ioctl.h @@ -383,6 +383,11 @@ #define LINUX_TIOCSBRK 0x5427 #define LINUX_TIOCCBRK 0x5428 +#define LINUX_TCGETS2 0x542A +#define LINUX_TCSETS2 0x542B +#define LINUX_TCSETSW2 0x542C +#define LINUX_TCSETSF2 0x542D + #define LINUX_TIOCGPTN 0x5430 #define LINUX_TIOCSPTLCK 0x5431 @@ -501,6 +506,7 @@ #define LINUX_FF1 0x0008000 #define LINUX_CBAUD 0x0000100f +#define LINUX_CIBAUD (LINUX_CBAUD << LINUX_IBSHIFT) #define LINUX_B0 0x00000000 #define LINUX_B50 0x00000001 @@ -537,8 +543,12 @@ #define LINUX_HUPCL 0x00000400 #define LINUX_CLOCAL 0x00000800 +#define LINUX_BOTHER 0x00001000 + #define LINUX_CRTSCTS 0x80000000 +#define LINUX_IBSHIFT 16 + /* Linux c_lflag masks */ #define LINUX_ISIG 0x00000001 #define LINUX_ICANON 0x00000002