This is the mail archive of the
newlib@sourceware.org
mailing list for the newlib project.
Re: [PATCH] CPU-time clocks
- From: "Yaakov (Cygwin/X)" <yselkowitz at users dot sourceforge dot net>
- To: newlib <newlib at sources dot redhat dot com>
- Date: Sun, 15 May 2011 14:35:21 -0500
- Subject: Re: [PATCH] CPU-time clocks
- References: <1305485360.6124.38.camel@YAAKOV04>
On Sun, 2011-05-15 at 13:49 -0500, Yaakov Selkowitz wrote:
> I have a patch pending for Cygwin to support POSIX CPU-time clocks, but
> newlib needs to be patched first.
>
> Unfortunately, newlib's clock ID definitions are not POSIX-compliant;
> the names are missing the ending "_ID". Fixing this will affect RTEMS,
> as they have been using the misnamed definitions for some time. I have
> a patch for RTEMS' CVS HEAD, but the ramifications may be larger than
> that, I don't know.
>
> Patch attached.
Corinna just changed one of the affected files; regenerated patch
attached.
Yaakov
Cygwin/X
2011-05-15 Yaakov Selkowitz <yselkowitz@...>
* libc/include/time.h (CLOCK_PROCESS_CPUTIME_ID): Rename from
CLOCK_PROCESS_CPUTIME.
(CLOCK_THREAD_CPUTIME_ID): Rename from CLOCK_THREAD_CPUTIME.
* libc/include/sys/features.h [__CYGWIN__] (_POSIX_CPUTIME): Define.
(_POSIX_THREAD_CPUTIME): Define.
Index: libc/include/time.h
===================================================================
RCS file: /cvs/src/src/newlib/libc/include/time.h,v
retrieving revision 1.19
diff -u -r1.19 time.h
--- libc/include/time.h 16 Oct 2008 21:53:58 -0000 1.19
+++ libc/include/time.h 15 May 2011 19:28:27 -0000
@@ -212,7 +212,7 @@
the identifier of the CPU_time clock associated with the PROCESS
making the function call. */
-#define CLOCK_PROCESS_CPUTIME (clockid_t)2
+#define CLOCK_PROCESS_CPUTIME_ID (clockid_t)2
#endif
@@ -222,7 +222,7 @@
the identifier of the CPU_time clock associated with the THREAD
making the function call. */
-#define CLOCK_THREAD_CPUTIME (clockid_t)3
+#define CLOCK_THREAD_CPUTIME_ID (clockid_t)3
#endif
Index: libc/include/sys/features.h
===================================================================
RCS file: /cvs/src/src/newlib/libc/include/sys/features.h,v
retrieving revision 1.25
diff -u -r1.25 features.h
--- libc/include/sys/features.h 15 May 2011 18:50:52 -0000 1.25
+++ libc/include/sys/features.h 15 May 2011 19:28:27 -0000
@@ -103,7 +103,7 @@
/* #define _POSIX_BARRIERS -1 */
#define _POSIX_CHOWN_RESTRICTED 1
/* #define _POSIX_CLOCK_SELECTION -1 */
-/* #define _POSIX_CPUTIME -1 */
+#define _POSIX_CPUTIME 200112L
#define _POSIX_FSYNC 200112L
#define _POSIX_IPV6 200112L
#define _POSIX_JOB_CONTROL 1
@@ -130,7 +130,7 @@
#define _POSIX_SYNCHRONIZED_IO 200112L
#define _POSIX_THREAD_ATTR_STACKADDR 200112L
#define _POSIX_THREAD_ATTR_STACKSIZE 200112L
-/* #define _POSIX_THREAD_CPUTIME -1 */
+#define _POSIX_THREAD_CPUTIME 200112L
/* #define _POSIX_THREAD_PRIO_INHERIT -1 */
/* #define _POSIX_THREAD_PRIO_PROTECT -1 */
#define _POSIX_THREAD_PRIORITY_SCHEDULING 200112L