This is the mail archive of the ecos-discuss@sourceware.org mailing list for the eCos 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: ecos and gettimeofday()


Hi,

On Thursday 20 October 2005 19:48, Nick Garnett wrote:
> Andrew Lunn <andrew@lunn.ch> writes:
> > Hi Nick
> >
> > Thanks for the explanation.
> >
> > What i don't understand now is why only the fileio package uses these
> > functions. I would of expected at least the functions in the POSIX
> > package to also use these.
> >
> > What am i missing?
>
> Many of the POSIX package calls are wrappers for straight kernel
> calls, or are otherwise immune to the effects of having a signal
> handler run.

attached is a new version of the patch, now including even more stuff:

-gettimeofday() in time.cxx (CYGPKG_POSIX_CLOCKS)
-moved cyg_posix_function_start() and _finish() from misc.cxx to pthread.cxx, 
since it seems pthreads and posix signals are the only two users of ASR
-move pthread mutexes into its own component
-make mqueue and pthreads require the mutex component
-move mqueue.cxx into its own component
-use CYG_POSIX_FUNCTION_START only #ifdef CYGPKG_POSIX_PTHREADS instead of 
CYGPKG_POSIX

I hope I got things right.
I didn't change the snmp and FreeBSD stacks so that they use the new 
gettimeofday() function. I would prefer if somebody who actually compiles 
projects which use these packages would do this.

Bye
Alex
-- 
Work: alexander.neundorf@jenoptik.com - http://www.jenoptik-los.de
Home: neundorf@kde.org                - http://www.kde.org
      alex@neundorf.net               - http://www.neundorf.net
diff --exclude=CVS -rbupN packages.unmodified/compat/posix/current/ChangeLog packages/compat/posix/current/ChangeLog
--- packages.unmodified/compat/posix/current/ChangeLog	2004-10-04 13:49:19.000000000 +0200
+++ packages/compat/posix/current/ChangeLog	2005-10-19 23:16:26.000000000 +0200
@@ -1,3 +1,10 @@
+2005-10-18  Alexander Neundorf <neundorf@kde.org>
+
+	src/time.cxx: add gettimeofday() implementation
+        cdl/posix.cdl: make some decriptions a bit more verbose.
+        move mutex.cxx into its own component (CYGPKG_POSIX_PTHREAD_MUTEX).
+        move compilation of mqueue.cxx into the CYGPKG_POSIX_MQUEUES component
+
 2004-10-01  Oyvind Harboe  <oyvind.harboe@zylin.com>
 
 	* src/signal.cxx:  place the CYGBLD_ATTRIB_INIT_PRI such that it
