You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by ji...@apache.org on 2014/06/03 18:02:44 UTC

svn commit: r1599641 - in /httpd/httpd/trunk: include/ap_mmn.h include/util_time.h server/mpm/event/event.c server/mpm/eventopt/eventopt.c server/mpm/prefork/prefork.c server/mpm/worker/worker.c server/util_time.c

Author: jim
Date: Tue Jun  3 16:02:44 2014
New Revision: 1599641

URL: http://svn.apache.org/r1599641
Log:
Break out common code to be share-able

Modified:
    httpd/httpd/trunk/include/ap_mmn.h
    httpd/httpd/trunk/include/util_time.h
    httpd/httpd/trunk/server/mpm/event/event.c
    httpd/httpd/trunk/server/mpm/eventopt/eventopt.c
    httpd/httpd/trunk/server/mpm/prefork/prefork.c
    httpd/httpd/trunk/server/mpm/worker/worker.c
    httpd/httpd/trunk/server/util_time.c

Modified: httpd/httpd/trunk/include/ap_mmn.h
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/include/ap_mmn.h?rev=1599641&r1=1599640&r2=1599641&view=diff
==============================================================================
--- httpd/httpd/trunk/include/ap_mmn.h (original)
+++ httpd/httpd/trunk/include/ap_mmn.h Tue Jun  3 16:02:44 2014
@@ -455,6 +455,7 @@
  * 20140207.5 (2.5.0-dev)  Add ap_mpm_resume_suspended(), AP_MPMQ_CAN_SUSPEND to
  *                         ap_mpm_query(), and suspended_baton to conn_rec
  * 20140207.6 (2.5.0-dev)  Added ap_log_common().
+ * 20140207.7 (2.5.0-dev)  Added ap_force_set_tz().
  */
 
 #define MODULE_MAGIC_COOKIE 0x41503235UL /* "AP25" */
@@ -462,7 +463,7 @@
 #ifndef MODULE_MAGIC_NUMBER_MAJOR
 #define MODULE_MAGIC_NUMBER_MAJOR 20140207
 #endif
-#define MODULE_MAGIC_NUMBER_MINOR 6                  /* 0...n */
+#define MODULE_MAGIC_NUMBER_MINOR 7                  /* 0...n */
 
 /**
  * Determine if the server's current MODULE_MAGIC_NUMBER is at least a

Modified: httpd/httpd/trunk/include/util_time.h
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/include/util_time.h?rev=1599641&r1=1599640&r2=1599641&view=diff
==============================================================================
--- httpd/httpd/trunk/include/util_time.h (original)
+++ httpd/httpd/trunk/include/util_time.h Tue Jun  3 16:02:44 2014
@@ -109,6 +109,12 @@ AP_DECLARE(apr_status_t) ap_recent_ctime
  */
 AP_DECLARE(apr_status_t) ap_recent_rfc822_date(char *date_str, apr_time_t t);
 
+/**
+ * Force an unset TZ to UTC
+ * @param p the pool to use
+ */
+AP_DECLARE(void) ap_force_set_tz(apr_pool_t *p);
+
 #ifdef __cplusplus
 }
 #endif

Modified: httpd/httpd/trunk/server/mpm/event/event.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/server/mpm/event/event.c?rev=1599641&r1=1599640&r2=1599641&view=diff
==============================================================================
--- httpd/httpd/trunk/server/mpm/event/event.c (original)
+++ httpd/httpd/trunk/server/mpm/event/event.c Tue Jun  3 16:02:44 2014
@@ -57,7 +57,6 @@
 #include "apr_atomic.h"
 #define APR_WANT_STRFUNC
 #include "apr_want.h"
-#include "apr_env.h"
 
 #include "apr_version.h"
 
@@ -97,6 +96,7 @@
 #include "http_vhost.h"
 #include "unixd.h"
 #include "apr_skiplist.h"
+#include "util_time.h"
 
 #include <signal.h>
 #include <limits.h>             /* for INT_MAX */
@@ -2420,25 +2420,6 @@ static void join_start_thread(apr_thread
     }
 }
 
