httpd-bugs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 44004] New: - rotatelogs patch: reduce apr_time_now(), atomicity, consistency
Date Sat, 01 Dec 2007 10:26:54 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG·
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=44004>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND·
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=44004

           Summary: rotatelogs patch: reduce apr_time_now(), atomicity,
                    consistency
           Product: Apache httpd-2
           Version: 2.3-HEAD
          Platform: All
        OS/Version: All
            Status: NEW
          Keywords: PatchAvailable
          Severity: enhancement
          Priority: P2
         Component: support
        AssignedTo: bugs@httpd.apache.org
        ReportedBy: rainer.jung@kippdata.de


While I was looking at rotatelogs.c searching for the reason of the cryptic docs
warning about using "-l", I had the idea for slight improvements. I'll attach a
small patch, that includes:

- when using "-l" reduce two consecutive calls to apr_time_now() to one.
  This will not change the logic if no "-l" gets used, and it will spare
  one call to apr_time_now() in case "-l" gets used and more important
  it gives the code better atomicity, because in fact between the two calls
  there is a slight change of jumping oder the DST boundary

- for historic reasons the same code block is used two times with a
  slightly different way of transforming apr_time_t to int
  (once division by APR_USEC_PER_SEC, once call to apr_time_sec()),
  so let's unify it.

- finally move the block into a function, because it gets used already
  two times.

Note that the patch eliminates a side effect, namely in case use_localtime is
true the global variable utc_offset could change in main(). We now use
utc_offset in main() only for the offset given by the command line flags, which
is OK, because either use_localtime is true, or an offset can be given.

The attached patch works for trunk (r596796) and the 2.2 branch (r598272),
because at the moment both versions of rotatelogs.c are identical (recently
backported).

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org


Mime
View raw message