Date: Sun, 2 Oct 2022 00:52:13 GMT From: Konstantin Belousov <kib@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org Subject: git: 40860e6bf222 - stable/13 - snp(4): properly report detached/revoked ttys Message-ID: <202210020052.2920qDPC094411@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=40860e6bf2221efb3840b380d6b5d6f3f768a633 commit 40860e6bf2221efb3840b380d6b5d6f3f768a633 Author: Konstantin Belousov <kib@FreeBSD.org> AuthorDate: 2022-09-24 20:23:31 +0000 Commit: Konstantin Belousov <kib@FreeBSD.org> CommitDate: 2022-10-02 00:51:47 +0000 snp(4): properly report detached/revoked ttys PR: 257964 (cherry picked from commit bb4be76cf358246ef04ea8a67f38ff2a25b6c580) --- share/man/man4/snp.4 | 8 ++------ sys/dev/snp/snp.c | 7 +++++-- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/share/man/man4/snp.4 b/share/man/man4/snp.4 index ce0ef66c5721..524e779ce081 100644 --- a/share/man/man4/snp.4 +++ b/share/man/man4/snp.4 @@ -1,7 +1,7 @@ .\" .\" $FreeBSD$ .\" -.Dd November 5, 2008 +.Dd September 24, 2022 .Dt SNP 4 .Os .Sh NAME @@ -58,8 +58,6 @@ ioctl returns a positive value equal to the number of characters in a read buffer. Special values defined are: .Bl -tag -width ".Dv SNP_TTYCLOSE" -.It Dv SNP_OFLOW -device overflow occurred, device detached. .It Dv SNP_TTYCLOSE tty not attached. .It Dv SNP_DETACH @@ -92,8 +90,6 @@ were based on code written by .Sh BUGS This version of .Nm -does not return proper error codes when calling -.Dv FIONREAD . -It also does not allow +does not allow .Dv SNPSTTY to detach itself from the TTY. diff --git a/sys/dev/snp/snp.c b/sys/dev/snp/snp.c index 64e2d0f64537..3bcd2263809b 100644 --- a/sys/dev/snp/snp.c +++ b/sys/dev/snp/snp.c @@ -289,10 +289,13 @@ snp_ioctl(struct cdev *dev, u_long cmd, caddr_t data, int flags, tp = ss->snp_tty; if (tp != NULL) { tty_lock(tp); - *(int *)data = ttyoutq_bytesused(&ss->snp_outq); + if (tty_gone(tp)) + *(int *)data = SNP_TTYCLOSE; + else + *(int *)data = ttyoutq_bytesused(&ss->snp_outq); tty_unlock(tp); } else { - *(int *)data = 0; + *(int *)data = SNP_DETACH; } return (0); default:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202210020052.2920qDPC094411>