Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/rump Make rumpuser_cv_timedwait take two int64's instead...
details: https://anonhg.NetBSD.org/src/rev/18c5fd865402
branches: trunk
changeset: 748952:18c5fd865402
user: pooka <pooka%NetBSD.org@localhost>
date: Wed Nov 11 16:46:50 2009 +0000
description:
Make rumpuser_cv_timedwait take two int64's instead timespec to
uncouple it from the timespec layout. Also, change return value
to zero for "timeout didn't expire" and non-zero for "timeout
expired". This decouples the interface from errno assignments.
diffstat:
sys/rump/include/rump/rumpuser.h | 4 ++--
sys/rump/librump/rumpkern/intr.c | 6 +++---
sys/rump/librump/rumpkern/locks.c | 10 +++++++---
sys/rump/librump/rumpuser/rumpuser_pth.c | 16 +++++++++-------
4 files changed, 21 insertions(+), 15 deletions(-)
diffs (123 lines):
diff -r 6a47e03d257e -r 18c5fd865402 sys/rump/include/rump/rumpuser.h
--- a/sys/rump/include/rump/rumpuser.h Wed Nov 11 16:35:45 2009 +0000
+++ b/sys/rump/include/rump/rumpuser.h Wed Nov 11 16:46:50 2009 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: rumpuser.h,v 1.31 2009/10/24 11:36:59 pooka Exp $ */
+/* $NetBSD: rumpuser.h,v 1.32 2009/11/11 16:46:50 pooka Exp $ */
/*
* Copyright (c) 2007 Antti Kantee. All Rights Reserved.
@@ -142,7 +142,7 @@
void rumpuser_cv_wait(struct rumpuser_cv *, struct rumpuser_mtx *);
void rumpuser_cv_wait_nowrap(struct rumpuser_cv *, struct rumpuser_mtx *);
int rumpuser_cv_timedwait(struct rumpuser_cv *, struct rumpuser_mtx *,
- struct timespec *);
+ int64_t, int64_t);
void rumpuser_cv_signal(struct rumpuser_cv *);
void rumpuser_cv_broadcast(struct rumpuser_cv *);
int rumpuser_cv_has_waiters(struct rumpuser_cv *);
diff -r 6a47e03d257e -r 18c5fd865402 sys/rump/librump/rumpkern/intr.c
--- a/sys/rump/librump/rumpkern/intr.c Wed Nov 11 16:35:45 2009 +0000
+++ b/sys/rump/librump/rumpkern/intr.c Wed Nov 11 16:46:50 2009 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: intr.c,v 1.20 2009/11/09 19:16:18 pooka Exp $ */
+/* $NetBSD: intr.c,v 1.21 2009/11/11 16:46:50 pooka Exp $ */
/*
* Copyright (c) 2008 Antti Kantee. All Rights Reserved.
@@ -26,7 +26,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: intr.c,v 1.20 2009/11/09 19:16:18 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: intr.c,v 1.21 2009/11/11 16:46:50 pooka Exp $");
#include <sys/param.h>
#include <sys/cpu.h>
@@ -124,7 +124,7 @@
/* wait until the next tick. XXX: what if the clock changes? */
while (rumpuser_cv_timedwait(clockcv, clockmtx,
- &curtime) != EWOULDBLOCK)
+ curtime.tv_sec, curtime.tv_nsec) == 0)
continue;
clkgen++;
diff -r 6a47e03d257e -r 18c5fd865402 sys/rump/librump/rumpkern/locks.c
--- a/sys/rump/librump/rumpkern/locks.c Wed Nov 11 16:35:45 2009 +0000
+++ b/sys/rump/librump/rumpkern/locks.c Wed Nov 11 16:46:50 2009 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: locks.c,v 1.33 2009/11/04 13:32:39 pooka Exp $ */
+/* $NetBSD: locks.c,v 1.34 2009/11/11 16:46:50 pooka Exp $ */
/*
* Copyright (c) 2007, 2008 Antti Kantee. All Rights Reserved.
@@ -29,7 +29,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: locks.c,v 1.33 2009/11/04 13:32:39 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: locks.c,v 1.34 2009/11/11 16:46:50 pooka Exp $");
#include <sys/param.h>
#include <sys/kmem.h>
@@ -236,7 +236,11 @@
cv_wait(cv, mtx);
return 0;
} else {
- return rumpuser_cv_timedwait(RUMPCV(cv), RUMPMTX(mtx), &ts);
+ if (rumpuser_cv_timedwait(RUMPCV(cv), RUMPMTX(mtx),
+ ts.tv_sec, ts.tv_nsec))
+ return EWOULDBLOCK;
+ else
+ return 0;
}
}
diff -r 6a47e03d257e -r 18c5fd865402 sys/rump/librump/rumpuser/rumpuser_pth.c
--- a/sys/rump/librump/rumpuser/rumpuser_pth.c Wed Nov 11 16:35:45 2009 +0000
+++ b/sys/rump/librump/rumpuser/rumpuser_pth.c Wed Nov 11 16:46:50 2009 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: rumpuser_pth.c,v 1.37 2009/11/09 18:00:26 pooka Exp $ */
+/* $NetBSD: rumpuser_pth.c,v 1.38 2009/11/11 16:46:50 pooka Exp $ */
/*
* Copyright (c) 2007 Antti Kantee. All Rights Reserved.
@@ -30,7 +30,7 @@
#include <sys/cdefs.h>
#if !defined(lint)
-__RCSID("$NetBSD: rumpuser_pth.c,v 1.37 2009/11/09 18:00:26 pooka Exp $");
+__RCSID("$NetBSD: rumpuser_pth.c,v 1.38 2009/11/11 16:46:50 pooka Exp $");
#endif /* !lint */
#ifdef __linux__
@@ -473,21 +473,23 @@
int
rumpuser_cv_timedwait(struct rumpuser_cv *cv, struct rumpuser_mtx *mtx,
- struct timespec *ts)
+ int64_t sec, int64_t nsec)
{
+ struct timespec ts;
int rv;
+ /* LINTED */
+ ts.tv_sec = sec; ts.tv_nsec = nsec;
+
cv->nwaiters++;
mtxexit(mtx);
- KLOCK_WRAP(rv = pthread_cond_timedwait(&cv->pthcv, &mtx->pthmtx, ts));
+ KLOCK_WRAP(rv = pthread_cond_timedwait(&cv->pthcv, &mtx->pthmtx, &ts));
mtxenter(mtx);
cv->nwaiters--;
if (rv != 0 && rv != ETIMEDOUT)
abort();
- if (rv == ETIMEDOUT)
- rv = EWOULDBLOCK;
- return rv;
+ return rv == ETIMEDOUT;
}
void
Home |
Main Index |
Thread Index |
Old Index