-static void force_set_tz(apr_pool_t *p) {
-    /* If the TZ variable is unset, many operationg systems,
-     * such as Linux, will at runtime read from /etc/localtime
-     * and call fstat on it.
-     *
-     * By forcing the time zone to UTC if it is unset, we gain
-     * about 2% in raw requests/second (since we format log files
-     * in the local time, if present)
-     *
-     * For more info, see:
-     *   <http://www.gnu.org/s/hello/manual/libc/TZ-Variable.html>
-     */
-    char *v = NULL;
-
-    if (apr_env_get(&v, "TZ", p) != APR_SUCCESS) {
-        apr_env_set("TZ", "UTC+0", p);
-    }
-}
-
 static void child_main(int child_num_arg)
 {
     apr_thread_t **threads;
@@ -3587,7 +3568,7 @@ static void event_hooks(apr_pool_t * p)
      */
     static const char *const aszSucc[] = { "core.c", NULL };
     one_process = 0;
-    force_set_tz(p);
+    ap_force_set_tz(p);
 
     ap_hook_open_logs(event_open_logs, NULL, aszSucc, APR_HOOK_REALLY_FIRST);
     /* we need to set the MPM state before other pre-config hooks use MPM query

Modified: httpd/httpd/trunk/server/mpm/eventopt/eventopt.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/server/mpm/eventopt/eventopt.c?rev=1599641&r1=1599640&r2=1599641&view=diff
==============================================================================
--- httpd/httpd/trunk/server/mpm/eventopt/eventopt.c (original)
+++ httpd/httpd/trunk/server/mpm/eventopt/eventopt.c Tue Jun  3 16:02:44 2014
@@ -57,7 +57,6 @@
 #include "apr_atomic.h"
 #define APR_WANT_STRFUNC
 #include "apr_want.h"
-#include "apr_env.h"
 
 #if APR_HAVE_UNISTD_H
 #include <unistd.h>
@@ -91,6 +90,7 @@
 #include "mpm_default.h"
 #include "http_vhost.h"
 #include "unixd.h"
+#include "util_time.h"
 
 #include <signal.h>
 #include <limits.h>             /* for INT_MAX */
@@ -2231,25 +2231,6 @@ static void join_start_thread(apr_thread
     }
 }
 
