bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

gettimeofday on Solaris 2.6


From: Bruno Haible
Subject: gettimeofday on Solaris 2.6
Date: Sun, 8 May 2011 18:10:29 +0200
User-agent: KMail/1.9.9

On Solaris 2.6, when the module 'tzset' is used, the function gettimeofday
is meant to be overridden by a function rpl_gettimeofday that invokes the
real gettimeofday.

Instead, the function gettimeofday is redefined in lib/gettimeofday.c,
and it recursively invokes itself. The Solaris cc turns this recursive
invocation into an endless loop:


! SUBROUTINE gettimeofday
!
! OFFSET    SOURCE LINE LABEL   INSTRUCTION

                        .global gettimeofday
                       gettimeofday:
/* 000000        104 */         st      %o0,[%sp+68]
/* 0x0004            */         st      %o1,[%sp+72]

!  105                !#undef gettimeofday
!  106                !#if HAVE_GETTIMEOFDAY
!  107                !# if GETTIMEOFDAY_CLOBBERS_LOCALTIME
!  108                !  /* Save and restore the contents of the buffer used 
for localtime's
!  109                !     result around the call to gettimeofday.  */
!  110                !  struct tm save = *localtime_buffer_addr;
!  111                !# endif
!  113                !  int result = gettimeofday (tv, (struct timezone *) tz);

                       .L77000014:
/* 0x0008        113 */         ba      .L77000014
/* 0x000c            */         nop
/* 0x0010          0 */         .type   gettimeofday,2
/* 0x0010          0 */         .size   gettimeofday,(.-gettimeofday)


This fixes it. The bug was introduced on 2010-02-23, while fixing the behaviour
of this module on mingw.


2011-05-08  Bruno Haible  <address@hidden>

        tzset: Fix gettimeofday wrapper on Solaris 2.6.
        * m4/tzset.m4 (gl_FUNC_TZSET_CLOBBER): When invoking
        gl_GETTIMEOFDAY_REPLACE_LOCALTIME, also set REPLACE_GETTIMEOFDAY.

--- m4/tzset.m4.orig    Sun May  8 18:09:00 2011
+++ m4/tzset.m4 Sun May  8 17:57:33 2011
@@ -1,4 +1,4 @@
-# serial 4
+# serial 5
 
 # Copyright (C) 2003, 2007, 2009-2011 Free Software Foundation, Inc.
 # This file is free software; the Free Software Foundation
@@ -49,6 +49,7 @@
     [Define to 1 if you have run the test for working tzset.])
 
   if test $gl_cv_func_tzset_clobber = yes; then
+    REPLACE_GETTIMEOFDAY=1
     gl_GETTIMEOFDAY_REPLACE_LOCALTIME
 
     AC_DEFINE([tzset], [rpl_tzset],
-- 
In memoriam Farrokhroo Parsa <http://en.wikipedia.org/wiki/Farrokhroo_Parsa>



reply via email to

[Prev in Thread] Current Thread [Next in Thread]