diff --exclude=CVS -rbupN packages.unmodified/compat/posix/current/cdl/posix.cdl packages/compat/posix/current/cdl/posix.cdl
--- packages.unmodified/compat/posix/current/cdl/posix.cdl	2003-02-24 15:08:21.000000000 +0100
+++ packages/compat/posix/current/cdl/posix.cdl	2005-10-19 23:44:28.000000000 +0200
@@ -51,7 +51,10 @@
 cdl_package CYGPKG_POSIX {
     display        "POSIX compatibility layer"
     description    "This package enables the POSIX compatibility
-                    layer that implements IEEE 1003.1."
+                    layer that implements IEEE 1003.1.
+                    Without enabling more components of this package 
+                    it provides the sysconf(),
+                    getXXXid() and setXXXid() functions."
     doc            ref/posix-compatibility.html
     include_dir    cyg/posix
     
@@ -73,9 +76,17 @@ cdl_package CYGPKG_POSIX {
     requires       { CYGBLD_ISO_PTHREAD_MUTEX_HEADER == \
                          "<cyg/posix/mutex.h>" }
     
-    compile        mqueue.cxx mutex.cxx misc.cxx
+    compile        misc.cxx
     compile       -library=libextras.a startup.cxx
 
+    cdl_component CYGPKG_POSIX_PTHREAD_MUTEX {
+
+	display          "POSIX pthread mutexes"
+	flavor           bool
+        compile          mutex.cxx
+	default_value    1
+	description      "This component provides support for POSIX pthreads mutexes."
+
     cdl_option _POSIX_THREAD_PRIO_INHERIT {
         display		"POSIX mutex priority inheritance feature test macro"
         flavor        	bool
@@ -95,6 +106,8 @@ cdl_package CYGPKG_POSIX {
                          for supporting priority ceiling protocol in mutexes."
     }
     
+    }
+    
     # ----------------------------------------------------------------
     # Scheduling component
     
@@ -145,11 +158,14 @@ cdl_package CYGPKG_POSIX {
                              "<cyg/posix/time.h>" }
         requires         { CYGBLD_ISO_POSIX_CLOCKS_HEADER == \
                              "<cyg/posix/time.h>" }
+        requires         { CYGBLD_ISO_STRUCTTIMEVAL_HEADER == \
+                             "<cyg/posix/sys/time.h>" }
         requires         CYGPKG_KERNEL
         requires         CYGVAR_KERNEL_COUNTERS_CLOCK
         compile          time.cxx
 	description      "This component provides configuration controls for
-	                  the POSIX clocks."
+	                  the POSIX clocks and the sleep(), nanosleep()
+                          and gettimeofday() functions."
     }
 
     # ----------------------------------------------------------------
@@ -198,11 +214,13 @@ cdl_package CYGPKG_POSIX {
 	display          "POSIX message queues"
 	flavor           bool
 	default_value    1
+        compile          mqueue.cxx
         implements       CYGINT_ISO_MQUEUE
         requires         CYGPKG_KERNEL
         requires         CYGINT_ISO_MALLOC
         requires         CYGINT_ISO_ERRNO
         requires         CYGINT_ISO_STRING_STRFUNCS
+        requires         CYGPKG_POSIX_PTHREAD_MUTEX
 	description      "This component provides configuration controls for
 	                  POSIX message queues."
 
diff --exclude=CVS -rbupN packages.unmodified/compat/posix/current/cdl/pthread.cdl packages/compat/posix/current/cdl/pthread.cdl
--- packages.unmodified/compat/posix/current/cdl/pthread.cdl	2002-05-24 00:59:56.000000000 +0200
+++ packages/compat/posix/current/cdl/pthread.cdl	2005-10-19 21:42:33.000000000 +0200
@@ -55,6 +55,7 @@ cdl_option CYGPKG_POSIX_PTHREAD_REQUIREM
         implements      CYGINT_ISO_PTHREADTYPES
         implements      CYGINT_ISO_PTHREAD_IMPL
 	requires        CYGPKG_POSIX_SCHED
+        requires        CYGPKG_POSIX_PTHREAD_MUTEX
 	requires	CYGSEM_KERNEL_SCHED_TIMESLICE_ENABLE
 	requires	CYGSEM_KERNEL_SCHED_ASR_SUPPORT
 	requires	CYGSEM_KERNEL_SCHED_ASR_GLOBAL
diff --exclude=CVS -rbupN packages.unmodified/compat/posix/current/doc/posix.sgml packages/compat/posix/current/doc/posix.sgml
--- packages.unmodified/compat/posix/current/doc/posix.sgml	2003-02-24 15:08:21.000000000 +0100
+++ packages/compat/posix/current/doc/posix.sgml	2005-10-19 23:20:36.000000000 +0200
@@ -1046,6 +1046,7 @@ int timer&lowbar;settime( timer&lowbar;t
 int timer&lowbar;gettime( timer&lowbar;t timerid, struct itimerspec &ast;value ); 
 int timer&lowbar;getoverrun( timer&lowbar;t timerid ); 
 int nanosleep( const struct timespec &ast;rqtp, struct timespec &ast;rmtp);
+int gettimeofday(struct timeval *tv, struct timezone* tz);
 </screen>
 
 </sect2>
diff --exclude=CVS -rbupN packages.unmodified/compat/posix/current/include/export.h packages/compat/posix/current/include/export.h
--- packages.unmodified/compat/posix/current/include/export.h	2003-03-19 15:17:23.000000000 +0100
+++ packages/compat/posix/current/include/export.h	2005-10-20 18:49:51.000000000 +0200
@@ -78,6 +78,8 @@
 
 #include <sched.h>              // SCHED_*
 
+#ifdef CYGPKG_POSIX_PTHREAD
+
 //=============================================================================
 // POSIX API function management.
 // These macros should be inserted near the start and all returns of
@@ -109,6 +111,8 @@ __externC void cyg_posix_deliver_signals
 #define CYG_POSIX_DELIVER_SIGNALS cyg_posix_deliver_signals
 #endif
 
+#endif //ifdef CYGPKG_POSIX_PTHREAD
+
 //-----------------------------------------------------------------------------
 #endif // ifndef CYGONCE_POSIX_EXPORT_H
 // End of export.h
diff --exclude=CVS -rbupN packages.unmodified/compat/posix/current/include/sys/time.h packages/compat/posix/current/include/sys/time.h
--- packages.unmodified/compat/posix/current/include/sys/time.h	1970-01-01 01:00:00.000000000 +0100
+++ packages/compat/posix/current/include/sys/time.h	2005-10-19 22:54:15.000000000 +0200
@@ -0,0 +1,214 @@
+//==========================================================================
+//
+//      include/sys/time.h
+//
+//      
+//
+//==========================================================================
+//####BSDCOPYRIGHTBEGIN####
+//
+// -------------------------------------------
+//
+// Portions of this software may have been derived from OpenBSD or other sources,
+// and are covered by the appropriate copyright disclaimers included herein.
+//
+// -------------------------------------------
+//
+//####BSDCOPYRIGHTEND####
+//==========================================================================
+//#####DESCRIPTIONBEGIN####
+//
+// Author(s):    gthomas
+// Contributors: gthomas
+// Date:         2000-01-10
+// Purpose:      
+// Description:  
+//              
+//
+//####DESCRIPTIONEND####
+//
+//==========================================================================
+
+
+/*	$OpenBSD: time.h,v 1.9 1999/12/06 19:36:42 aaron Exp $	*/
+/*	$NetBSD: time.h,v 1.18 1996/04/23 10:29:33 mycroft Exp $	*/
+
+/*
+ * Copyright (c) 1982, 1986, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *	This product includes software developed by the University of
+ *	California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)time.h	8.2 (Berkeley) 7/10/94
+ */
+
+#ifndef _SYS_TIME_H_
+#define _SYS_TIME_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <sys/types.h>
+#include <sys/cdefs.h>
+#include <time.h>
+
+/*
+ * Structure returned by gettimeofday(2) system call,
+ * and used in other calls.
+ */
+struct timeval {
+	long	tv_sec;		/* seconds */
+	long	tv_usec;	/* and microseconds */
+};
+
+
+#define	TIMEVAL_TO_TIMESPEC(tv, ts) {					\
+	(ts)->tv_sec = (tv)->tv_sec;					\
+	(ts)->tv_nsec = (tv)->tv_usec * 1000;				\
+}
+#define	TIMESPEC_TO_TIMEVAL(tv, ts) {					\
+	(tv)->tv_sec = (ts)->tv_sec;					\
+	(tv)->tv_usec = (ts)->tv_nsec / 1000;				\
+}
+
+struct timezone {
+	int	tz_minuteswest;	/* minutes west of Greenwich */
+	int	tz_dsttime;	/* type of dst correction */
+};
+
+#define	DST_NONE	0	/* not on dst */
+#define	DST_USA		1	/* USA style dst */
+#define	DST_AUST	2	/* Australian style dst */
+#define	DST_WET		3	/* Western European dst */
+#define	DST_MET		4	/* Middle European dst */
+#define	DST_EET		5	/* Eastern European dst */
+#define	DST_CAN		6	/* Canada */
+
+/* Operations on timevals. */
+#define	timerclear(tvp)		(tvp)->tv_sec = (tvp)->tv_usec = 0
+#define	timerisset(tvp)		((tvp)->tv_sec || (tvp)->tv_usec)
+#define	timercmp(tvp, uvp, cmp)						\
+	(((tvp)->tv_sec == (uvp)->tv_sec) ?				\
+	    ((tvp)->tv_usec cmp (uvp)->tv_usec) :			\
+	    ((tvp)->tv_sec cmp (uvp)->tv_sec))
+#define	timeradd(tvp, uvp, vvp)						\
+	do {								\
+		(vvp)->tv_sec = (tvp)->tv_sec + (uvp)->tv_sec;		\
+		(vvp)->tv_usec = (tvp)->tv_usec + (uvp)->tv_usec;	\
+		if ((vvp)->tv_usec >= 1000000) {			\
+			(vvp)->tv_sec++;				\
+			(vvp)->tv_usec -= 1000000;			\
+		}							\
+	} while (0)
+#define	timersub(tvp, uvp, vvp)						\
+	do {								\
+		(vvp)->tv_sec = (tvp)->tv_sec - (uvp)->tv_sec;		\
+		(vvp)->tv_usec = (tvp)->tv_usec - (uvp)->tv_usec;	\
+		if ((vvp)->tv_usec < 0) {				\
+			(vvp)->tv_sec--;				\
+			(vvp)->tv_usec += 1000000;			\
+		}							\
+	} while (0)
+
+/* Operations on timespecs. */
+#define	timespecclear(tsp)		(tsp)->tv_sec = (tsp)->tv_nsec = 0
+#define	timespecisset(tsp)		((tsp)->tv_sec || (tsp)->tv_nsec)
+#define	timespeccmp(tsp, usp, cmp)					\
+	(((tsp)->tv_sec == (usp)->tv_sec) ?				\
+	    ((tsp)->tv_nsec cmp (usp)->tv_nsec) :			\
+	    ((tsp)->tv_sec cmp (usp)->tv_sec))
+#define	timespecadd(tsp, usp, vsp)					\
+	do {								\
+		(vsp)->tv_sec = (tsp)->tv_sec + (usp)->tv_sec;		\
+		(vsp)->tv_nsec = (tsp)->tv_nsec + (usp)->tv_nsec;	\
+		if ((vsp)->tv_nsec >= 1000000000L) {			\
+			(vsp)->tv_sec++;				\
+			(vsp)->tv_nsec -= 1000000000L;			\
+		}							\
+	} while (0)
+#define	timespecsub(tsp, usp, vsp)					\
+	do {								\
+		(vsp)->tv_sec = (tsp)->tv_sec - (usp)->tv_sec;		\
+		(vsp)->tv_nsec = (tsp)->tv_nsec - (usp)->tv_nsec;	\
+		if ((vsp)->tv_nsec < 0) {				\
+			(vsp)->tv_sec--;				\
+			(vsp)->tv_nsec += 1000000000L;			\
+		}							\
+	} while (0)
+
+
+int	gettimeofday __P((struct timeval *, struct timezone *));
+
+/* the following functions are not supported by eCos */
+#if 0
+
+void	microtime __P((struct timeval *tv));
+int	adjtime __P((const struct timeval *, struct timeval *));
+int	clock_getres __P((clockid_t, struct timespec *));
+int	clock_gettime __P((clockid_t, struct timespec *));
+int	clock_settime __P((clockid_t, const struct timespec *));
+int	futimes __P((int, const struct timeval *));
+int	getitimer __P((int, struct itimerval *));
+int	nanosleep __P((const struct timespec *, struct timespec *));
+int	setitimer __P((int, const struct itimerval *, struct itimerval *));
+int	settimeofday __P((const struct timeval *, const struct timezone *));
+int	utimes __P((const char *, const struct timeval *));
+
+
+int	itimerdecr __P((struct itimerval *itp, int usec));
+int	itimerfix __P((struct timeval *tv));
+void	settime __P((struct timeval *tv));
+
+int	adjtime __P((const struct timeval *, struct timeval *));
+int	clock_getres __P((clockid_t, struct timespec *));
+int	clock_gettime __P((clockid_t, struct timespec *));
+int	clock_settime __P((clockid_t, const struct timespec *));
+int	futimes __P((int, const struct timeval *));
+int	getitimer __P((int, struct itimerval *));
+int	nanosleep __P((const struct timespec *, struct timespec *));
+int	setitimer __P((int, const struct itimerval *, struct itimerval *));
+int	settimeofday __P((const struct timeval *, const struct timezone *));
+int	utimes __P((const char *, const struct timeval *));
+
+/*
+ * Structure defined by POSIX.1b to be like a timeval.
+ */
+struct timespec {
+	time_t	tv_sec;		/* seconds */
+	long	tv_nsec;	/* and nanoseconds */
+};
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+
+#endif
diff --exclude=CVS -rbupN packages.unmodified/compat/posix/current/src/misc.cxx packages/compat/posix/current/src/misc.cxx
--- packages.unmodified/compat/posix/current/src/misc.cxx	2002-05-24 00:59:59.000000000 +0200
+++ packages/compat/posix/current/src/misc.cxx	2005-10-20 18:55:24.000000000 +0200
@@ -65,7 +65,9 @@
 #include "pprivate.h"                   // POSIX private header
 
 #include <unistd.h>
+#ifdef CYGPKG_POSIX_UTSNAME
 #include <sys/utsname.h>                // My header
+#endif
 #include <string.h>                     // strcpy
 #include <limits.h>
 #include <time.h>
@@ -93,6 +95,7 @@
 // -------------------------------------------------------------------------
 // uname()
 
+#ifdef CYGPKG_POSIX_UTSNAME
 __externC int uname( struct utsname *name )
 {
     CYG_REPORT_FUNCTYPE( "returning %d" );
@@ -106,6 +109,7 @@ __externC int uname( struct utsname *nam
     CYG_REPORT_RETVAL(0);
     return 0;
 }
+#endif
 
 // -------------------------------------------------------------------------
 // sysconf()
@@ -351,36 +355,6 @@ __externC pid_t getpgrp   ( void ) { ret
 __externC pid_t setsid    ( void ) { errno = EPERM; return -1; }
 __externC int   setpgid   ( pid_t pid, pid_t pgid ) { errno = ENOSYS; return -1; }
 
-//==========================================================================
-// Exports to other packages
-
-// -------------------------------------------------------------------------
-// POSIX API function entry
-
-__externC void cyg_posix_function_start()
-{
-    Cyg_Thread *self = Cyg_Scheduler::get_current_thread();
-
-    // Inhibit ASR delivery in this function until it returns.
-    
-    self->set_asr_inhibit();
-}
-
-// -------------------------------------------------------------------------
-
-__externC void cyg_posix_function_finish()
-{
-    Cyg_Thread *self = Cyg_Scheduler::get_current_thread();
-
-    // Re-allow ASR delivery.
-    
-    self->clear_asr_inhibit();
-
-    // After clearing the inhibit flag, blip the scheduler lock
-    // to get any pending ASRs delivered.
-    Cyg_Scheduler::lock();
-    Cyg_Scheduler::unlock();
-}
 
 // -------------------------------------------------------------------------
 // EOF misc.cxx
diff --exclude=CVS -rbupN packages.unmodified/compat/posix/current/src/mqueue.cxx packages/compat/posix/current/src/mqueue.cxx
--- packages.unmodified/compat/posix/current/src/mqueue.cxx	2003-12-02 06:48:46.000000000 +0100
+++ packages/compat/posix/current/src/mqueue.cxx	2005-10-19 21:32:37.000000000 +0200
@@ -58,8 +58,6 @@
 
 #include <pkgconf/posix.h>
 
-#ifdef CYGPKG_POSIX_MQUEUES
-
 #include <pkgconf/kernel.h>
 
 /* INCLUDES */
@@ -1000,6 +998,4 @@ mq_getattr( mqd_t mqdes, struct mq_attr 
 
 //------------------------------------------------------------------------
 
-#endif // ifdef CYGPKG_POSIX_MQUEUES
-
 /* EOF mqueue.cxx */
diff --exclude=CVS -rbupN packages.unmodified/compat/posix/current/src/pthread.cxx packages/compat/posix/current/src/pthread.cxx
--- packages.unmodified/compat/posix/current/src/pthread.cxx	2003-11-21 11:53:11.000000000 +0100
+++ packages/compat/posix/current/src/pthread.cxx	2005-10-20 18:55:08.000000000 +0200
@@ -147,6 +147,33 @@ int pthread_canceled_dummy_var;         
 
 //=============================================================================
 // Internal functions
+// -------------------------------------------------------------------------
+// POSIX API function entry
+
+__externC void cyg_posix_function_start()
+{
+    Cyg_Thread *self = Cyg_Scheduler::get_current_thread();
+
+    // Inhibit ASR delivery in this function until it returns.
+    
+    self->set_asr_inhibit();
+}
+
+// -------------------------------------------------------------------------
+
+__externC void cyg_posix_function_finish()
+{
+    Cyg_Thread *self = Cyg_Scheduler::get_current_thread();
+
+    // Re-allow ASR delivery.
+    
+    self->clear_asr_inhibit();
+
+    // After clearing the inhibit flag, blip the scheduler lock
+    // to get any pending ASRs delivered.
+    Cyg_Scheduler::lock();
+    Cyg_Scheduler::unlock();
+}
 
 //-----------------------------------------------------------------------------
 // Private version of pthread_self() that returns a pointer to our internal
diff --exclude=CVS -rbupN packages.unmodified/compat/posix/current/src/time.cxx packages/compat/posix/current/src/time.cxx
--- packages.unmodified/compat/posix/current/src/time.cxx	2003-01-31 12:53:14.000000000 +0100
+++ packages/compat/posix/current/src/time.cxx	2005-10-19 23:40:50.000000000 +0200
@@ -55,8 +55,6 @@
 
 #include <pkgconf/posix.h>
 
-#ifdef CYGPKG_POSIX_CLOCKS
-
 #include <pkgconf/hal.h>
 #include <pkgconf/kernel.h>
 
@@ -67,9 +65,11 @@
 #include "pprivate.h"                   // POSIX private header
 
 #include <time.h>                       // our header
+#include <sys/time.h>
 
 #include <cyg/kernel/thread.hxx>
 #include <cyg/kernel/clock.hxx>
+#include <cyg/kernel/kapi.h>
 
 #include <cyg/kernel/thread.inl>
 #include <cyg/kernel/clock.inl>
@@ -694,7 +694,19 @@ externC unsigned int sleep( unsigned int
     TIME_RETURN(0);
 } 
 
-#endif // ifdef CYGPKG_POSIX_CLOCKS
+// -------------------------------------------------------------------------
+// gettimeofday()
+// Get the current time in a struct timeval
+externC int gettimeofday(struct timeval* tv, struct timezone* tz)
+{
+    int ticks_per_second = 1000000000/(CYGNUM_HAL_RTC_NUMERATOR/CYGNUM_HAL_RTC_DENOMINATOR);    
+    cyg_tick_count_t cur_time = cyg_current_time();
+    int tix = cur_time % ticks_per_second;
+    tv->tv_sec = cur_time / ticks_per_second;
+    tv->tv_usec = (tix * 1000000)/ticks_per_second;
+    return 0;
+}
+
 
 // -------------------------------------------------------------------------
 // EOF time.cxx
diff --exclude=CVS -rbupN packages.unmodified/io/fileio/current/ChangeLog packages/io/fileio/current/ChangeLog
--- packages.unmodified/io/fileio/current/ChangeLog	2005-08-03 23:05:16.000000000 +0200
+++ packages/io/fileio/current/ChangeLog	2005-10-20 20:18:44.000000000 +0200
@@ -1,3 +1,7 @@
+2005-10-18 Alexander Neundorf <neundorf@kde.org>
+        * src/fio.h: use CYG_POSIX_FUNCTION_START/FINISH
+        only #ifdef CYGPKG_POSIX_PTHREAD instead of #ifdef CYGPKG_POSIX
+
 2005-08-02  Andrew Lunn  <andrew.lunn@ascom.ch>
 
 	* tests/socket.c (SHOW_RESULT): Add a cast to avoid compiler
diff --exclude=CVS -rbupN packages.unmodified/io/fileio/current/src/fio.h packages/io/fileio/current/src/fio.h
--- packages.unmodified/io/fileio/current/src/fio.h	2005-01-22 15:03:37.000000000 +0100
+++ packages/io/fileio/current/src/fio.h	2005-10-20 18:49:05.000000000 +0200
@@ -91,7 +91,7 @@
 //=============================================================================
 // POSIX API support
 
-#ifdef CYGPKG_POSIX
+#ifdef CYGPKG_POSIX_PTHREAD
 #include <pkgconf/posix.h>
 #include <cyg/posix/export.h>
 
diff --exclude=CVS -rbupN packages.unmodified/isoinfra/current/include/sys/time.h packages/isoinfra/current/include/sys/time.h
--- packages.unmodified/isoinfra/current/include/sys/time.h	1970-01-01 01:00:00.000000000 +0100
+++ packages/isoinfra/current/include/sys/time.h	2005-10-14 20:53:10.000000000 +0200
@@ -0,0 +1,91 @@
+#ifndef CYGONCE_ISO_SYS_TIME_H
+#define CYGONCE_ISO_SYS_TIME_H
+/*========================================================================
+//
+//      sys/time.h
+//
+//      struct timeval and gettimeofday()
+//
+//========================================================================
+//####ECOSGPLCOPYRIGHTBEGIN####
+// -------------------------------------------
+// This file is part of eCos, the Embedded Configurable Operating System.
+// Copyright (C) 2005  Alexander Neundorf
+//
+// eCos is free software; you can redistribute it and/or modify it under
+// the terms of the GNU General Public License as published by the Free
+// Software Foundation; either version 2 or (at your option) any later version.
+//
+// eCos is distributed in the hope that it will be useful, but WITHOUT ANY
+// WARRANTY; without even the implied warranty of MERCHANTABILITY or
+// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+// for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with eCos; if not, write to the Free Software Foundation, Inc.,
+// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
+//
+// As a special exception, if other files instantiate templates or use macros
+// or inline functions from this file, or you compile this file and link it
+// with other works to produce a work based on this file, this file does not
+// by itself cause the resulting work to be covered by the GNU General Public
+// License. However the source code for this file must still be made available
+// in accordance with section (3) of the GNU General Public License.
+//
+// This exception does not invalidate any other reasons why a work based on
+// this file might be covered by the GNU General Public License.
+//
+// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
+// at http://sources.redhat.com/ecos/ecos-license/
+// -------------------------------------------
+//####ECOSGPLCOPYRIGHTEND####
+//========================================================================
+//#####DESCRIPTIONBEGIN####
+//
+// Author(s):     Alexander Neundorf <neundorf@kde.org>
+// Contributors:  
+// Date:          2005-10-04
+// Purpose:       This file provides the time macros, types and functions
+//                required by ISO C and POSIX 1003.1.
+// Description:   The real contents of this file get set from the
+//                configuration (set by the implementation)
+// Usage:         #include <time.h>
+//
+//####DESCRIPTIONEND####
+//
+//======================================================================
+*/
+
+/* CONFIGURATION */
+
+#include <pkgconf/isoinfra.h>          /* Configuration header */
+
+/* INCLUDES */
+
+/* This is the "standard" way to get NULL and size_t from stddef.h,
+ * which is the canonical location of the definitions.
+ */
+#define __need_NULL
+#define __need_size_t
+#include <stddef.h>
+
+#include <time.h>
+#ifdef CYGBLD_ISO_STRUCTTIMEVAL_HEADER
+# include CYGBLD_ISO_STRUCTTIMEVAL_HEADER
+#else
+
+/*
+ * Structure returned by gettimeofday(2),
+ * and used in other calls such as select(2).
+ */
+struct timeval {
+	time_t	tv_sec;		/* seconds */
+	time_t	tv_usec;	/* and microseconds */
+};
+
+#endif
+
+
+#endif /* CYGONCE_ISO_SYS_TIME_H multiple inclusion protection */
+
+/* EOF sys/time.h */
diff --exclude=CVS -rbupN packages.unmodified/isoinfra/current/include/time.h packages/isoinfra/current/include/time.h
--- packages.unmodified/isoinfra/current/include/time.h	2002-05-24 01:06:43.000000000 +0200
+++ packages/isoinfra/current/include/time.h	2005-10-12 18:21:15.000000000 +0200
@@ -99,23 +99,7 @@ typedef long clock_t;
 #  define __clock_t_defined
 #endif
 
-#ifdef CYGBLD_ISO_STRUCTTIMEVAL_HEADER
-# include CYGBLD_ISO_STRUCTTIMEVAL_HEADER
-#else
-# ifndef _POSIX_SOURCE
-
-/*
- * Structure returned by gettimeofday(2),
- * and used in other calls such as select(2).
- */
-struct timeval {
-	long	tv_sec;		/* seconds */
-	long	tv_usec;	/* and microseconds */
-};
-
-# endif /* _POSIX_SOURCE */
-#endif
-
+#include <sys/time.h>
 
 #ifdef CYGINT_ISO_POSIX_CLOCK_TYPES
 # include CYGBLD_ISO_POSIX_CLOCK_TYPES_HEADER
diff --exclude=CVS -rbupN packages.unmodified/language/c/libc/stdio/current/ChangeLog packages/language/c/libc/stdio/current/ChangeLog
--- packages.unmodified/language/c/libc/stdio/current/ChangeLog	2005-07-30 13:44:01.000000000 +0200
+++ packages/language/c/libc/stdio/current/ChangeLog	2005-10-20 20:17:53.000000000 +0200
@@ -1,3 +1,7 @@
+2005-10-18 Alexander Neundorf <neundorf@kde.org>
+        * src/common/fileops.cxx: use CYG_POSIX_FUNCTION_START/FINISH
+        only #ifdef CYGPKG_POSIX_PTHREAD instead of #ifdef CYGPKG_POSIX
+
 2005-07-22  Andrew Lunn  <andrew.lunn@ascom.ch>
 
 	* src/common/fopen.cxx (fopen): Default the open mode to Read
diff --exclude=CVS -rbupN packages.unmodified/language/c/libc/stdio/current/src/common/fileops.cxx packages/language/c/libc/stdio/current/src/common/fileops.cxx
--- packages.unmodified/language/c/libc/stdio/current/src/common/fileops.cxx	2004-03-15 17:31:58.000000000 +0100
+++ packages/language/c/libc/stdio/current/src/common/fileops.cxx	2005-10-20 18:48:46.000000000 +0200
@@ -77,7 +77,7 @@
 
 // DEFINES
 
-#ifdef CYGPKG_POSIX
+#ifdef CYGPKG_POSIX_PTHREAD
 # define CYG_STDIO_FUNCTION_START() CYG_POSIX_FUNCTION_START()
 # define CYG_STDIO_FUNCTION_FINISH() CYG_POSIX_FUNCTION_FINISH()
 #else

-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

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