gettimeofday and POSIX

Jeff Johnston jjohnstn@redhat.com
Thu Jul 5 19:08:00 GMT 2007


Hi Eric,

   How about the attached patch instead?  It goes through and cleans up 
all the implementations as well so there is no need for the flag check.

-- Jeff J.

Eric Blake wrote:
> gnulib projects that use gettimeofday currently crash when configured with
> -Werror [1], because gettimeofday has the wrong signature according to
> POSIX rules.  OK to apply this patch?
> 
> [1] http://lists.gnu.org/archive/html/bug-gnulib/2007-07/msg00063.html
> 
> 2007-07-05  Eric Blake  <ebb9@byu.net>
> 
> 	* libc/include/sys/time.h (gettimeofday): Make signature match
> 	POSIX.
> 
> Index: libc/include/sys/time.h
> ===================================================================
> RCS file: /cvs/src/src/newlib/libc/include/sys/time.h,v
> retrieving revision 1.10
> diff -u -p -b -r1.10 time.h
> --- libc/include/sys/time.h	15 Feb 2006 10:26:30 -0000	1.10
> +++ libc/include/sys/time.h	5 Jul 2007 14:31:08 -0000
> @@ -70,7 +70,11 @@ struct  itimerval {
>    } while (0)
>  #endif /* defined (__rtems__) || defined (__CYGWIN__) */
> 
> +#ifdef _COMPILING_NEWLIB
>  int _EXFUN(gettimeofday, (struct timeval *__p, struct timezone *__z));
> +#else
> +int _EXFUN(gettimeofday, (struct timeval *__p, void *__z));
> +#endif
>  int _EXFUN(settimeofday, (const struct timeval *, const struct timezone *));
>  int _EXFUN(utimes, (const char *__path, const struct timeval *__tvp));
>  int _EXFUN(getitimer, (int __which, struct itimerval *__value));
> 

-------------- next part --------------
A non-text attachment was scrubbed...
Name: gettimeofday.patch
Type: text/x-patch
Size: 12624 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/newlib/attachments/20070705/98ea05fe/attachment.bin>


More information about the Newlib mailing list