Module Name: src Committed By: riastradh Date: Fri Feb 17 23:13:01 UTC 2023
Modified Files: src/sys/kern: tty.c Log Message: ttycheckoutq(9): wait is always 0. Assert it; prune dead branches. There appear to have been no callers with wait=1 since NetBSD 1.0 from a cursory search. Let's nix the parameter altogether on the next kernel revbump. This logic is probably broken anyway in the presence of ttycancel, which is necessary for, e.g., yanking USB serial adapters. To generate a diff of this commit: cvs rdiff -u -r1.307 -r1.308 src/sys/kern/tty.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/kern/tty.c diff -u src/sys/kern/tty.c:1.307 src/sys/kern/tty.c:1.308 --- src/sys/kern/tty.c:1.307 Wed Oct 26 23:41:49 2022 +++ src/sys/kern/tty.c Fri Feb 17 23:13:01 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: tty.c,v 1.307 2022/10/26 23:41:49 riastradh Exp $ */ +/* $NetBSD: tty.c,v 1.308 2023/02/17 23:13:01 riastradh Exp $ */ /*- * Copyright (c) 2008, 2020 The NetBSD Foundation, Inc. @@ -63,7 +63,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: tty.c,v 1.307 2022/10/26 23:41:49 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: tty.c,v 1.308 2023/02/17 23:13:01 riastradh Exp $"); #ifdef _KERNEL_OPT #include "opt_compat_netbsd.h" @@ -2195,19 +2195,17 @@ ttread(struct tty *tp, struct uio *uio, static int ttycheckoutq_wlock(struct tty *tp, int wait) { - int hiwat, error; + int hiwat; KASSERT(mutex_owned(&tty_lock)); + KASSERT(wait == 0); + hiwat = tp->t_hiwat; if (tp->t_outq.c_cc > hiwat + 200) - while (tp->t_outq.c_cc > hiwat) { + if (tp->t_outq.c_cc > hiwat) { ttstart(tp); - if (wait == 0) - return (0); - error = ttysleep(tp, &tp->t_outcv, true, hz); - if (error == EINTR) - wait = 0; + return (0); } return (1);