Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/usb In the HUP-wait path in ucomopen():
details: https://anonhg.NetBSD.org/src/rev/c733a5456f90
branches: trunk
changeset: 373825:c733a5456f90
user: thorpej <thorpej%NetBSD.org@localhost>
date: Sun Mar 05 13:49:12 2023 +0000
description:
In the HUP-wait path in ucomopen():
- Use cv_timedwait() rather than cv_timedwait_sig(); the wait here is
bounded (and fairly short besides) and seems appropriate to treat like
other uninterruptible waits. The behavior is now consistent with com(4)
in this regard.
- Map EWOULDBLOCK return from cv_timedwait() to 0, as the successful passage
of time is not an error in this case.
- If the HUP-wait time has passed, clear the HUP-wait timestamp.
kern/57259 (although insufficient -- another change to vfs_syscalls.c
is required)
diffstat:
sys/dev/usb/ucom.c | 11 ++++++++---
1 files changed, 8 insertions(+), 3 deletions(-)
diffs (36 lines):
diff -r f5ac0ce95f49 -r c733a5456f90 sys/dev/usb/ucom.c
--- a/sys/dev/usb/ucom.c Sat Mar 04 21:15:30 2023 +0000
+++ b/sys/dev/usb/ucom.c Sun Mar 05 13:49:12 2023 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ucom.c,v 1.136 2023/02/17 23:44:18 riastradh Exp $ */
+/* $NetBSD: ucom.c,v 1.137 2023/03/05 13:49:12 thorpej Exp $ */
/*
* Copyright (c) 1998, 2000 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ucom.c,v 1.136 2023/02/17 23:44:18 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ucom.c,v 1.137 2023/03/05 13:49:12 thorpej Exp $");
#ifdef _KERNEL_OPT
#include "opt_usb.h"
@@ -552,11 +552,16 @@
ms = MIN(INT_MAX - 1000, delta.tv_sec*1000);
ms += howmany(delta.tv_usec, 1000);
ticks = MAX(1, MIN(INT_MAX, mstohz(ms)));
- error = cv_timedwait_sig(&sc->sc_statecv, &sc->sc_lock,
+ error = cv_timedwait(&sc->sc_statecv, &sc->sc_lock,
ticks);
mutex_exit(&sc->sc_lock);
+ /* The successful passage of time is not an error. */
+ if (error == EWOULDBLOCK) {
+ error = 0;
+ }
return error ? error : ERESTART;
}
+ timerclear(&sc->sc_hup_time);
}
/*
Home |
Main Index |
Thread Index |
Old Index