From: Jim Jagielski Date: Fri, 16 Nov 2012 16:49:31 +0000 (+0000) Subject: fdq expects a certain behavior from atomics... ensure that X-Git-Tag: 2.5.0-alpha~6111 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=46ea0fc7abd4dcf6da265f83709021fb7f608c0f;p=thirdparty%2Fapache%2Fhttpd.git fdq expects a certain behavior from atomics... ensure that the event mpms check this. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1410459 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/docs/log-message-tags/next-number b/docs/log-message-tags/next-number index 075c4f664bb..0af28381aaf 100644 --- a/docs/log-message-tags/next-number +++ b/docs/log-message-tags/next-number @@ -1 +1 @@ -2405 +2407 diff --git a/server/mpm/event/event.c b/server/mpm/event/event.c index 23aa95d8f75..9c18af354cd 100644 --- a/server/mpm/event/event.c +++ b/server/mpm/event/event.c @@ -2928,6 +2928,18 @@ static int event_pre_config(apr_pool_t * pconf, apr_pool_t * plog, } ++retained->module_loads; if (retained->module_loads == 2) { + int i; + static apr_uint32_t foo = 0; + + apr_atomic_inc32(&foo); + apr_atomic_dec32(&foo); + apr_atomic_dec32(&foo); + i = apr_atomic_dec32(&foo); + if (i >= 0) { + ap_log_error(APLOG_MARK, APLOG_CRIT, rv, NULL, APLOGNO(02405) + "atomics not working as expected"); + return HTTP_INTERNAL_SERVER_ERROR; + } rv = apr_pollset_create(&event_pollset, 1, plog, APR_POLLSET_THREADSAFE | APR_POLLSET_NOCOPY); if (rv != APR_SUCCESS) { diff --git a/server/mpm/eventopt/eventopt.c b/server/mpm/eventopt/eventopt.c index fbf189d5321..2c7891e65e7 100644 --- a/server/mpm/eventopt/eventopt.c +++ b/server/mpm/eventopt/eventopt.c @@ -2922,6 +2922,18 @@ static int event_pre_config(apr_pool_t * pconf, apr_pool_t * plog, } ++retained->module_loads; if (retained->module_loads == 2) { + int i; + static apr_uint32_t foo = 0; + + apr_atomic_inc32(&foo); + apr_atomic_dec32(&foo); + apr_atomic_dec32(&foo); + i = apr_atomic_dec32(&foo); + if (i >= 0) { + ap_log_error(APLOG_MARK, APLOG_CRIT, 0, NULL, APLOGNO(02406) + "atomics not working as expected"); + return HTTP_INTERNAL_SERVER_ERROR; + } rv = apr_pollset_create(&event_pollset, 1, plog, APR_POLLSET_WAKEABLE|APR_POLLSET_NOCOPY); if (rv != APR_SUCCESS) {