summaryrefslogtreecommitdiff
path: root/emulators
diff options
context:
space:
mode:
authorMike Silbersack <silby@FreeBSD.org>2004-02-24 23:07:48 +0000
committerMike Silbersack <silby@FreeBSD.org>2004-02-24 23:07:48 +0000
commitf1d3004b0dab63b23729c6355da0c7caba60bf1a (patch)
tree5a95c468de7929cd95c8faf321746096368d7390 /emulators
parentUpdate to 1.4.1 release. (diff)
Update the rtc driver once again. As of this revision, I believe that
the linux rtc device is being emulated as accurately as possible, at least in terms of its behavior. Further improvements to its accuracy will require much more precise measurement. Device cloning is not yet implemented.
Notes
Notes: svn path=/head/; revision=102012
Diffstat (limited to 'emulators')
-rw-r--r--emulators/rtc/Makefile2
-rw-r--r--emulators/rtc/files/rtc.c18
2 files changed, 14 insertions, 6 deletions
diff --git a/emulators/rtc/Makefile b/emulators/rtc/Makefile
index 571f4f8b0b9c..980da696517f 100644
--- a/emulators/rtc/Makefile
+++ b/emulators/rtc/Makefile
@@ -6,7 +6,7 @@
#
PORTNAME= rtc
-PORTVERSION= 2003.01.28.1
+PORTVERSION= 2004.02.24.1
PORTREVISION= 1
CATEGORIES= emulators linux
MASTER_SITES= # none
diff --git a/emulators/rtc/files/rtc.c b/emulators/rtc/files/rtc.c
index 5bf3cd9ff59d..9b22c636568c 100644
--- a/emulators/rtc/files/rtc.c
+++ b/emulators/rtc/files/rtc.c
@@ -283,7 +283,6 @@ rtc_poll(dev_t dev, int events, struct proc *p)
if (events) {
DLog(Linfo, "Delay for %d usec", delay);
if (sc->var.woken) {
- sc->var.woken = 0;
revents = events;
} else {
selrecord(p, &sc->var.sip);
@@ -296,7 +295,7 @@ int
rtc_read(dev_t dev, struct uio *uio, int flags __unused)
{
struct rtc_softc *sc = (struct rtc_softc *) dev->si_drv1;
- int error;
+ int error = 0;
if (!sc->var.flags.enabled)
return 0;
@@ -305,9 +304,18 @@ rtc_read(dev_t dev, struct uio *uio, int flags __unused)
return EAGAIN;
DLog(Linfo, "Delay for %d usec", delay);
- error = tsleep(&sc->var.rtc_ident, PCATCH, "rtc rd", hz * 10);
+ if (sc->var.woken == 0)
+ tsleep(&sc->var.rtc_ident, PCATCH, "rtc rd", hz * 10);
+#if 0
+ if (sc->var.woken > 1)
+ printf("woken: %d\n", sc->var.woken);
+#endif
+
+ if (uio->uio_resid == sizeof(int)) {
+ error = uiomove(&sc->var.woken, sizeof(int), uio);
+ }
sc->var.woken = 0;
- return 0;
+ return error;
}
/* -=-=-=-=-=-=-=-=-= module load/unload stuff -=-=-=-=-=-=-=-=-= */
@@ -380,7 +388,7 @@ rtc_callback(void *xtp)
if (callout_pending(&sc->var.rtc_handle) || !callout_active(&sc->var.rtc_handle))
return;
/* Wakeup sleepers */
- sc->var.woken = 1;
+ sc->var.woken++;
selwakeup(&sc->var.sip);
wakeup(&sc->var.rtc_ident);