Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src GSoC 2016: Charles Cui: Add timer related macros
details: https://anonhg.NetBSD.org/src/rev/3471c96b0ae8
branches: trunk
changeset: 345847:3471c96b0ae8
user: christos <christos%NetBSD.org@localhost>
date: Fri Jun 10 23:29:20 2016 +0000
description:
GSoC 2016: Charles Cui: Add timer related macros
_POSIX_CPUTIME
_POSIX_THREAD_CPUTIME
_POSIX_DELAYTIMER_MAX
diffstat:
include/limits.h | 5 ++++-
lib/libc/gen/sysconf.3 | 11 ++++++++++-
lib/libc/gen/sysconf.c | 10 ++++++++--
sys/kern/kern_time.c | 7 +++++--
sys/sys/unistd.h | 5 ++++-
5 files changed, 31 insertions(+), 7 deletions(-)
diffs (129 lines):
diff -r 3d5a82087b71 -r 3471c96b0ae8 include/limits.h
--- a/include/limits.h Fri Jun 10 23:26:43 2016 +0000
+++ b/include/limits.h Fri Jun 10 23:29:20 2016 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: limits.h,v 1.37 2016/06/10 23:24:33 christos Exp $ */
+/* $NetBSD: limits.h,v 1.38 2016/06/10 23:29:20 christos Exp $ */
/*
* Copyright (c) 1988, 1993
@@ -94,6 +94,9 @@
#define _POSIX_TIMER_MAX 32
#define _POSIX_SEM_NSEMS_MAX 256
+#define _POSIX_CPUTIME 200112L
+#define _POSIX_THREAD_CPUTIME 200112L
+#define _POSIX_DELAYTIMER_MAX 32
#define _POSIX_TTY_NAME_MAX 9
#define _POSIX_TZNAME_MAX 6
diff -r 3d5a82087b71 -r 3471c96b0ae8 lib/libc/gen/sysconf.3
--- a/lib/libc/gen/sysconf.3 Fri Jun 10 23:26:43 2016 +0000
+++ b/lib/libc/gen/sysconf.3 Fri Jun 10 23:29:20 2016 +0000
@@ -1,4 +1,4 @@
-.\" $NetBSD: sysconf.3,v 1.47 2016/06/10 23:26:43 wiz Exp $
+.\" $NetBSD: sysconf.3,v 1.48 2016/06/10 23:29:20 christos Exp $
.\"
.\" Copyright (c) 1993
.\" The Regents of the University of California. All rights reserved.
@@ -185,6 +185,15 @@
Timers
option to which the system attempts to conform,
otherwise \-1.
+.It Li _SC_CPUTIME
+The clockID CLOCK_PROCESS_CPUTIME_ID is supported,
+otherwise \-1.
+.It Li _SC_THREAD_CPUTIME
+The clockID CLOCK_THREAD_CPUTIME_ID is supported,
+otherwise \-1.
+.It Li _SC_DELAYTIMER_MAX
+The maximum number of overrun for a specific timer,
+otherwise \-1.
.It Li _SC_TZNAME_MAX
The minimum maximum number of types supported for the name of a
timezone.
diff -r 3d5a82087b71 -r 3471c96b0ae8 lib/libc/gen/sysconf.c
--- a/lib/libc/gen/sysconf.c Fri Jun 10 23:26:43 2016 +0000
+++ b/lib/libc/gen/sysconf.c Fri Jun 10 23:29:20 2016 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: sysconf.c,v 1.38 2016/06/10 23:24:33 christos Exp $ */
+/* $NetBSD: sysconf.c,v 1.39 2016/06/10 23:29:20 christos Exp $ */
/*-
* Copyright (c) 1993
@@ -37,7 +37,7 @@
#if 0
static char sccsid[] = "@(#)sysconf.c 8.2 (Berkeley) 3/20/94";
#else
-__RCSID("$NetBSD: sysconf.c,v 1.38 2016/06/10 23:24:33 christos Exp $");
+__RCSID("$NetBSD: sysconf.c,v 1.39 2016/06/10 23:29:20 christos Exp $");
#endif
#endif /* LIBC_SCCS and not lint */
@@ -422,6 +422,12 @@
return _POSIX_TIMER_MAX;
case _SC_SEM_NSEMS_MAX:
return _POSIX_SEM_NSEMS_MAX;
+ case _SC_CPUTIME:
+ return _POSIX_CPUTIME;
+ case _SC_THREAD_CPUTIME:
+ return _POSIX_THREAD_CPUTIME;
+ case _SC_DELAYTIMER_MAX:
+ return _POSIX_DELAYTIMER_MAX;
default:
errno = EINVAL;
return (-1);
diff -r 3d5a82087b71 -r 3471c96b0ae8 sys/kern/kern_time.c
--- a/sys/kern/kern_time.c Fri Jun 10 23:26:43 2016 +0000
+++ b/sys/kern/kern_time.c Fri Jun 10 23:29:20 2016 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: kern_time.c,v 1.186 2016/04/23 23:08:26 christos Exp $ */
+/* $NetBSD: kern_time.c,v 1.187 2016/06/10 23:29:20 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.186 2016/04/23 23:08:26 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_time.c,v 1.187 2016/06/10 23:29:20 christos Exp $");
#include <sys/param.h>
#include <sys/resourcevar.h>
@@ -97,6 +97,7 @@
CTASSERT(ITIMER_PROF == CLOCK_PROF);
CTASSERT(ITIMER_MONOTONIC == CLOCK_MONOTONIC);
+#define DELAYTIMER_MAX 32
/*
* Initialize timekeeping.
@@ -980,6 +981,8 @@
return (EINVAL);
}
*retval = pt->pt_poverruns;
+ if (*retval >= DELAYTIMER_MAX)
+ *retval = DELAYTIMER_MAX;
mutex_spin_exit(&timer_lock);
return (0);
diff -r 3d5a82087b71 -r 3471c96b0ae8 sys/sys/unistd.h
--- a/sys/sys/unistd.h Fri Jun 10 23:26:43 2016 +0000
+++ b/sys/sys/unistd.h Fri Jun 10 23:29:20 2016 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: unistd.h,v 1.57 2016/06/10 23:24:33 christos Exp $ */
+/* $NetBSD: unistd.h,v 1.58 2016/06/10 23:29:20 christos Exp $ */
/*
* Copyright (c) 1989, 1993
@@ -309,6 +309,9 @@
#define _SC_TIMER_MAX 88
#define _SC_SEM_NSEMS_MAX 89
+#define _SC_CPUTIME 90
+#define _SC_THREAD_CPUTIME 91
+#define _SC_DELAYTIMER_MAX 92
/* Extensions found in Solaris and Linux. */
#define _SC_PHYS_PAGES 121
Home |
Main Index |
Thread Index |
Old Index