clock() & CLK_TCK broken

Joel Sherrill joel.sherrill at OARcorp.com
Mon Nov 27 13:57:13 UTC 2000


Rosimildo da Silva wrote:
> 
> I have tried to use clock() routine that is implemented in RTEMS,
> but CLK_TCK is not supported yet. This basicly makes
> clock() useless until CLK_TCK is ready. :-)
> 
> CLK_TCK  --> sysconf( _SC_CLK_TCK ) --> POSIX_NOT_IMPLEMENTED()

Try this out for size.  It adds a couple of easy ones.  sysconf()
is a catchall.  If anyone sees any other useful/meaningful cases, 
pass them along.

Index: sysconf.c
===================================================================
RCS file: /usr1/CVS/rtems/c/src/exec/posix/src/sysconf.c,v
retrieving revision 1.2
diff -u -r1.2 sysconf.c
--- sysconf.c	1999/11/15 22:19:51	1.2
+++ sysconf.c	2000/11/27 14:07:14
@@ -6,6 +6,7 @@
 #include <unistd.h>
 
 #include <rtems/system.h>
+#include <rtems/score/tod.h>
 
 /*PAGE
  *
@@ -16,5 +17,19 @@
   int name
 )
 {
+
+  switch (name) {
+    case _SC_CLK_TCK:
+      return _TOD_Ticks_per_second;
+
+    case _SC_OPEN_MAX: {
+        extern unsigned32 rtems_libio_number_iops;
+        return rtems_libio_number_iops;
+      }
+
+    default:
+      break;
+  }
+
   return POSIX_NOT_IMPLEMENTED();
 }

> 
> --
> Rosimildo da Silva            rdasilva at connectel.com
> ConnectTel, Inc.              Austin, TX -- USA
> Phone : 512-338-1111          Fax : 512-918-0449
> Company Page:  http://www.connecttel.com
> Home Page:     http://members.nbci.com/rosimildo/

-- 
Joel Sherrill, Ph.D.             Director of Research & Development
joel at OARcorp.com                 On-Line Applications Research
Ask me about RTEMS: a free RTOS  Huntsville AL 35805
   Support Available             (256) 722-9985



More information about the users mailing list