Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys Make comments and code match reality; there are 4 reserv...
details: https://anonhg.NetBSD.org/src/rev/85e35fec99a4
branches: trunk
changeset: 343774:85e35fec99a4
user: christos <christos%NetBSD.org@localhost>
date: Fri Feb 26 17:08:58 2016 +0000
description:
Make comments and code match reality; there are 4 reserved timers.
diffstat:
sys/kern/kern_time.c | 12 ++++++------
sys/sys/timevar.h | 4 +++-
2 files changed, 9 insertions(+), 7 deletions(-)
diffs (72 lines):
diff -r ab1d1fa6aa69 -r 85e35fec99a4 sys/kern/kern_time.c
--- a/sys/kern/kern_time.c Fri Feb 26 16:28:14 2016 +0000
+++ b/sys/kern/kern_time.c Fri Feb 26 17:08:58 2016 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: kern_time.c,v 1.182 2015/10/06 15:03:34 christos Exp $ */
+/* $NetBSD: kern_time.c,v 1.183 2016/02/26 17:08:58 christos Exp $ */
/*-
* Copyright (c) 2000, 2004, 2005, 2007, 2008, 2009 The NetBSD Foundation, Inc.
@@ -61,7 +61,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_time.c,v 1.182 2015/10/06 15:03:34 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_time.c,v 1.183 2016/02/26 17:08:58 christos Exp $");
#include <sys/param.h>
#include <sys/resourcevar.h>
@@ -512,7 +512,7 @@
*
* All timers are kept in an array pointed to by p_timers, which is
* allocated on demand - many processes don't use timers at all. The
- * first three elements in this array are reserved for the BSD timers:
+ * first four elements in this array are reserved for the BSD timers:
* element 0 is ITIMER_REAL, element 1 is ITIMER_VIRTUAL, element
* 2 is ITIMER_PROF, and element 3 is ITIMER_MONOTONIC. The rest may be
* allocated by the timer_create() syscall.
@@ -578,7 +578,7 @@
/* Find a free timer slot, skipping those reserved for setitimer(). */
mutex_spin_enter(&timer_lock);
- for (timerid = 3; timerid < TIMER_MAX; timerid++)
+ for (timerid = TIMER_MIN; timerid < TIMER_MAX; timerid++)
if (pts->pts_timers[timerid] == NULL)
break;
if (timerid == TIMER_MAX) {
@@ -1258,7 +1258,7 @@
&ptn->pt_time.it_value);
LIST_INSERT_HEAD(&pts->pts_prof, ptn, pt_list);
}
- i = 3;
+ i = TIMER_MIN;
}
for ( ; i < TIMER_MAX; i++) {
if (pts->pts_timers[i] != NULL) {
@@ -1267,7 +1267,7 @@
}
}
if (pts->pts_timers[0] == NULL && pts->pts_timers[1] == NULL &&
- pts->pts_timers[2] == NULL) {
+ pts->pts_timers[2] == NULL && pts->pts_timers[3] == NULL) {
p->p_timers = NULL;
mutex_spin_exit(&timer_lock);
pool_put(&ptimers_pool, pts);
diff -r ab1d1fa6aa69 -r 85e35fec99a4 sys/sys/timevar.h
--- a/sys/sys/timevar.h Fri Feb 26 16:28:14 2016 +0000
+++ b/sys/sys/timevar.h Fri Feb 26 17:08:58 2016 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: timevar.h,v 1.34 2015/08/07 08:11:33 ozaki-r Exp $ */
+/* $NetBSD: timevar.h,v 1.35 2016/02/26 17:08:58 christos Exp $ */
/*
* Copyright (c) 2005, 2008 The NetBSD Foundation.
@@ -92,6 +92,8 @@
#define pt_list pt_data.pt_nonreal.pt_list
#define pt_active pt_data.pt_nonreal.pt_active
+#define TIMER_MIN 4 /* [0..3] are reserved for setitimer(2) */
+ /* REAL=0,VIRTUAL=1,PROF=2,MONOTONIC=3 */
#define TIMER_MAX 32 /* See ptimers->pts_fired if you enlarge this */
#define TIMERS_ALL 0
#define TIMERS_POSIX 1
Home |
Main Index |
Thread Index |
Old Index