-static void force_set_tz(apr_pool_t *p) {
-    /* If the TZ variable is unset, many operationg systems,
-     * such as Linux, will at runtime read from /etc/localtime
-     * and call fstat on it.
-     *
-     * By forcing the time zone to UTC if it is unset, we gain
-     * about 2% in raw requests/second (since we format log files
-     * in the local time, if present)
-     *
-     * For more info, see:
-     *   <http://www.gnu.org/s/hello/manual/libc/TZ-Variable.html>
-     */
-    char *v = NULL;
-
-    if (apr_env_get(&v, "TZ", p) != APR_SUCCESS) {
-        apr_env_set("TZ", "UTC+0", p);
-    }
-}
-
 static void child_main(int child_num_arg)
 {
     apr_thread_t **threads;
@@ -3395,7 +3376,7 @@ static void event_hooks(apr_pool_t * p)
      */
     static const char *const aszSucc[] = { "core.c", NULL };
     one_process = 0;
-    force_set_tz(p);
+    ap_force_set_tz(p);
 
     ap_hook_open_logs(event_open_logs, NULL, aszSucc, APR_HOOK_REALLY_FIRST);
     /* we need to set the MPM state before other pre-config hooks use MPM query

Modified: httpd/httpd/trunk/server/mpm/prefork/prefork.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/server/mpm/prefork/prefork.c?rev=1599641&r1=1599640&r2=1599641&view=diff
==============================================================================
--- httpd/httpd/trunk/server/mpm/prefork/prefork.c (original)
+++ httpd/httpd/trunk/server/mpm/prefork/prefork.c Tue Jun  3 16:02:44 2014
@@ -47,6 +47,7 @@
 #include "ap_listen.h"
 #include "ap_mmn.h"
 #include "apr_poll.h"
+#include "util_time.h"
 
 #include <stdlib.h>
 
@@ -1521,6 +1522,7 @@ static void prefork_hooks(apr_pool_t *p)
      * console.
      */
     static const char *const aszSucc[] = {"core.c", NULL};
+    ap_force_set_tz(p);
 
     ap_hook_open_logs(prefork_open_logs, NULL, aszSucc, APR_HOOK_REALLY_FIRST);
     /* we need to set the MPM state before other pre-config hooks use MPM query

Modified: httpd/httpd/trunk/server/mpm/worker/worker.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/server/mpm/worker/worker.c?rev=1599641&r1=1599640&r2=1599641&view=diff
==============================================================================
--- httpd/httpd/trunk/server/mpm/worker/worker.c (original)
+++ httpd/httpd/trunk/server/mpm/worker/worker.c Tue Jun  3 16:02:44 2014
@@ -68,6 +68,7 @@
 #include "mpm_default.h"
 #include "util_mutex.h"
 #include "unixd.h"
+#include "util_time.h"
 
 #include <signal.h>
 #include <limits.h>             /* for INT_MAX */
@@ -2367,6 +2368,7 @@ static void worker_hooks(apr_pool_t *p)
      */
     static const char *const aszSucc[] = {"core.c", NULL};
     one_process = 0;
+    ap_force_set_tz(p);
 
     ap_hook_open_logs(worker_open_logs, NULL, aszSucc, APR_HOOK_REALLY_FIRST);
     /* we need to set the MPM state before other pre-config hooks use MPM query

Modified: httpd/httpd/trunk/server/util_time.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/server/util_time.c?rev=1599641&r1=1599640&r2=1599641&view=diff
==============================================================================
--- httpd/httpd/trunk/server/util_time.c (original)
+++ httpd/httpd/trunk/server/util_time.c Tue Jun  3 16:02:44 2014
@@ -15,6 +15,8 @@
  */
 
 #include "util_time.h"
+#include "apr_env.h"
+
 
 
 /* Number of characters needed to format the microsecond part of a timestamp.
@@ -304,3 +306,22 @@ AP_DECLARE(apr_status_t) ap_recent_rfc82
     *date_str++ = 0;
     return APR_SUCCESS;
 }
+
+AP_DECLARE(void) ap_force_set_tz(apr_pool_t *p) {
+    /* If the TZ variable is unset, many operationg systems,
+     * such as Linux, will at runtime read from /etc/localtime
+     * and call fstat on it.
+     *
+     * By forcing the time zone to UTC if it is unset, we gain
+     * about 2% in raw requests/second (since we format log files
+     * in the local time, if present)
+     *
+     * For more info, see:
+     *   <http://www.gnu.org/s/hello/manual/libc/TZ-Variable.html>
+     */
+    char *v = NULL;
+
+    if (apr_env_get(&v, "TZ", p) != APR_SUCCESS) {
+        apr_env_set("TZ", "UTC+0", p);
+    }
+}



Re: svn commit: r1599641 - in /httpd/httpd/trunk: include/ap_mmn.h include/util_time.h server/mpm/event/event.c server/mpm/eventopt/eventopt.c server/mpm/prefork/prefork.c server/mpm/worker/worker.c server/util_time.c

Posted by Christophe JAILLET <ch...@wanadoo.fr>.
Le 03/06/2014 19:51, Mike Rumph a écrit :
> Hello Jim,
>
> There is a small typo here.
>
> s/many operationg systems/many operating systems/
>
> Thanks,
>
> Mike Rumph
>

Fixed in r1601058.

CJ


Re: svn commit: r1599641 - in /httpd/httpd/trunk: include/ap_mmn.h include/util_time.h server/mpm/event/event.c server/mpm/eventopt/eventopt.c server/mpm/prefork/prefork.c server/mpm/worker/worker.c server/util_time.c

Posted by Christophe JAILLET <ch...@wanadoo.fr>.
Le 03/06/2014 19:51, Mike Rumph a écrit :
> Hello Jim,
>
> There is a small typo here.
>
> s/many operationg systems/many operating systems/
>
> Thanks,
>
> Mike Rumph
>

