This is the mail archive of the newlib@sourceware.org mailing list for the newlib project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] CPU-time clocks


On May 15 14:35, Yaakov (Cygwin/X) wrote:
> 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.

Thanks.  Maybe we should just define CLOCK_PROCESS_CPUTIME and
CLOCK_THREAD_CPUTIME for rtems as well.  So the rtems maintainers
can decide when this can go away:

> 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

  #ifdef __rtems__
  /* Non-POSIX definitions kept for backward compatibility. */
  #define CLOCK_PROCESS_CPUTIME CLOCK_PROCESS_CPUTIME_ID
  #define CLOCK_THREAD_CPUTIME CLOCK_THREAD_CPUTIME_ID
  #endif


Corinna

-- 
Corinna Vinschen
Cygwin Project Co-Leader
Red Hat


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]