Fixed in r1601058.

CJ

Re: svn commit: r1599641 - in /httpd/httpd/trunk: include/ap_mmn.h include/util_time.h server/mpm/event/event.c server/mpm/eventopt/eventopt.c server/mpm/prefork/prefork.c server/mpm/worker/worker.c server/util_time.c

Posted by Mike Rumph <mi...@oracle.com>.
Hello Jim,

There is a small typo here.

s/many operationg systems/many operating systems/

Thanks,

Mike Rumph

On 6/3/2014 9:02 AM, jim@apache.org wrote:
> Author: jim
> Date: Tue Jun  3 16:02:44 2014
> New Revision: 1599641
>
> URL: http://svn.apache.org/r1599641
> Log:
> Break out common code to be share-able
>
> Modified:
>      httpd/httpd/trunk/include/ap_mmn.h
>      httpd/httpd/trunk/include/util_time.h
>      httpd/httpd/trunk/server/mpm/event/event.c
>      httpd/httpd/trunk/server/mpm/eventopt/eventopt.c
>      httpd/httpd/trunk/server/mpm/prefork/prefork.c
>      httpd/httpd/trunk/server/mpm/worker/worker.c
>      httpd/httpd/trunk/server/util_time.c
>
> Modified: httpd/httpd/trunk/include/ap_mmn.h
> URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/include/ap_mmn.h?rev=1599641&r1=1599640&r2=1599641&view=diff
> ==============================================================================
> --- httpd/httpd/trunk/include/ap_mmn.h (original)
> +++ httpd/httpd/trunk/include/ap_mmn.h Tue Jun  3 16:02:44 2014
> @@ -455,6 +455,7 @@
>    * 20140207.5 (2.5.0-dev)  Add ap_mpm_resume_suspended(), AP_MPMQ_CAN_SUSPEND to
>    *                         ap_mpm_query(), and suspended_baton to conn_rec
>    * 20140207.6 (2.5.0-dev)  Added ap_log_common().
> + * 20140207.7 (2.5.0-dev)  Added ap_force_set_tz().
>    */
>   
>   #define MODULE_MAGIC_COOKIE 0x41503235UL /* "AP25" */
> @@ -462,7 +463,7 @@
>   #ifndef MODULE_MAGIC_NUMBER_MAJOR
>   #define MODULE_MAGIC_NUMBER_MAJOR 20140207
>   #endif
> -#define MODULE_MAGIC_NUMBER_MINOR 6                  /* 0...n */
> +#define MODULE_MAGIC_NUMBER_MINOR 7                  /* 0...n */
>   
>   /**
>    * Determine if the server's current MODULE_MAGIC_NUMBER is at least a
>
> Modified: httpd/httpd/trunk/include/util_time.h
> URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/include/util_time.h?rev=1599641&r1=1599640&r2=1599641&view=diff
> ==============================================================================
> --- httpd/httpd/trunk/include/util_time.h (original)
> +++ httpd/httpd/trunk/include/util_time.h Tue Jun  3 16:02:44 2014
> @@ -109,6 +109,12 @@ AP_DECLARE(apr_status_t) ap_recent_ctime
>    */
>   AP_DECLARE(apr_status_t) ap_recent_rfc822_date(char *date_str, apr_time_t t);
>   
> +/**
> + * Force an unset TZ to UTC
> + * @param p the pool to use
> + */
> +AP_DECLARE(void) ap_force_set_tz(apr_pool_t *p);
> +
>   #ifdef __cplusplus
>   }
>   #endif
>
> Modified: httpd/httpd/trunk/server/mpm/event/event.c
> URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/server/mpm/event/event.c?rev=1599641&r1=1599640&r2=1599641&view=diff
> ==============================================================================
> --- httpd/httpd/trunk/server/mpm/event/event.c (original)
> +++ httpd/httpd/trunk/server/mpm/event/event.c Tue Jun  3 16:02:44 2014
> @@ -57,7 +57,6 @@
>   #include "apr_atomic.h"
>   #define APR_WANT_STRFUNC
>   #include "apr_want.h"
> -#include "apr_env.h"
>   
>   #include "apr_version.h"
>   
> @@ -97,6 +96,7 @@
>   #include "http_vhost.h"
>   #include "unixd.h"
>   #include "apr_skiplist.h"
> +#include "util_time.h"
>   
>   #include <signal.h>
>   #include <limits.h>             /* for INT_MAX */
> @@ -2420,25 +2420,6 @@ static void join_start_thread(apr_thread
>       }
>   }
>   
> -static void force_set_tz(apr_pool_t *p) {
> -    /* If the TZ variable is unset, many operationg systems,
> -     * such as Linux, will at runtime read from /etc/localtime
> -     * and call fstat on it.
> -     *
> -     * By forcing the time zone to UTC if it is unset, we gain
> -     * about 2% in raw requests/second (since we format log files
> -     * in the local time, if present)
> -     *
> -     * For more info, see:
> -     *   <http://www.gnu.org/s/hello/manual/libc/TZ-Variable.html>
> -     */
> -    char *v = NULL;
> -
> -    if (apr_env_get(&v, "TZ", p) != APR_SUCCESS) {
> -        apr_env_set("TZ", "UTC+0", p);
> -    }
> -}
> -
>   static void child_main(int child_num_arg)
>   {
>       apr_thread_t **threads;
> @@ -3587,7 +3568,7 @@ static void event_hooks(apr_pool_t * p)
>        */
>       static const char *const aszSucc[] = { "core.c", NULL };
>       one_process = 0;
> -    force_set_tz(p);
> +    ap_force_set_tz(p);
>   
>       ap_hook_open_logs(event_open_logs, NULL, aszSucc, APR_HOOK_REALLY_FIRST);
>       /* we need to set the MPM state before other pre-config hooks use MPM query
>
> Modified: httpd/httpd/trunk/server/mpm/eventopt/eventopt.c
> URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/server/mpm/eventopt/eventopt.c?rev=1599641&r1=1599640&r2=1599641&view=diff
> ==============================================================================
> --- httpd/httpd/trunk/server/mpm/eventopt/eventopt.c (original)
> +++ httpd/httpd/trunk/server/mpm/eventopt/eventopt.c Tue Jun  3 16:02:44 2014
> @@ -57,7 +57,6 @@
>   #include "apr_atomic.h"
>   #define APR_WANT_STRFUNC
>   #include "apr_want.h"
> -#include "apr_env.h"
>   
>   #if APR_HAVE_UNISTD_H
>   #include <unistd.h>
> @@ -91,6 +90,7 @@
>   #include "mpm_default.h"
>   #include "http_vhost.h"
>   #include "unixd.h"
> +#include "util_time.h"
>   
>   #include <signal.h>
>   #include <limits.h>             /* for INT_MAX */
> @@ -2231,25 +2231,6 @@ static void join_start_thread(apr_thread
>       }
>   }
>   
> -static void force_set_tz(apr_pool_t *p) {
> -    /* If the TZ variable is unset, many operationg systems,
> -     * such as Linux, will at runtime read from /etc/localtime
> -     * and call fstat on it.
> -     *
> -     * By forcing the time zone to UTC if it is unset, we gain
> -     * about 2% in raw requests/second (since we format log files
> -     * in the local time, if present)
> -     *
> -     * For more info, see:
> -     *   <http://www.gnu.org/s/hello/manual/libc/TZ-Variable.html>
> -     */
> -    char *v = NULL;
> -
> -    if (apr_env_get(&v, "TZ", p) != APR_SUCCESS) {
> -        apr_env_set("TZ", "UTC+0", p);
> -    }
> -}
> -
>   static void child_main(int child_num_arg)
>   {
>       apr_thread_t **threads;
> @@ -3395,7 +3376,7 @@ static void event_hooks(apr_pool_t * p)
>        */
>       static const char *const aszSucc[] = { "core.c", NULL };
>       one_process = 0;
> -    force_set_tz(p);
> +    ap_force_set_tz(p);
>   
>       ap_hook_open_logs(event_open_logs, NULL, aszSucc, APR_HOOK_REALLY_FIRST);
>       /* we need to set the MPM state before other pre-config hooks use MPM query
>
> Modified: httpd/httpd/trunk/server/mpm/prefork/prefork.c
> URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/server/mpm/prefork/prefork.c?rev=1599641&r1=1599640&r2=1599641&view=diff
> ==============================================================================
> --- httpd/httpd/trunk/server/mpm/prefork/prefork.c (original)
> +++ httpd/httpd/trunk/server/mpm/prefork/prefork.c Tue Jun  3 16:02:44 2014
> @@ -47,6 +47,7 @@
>   #include "ap_listen.h"
>   #include "ap_mmn.h"
>   #include "apr_poll.h"
> +#include "util_time.h"
>   
>   #include <stdlib.h>
>   
> @@ -1521,6 +1522,7 @@ static void prefork_hooks(apr_pool_t *p)
>        * console.
>        */
>       static const char *const aszSucc[] = {"core.c", NULL};
> +    ap_force_set_tz(p);
>   
>       ap_hook_open_logs(prefork_open_logs, NULL, aszSucc, APR_HOOK_REALLY_FIRST);
>       /* we need to set the MPM state before other pre-config hooks use MPM query
>
> Modified: httpd/httpd/trunk/server/mpm/worker/worker.c
> URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/server/mpm/worker/worker.c?rev=1599641&r1=1599640&r2=1599641&view=diff
> ==============================================================================
> --- httpd/httpd/trunk/server/mpm/worker/worker.c (original)
> +++ httpd/httpd/trunk/server/mpm/worker/worker.c Tue Jun  3 16:02:44 2014
> @@ -68,6 +68,7 @@
>   #include "mpm_default.h"
>   #include "util_mutex.h"
>   #include "unixd.h"
> +#include "util_time.h"
>   
>   #include <signal.h>
>   #include <limits.h>             /* for INT_MAX */
> @@ -2367,6 +2368,7 @@ static void worker_hooks(apr_pool_t *p)
>        */
>       static const char *const aszSucc[] = {"core.c", NULL};
>       one_process = 0;
> +    ap_force_set_tz(p);
>   
>       ap_hook_open_logs(worker_open_logs, NULL, aszSucc, APR_HOOK_REALLY_FIRST);
>       /* we need to set the MPM state before other pre-config hooks use MPM query
>
> Modified: httpd/httpd/trunk/server/util_time.c
> URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/server/util_time.c?rev=1599641&r1=1599640&r2=1599641&view=diff
> ==============================================================================
> --- httpd/httpd/trunk/server/util_time.c (original)
> +++ httpd/httpd/trunk/server/util_time.c Tue Jun  3 16:02:44 2014
> @@ -15,6 +15,8 @@
>    */
>   
>   #include "util_time.h"
> +#include "apr_env.h"
> +
>   
>   
>   /* Number of characters needed to format the microsecond part of a timestamp.
> @@ -304,3 +306,22 @@ AP_DECLARE(apr_status_t) ap_recent_rfc82
>       *date_str++ = 0;
>       return APR_SUCCESS;
>   }
> +
> +AP_DECLARE(void) ap_force_set_tz(apr_pool_t *p) {
> +    /* If the TZ variable is unset, many operationg systems,
> +     * such as Linux, will at runtime read from /etc/localtime
> +     * and call fstat on it.
> +     *
> +     * By forcing the time zone to UTC if it is unset, we gain
> +     * about 2% in raw requests/second (since we format log files
> +     * in the local time, if present)
> +     *
> +     * For more info, see:
> +     *   <http://www.gnu.org/s/hello/manual/libc/TZ-Variable.html>
> +     */
> +    char *v = NULL;
> +
> +    if (apr_env_get(&v, "TZ", p) != APR_SUCCESS) {
> +        apr_env_set("TZ", "UTC+0", p);
> +    }
> +}
>
>
>
>