Commit 55fcb2ed authored by Jim Jagielski's avatar Jim Jagielski
Browse files

Once SSLMutex allowed for the setting of both the

locking method and the lockfile location, I never
liked how AcceptMutex was linked to LockFile. This
seemed unnecessary. Much better to have AcceptMutex
do both as well. Plus, now that we will likely see
other modules require a "standard" way of setting
mutexes, why not have Apache provide that as
an API of sorts.

Anyway, LockFile is now depreciated and AcceptMutex
is now SSLMutex-like. We also provide a short
function that "parses" out a mutex parameter
and strips out the mechanism and lockfile location.
AcceptMutex and SSLMutex is this capability.



git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@467326 13f79535-47bb-0310-9956-ffa450edef68
parent 3f91379c
Loading
Loading
Loading
Loading
+5 −0
Changes for CHANGES: 5 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -2,6 +2,11 @@
Changes with Apache 2.3.0
  [Remove entries to the current 2.0 and 2.2 section below, when backported]
  *) The LockFile directive, which specifies the location of
     the accept() mutex lockfile, is depreciated. Instead, the
     AcceptMutex directive now takes an optional lockfile
     location parameter, ala SSLMutex. [Jim Jagielski]
  *) Fix address-in-use startup failure caused by corruption of the list of 
     listen sockets in some configurations with multiple generic Listen 
     directives.  [Jeff Trawick]
+35 −10
Changes for docs/manual/mod/mpm_common.xml: 35 added lines, 10 removed lines.
Original line number Diff line number Diff line
@@ -40,7 +40,8 @@ accepting requests on network sockets</description>

<usage>
    <p>The <directive>AcceptMutex</directive> directives sets the
    method that Apache uses to serialize multiple children accepting
    method (and lockfile location if appropriate) that Apache uses to
    serialize multiple children accepting
    requests on network sockets. Prior to Apache 2.0, the method was
    selectable only at compile time. The optimal method to use is
    highly architecture and platform dependent. For further details,
@@ -55,25 +56,42 @@ accepting requests on network sockets</description>
    listing the available methods.</p>

    <dl>
      <dt><code>flock</code></dt>
      <dt><code>flock&lt;<i>:/path/to/lockfile</i>&gt;</code></dt>
      <dd>uses the <code>flock(2)</code> system call to lock the
      file defined by the <directive module="mpm_common"
      >LockFile</directive> directive.</dd>
      file defined by the optional <i>/path/to/lockfile</i>
      parameter. One can also use the <directive module="mpm_common"
      >LockFile</directive> directive to specify the lockfile,
      although this is depreciated.</dd>

      <dt><code>fcntl</code></dt>
      <dt><code>fcntl&lt;<i>:/path/to/lockfile</i>&gt;</code></dt>
      <dd>uses the <code>fcntl(2)</code> system call to lock the
      file defined by the <directive module="mpm_common"
      >LockFile</directive> directive.</dd>
      file defined by the optional <i>/path/to/lockfile</i>
      parameter. One can also use the <directive module="mpm_common"
      >LockFile</directive> directive to specify the lockfile,
      although this is depreciated.</dd>

      <dt><code>file&lt;<i>:/path/to/lockfile</i>&gt;</code></dt>
      <dd>This directive tells the SSL Module to pick the "best" file locking
      implementation available to it, choosing between <code>fcntl</code> and
      <code>flock</code>, in that order. It is only available when the underlying
      platform and <glossary>APR</glossary> supports at least one of the 2.</dd>

      <dt><code>posixsem</code></dt>
      <dd>uses POSIX compatible semaphores to implement the mutex.</dd>

      <dt><code>sysvsem</code></dt>
      <dd>uses SySV-style semaphores to implement the mutex.</dd>

      <dt><code>sem</code></dt>
      <dd>This directive tells the SSL Module to pick the "best" semaphore
      implementation available to it, choosing between Posix and SystemV IPC,
      in that order. It is only available when the underlying platform and
      <glossary>APR</glossary> supports at least one of the 2.</dd>

      <dt><code>pthread</code></dt>
      <dd>uses POSIX mutexes as implemented by the POSIX Threads
      (PThreads) specification.</dd>

      <dt><code>sysvsem</code></dt>
      <dd>uses SySV-style semaphores to implement the mutex.</dd>
    </dl>

    <p>If you want to find out the compile time chosen default
@@ -386,7 +404,7 @@ The <var>protocol</var> argument was added in 2.1.5</compatibility>

<directivesynopsis>
<name>LockFile</name>
<description>Location of the accept serialization lock file</description>
<description>Location of the accept serialization lock file <b>(depreciated)</b></description>
<syntax>LockFile <var>filename</var></syntax>
<default>LockFile logs/accept.lock</default>
<contextlist><context>server config</context></contextlist>
@@ -412,6 +430,13 @@ The <var>protocol</var> argument was added in 2.1.5</compatibility>
      creating a lockfile with the same name as the one the server will try
      to create.</p>
    </note>
    <note type="warning"><title>Depreciated</title>
      <p>This directive is depreciated. It is strongly suggested that
      you use <directive module="mpm_common">AcceptMutex</directive> to
      specify both the mutex locking implementation as well as
      the lockfile location.</p>
    </note>

</usage>
<seealso><directive module="mpm_common">AcceptMutex</directive></seealso>
</directivesynopsis>
+3 −0
Changes for include/ap_mmn.h: 3 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -124,6 +124,9 @@
 * 20060905.0 (2.3.0-dev)  Replaced ap_get_server_version() with
 *                         ap_get_server_banner() and ap_get_server_description()
 * 20060905.1 (2.3.0-dev)  Enable retry=0 for the worker (minor)
 * 20060905.2 (2.3.0-dev)  Added ap_all_available_mutexes_string,
 *                         ap_available_mutexes_string and
 *                         ap_parse_mutex()
 *
 */

+0 −1
Changes for include/mpm_common.h: 0 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -286,7 +286,6 @@ const char *ap_mpm_set_lockfile(cmd_parms *cmd, void *dummy,
 */
#ifdef AP_MPM_WANT_SET_ACCEPT_LOCK_MECH
extern apr_lockmech_e ap_accept_lock_mech;
extern const char ap_valid_accept_mutex_string[];
const char *ap_mpm_set_accept_lock_mech(cmd_parms *cmd, void *dummy,
                                        const char *arg);
#endif

include/util_mutex.h

0 → 100644
+60 −0
Changes for include/util_mutex.h: 60 added lines, 0 removed lines.
Original line number Diff line number Diff line
/* Licensed to the Apache Software Foundation (ASF) under one or more
 * contributor license agreements.  See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The ASF licenses this file to You under the Apache License, Version 2.0
 * (the "License"); you may not use this file except in compliance with
 * the License.  You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

/**
 * @file  util_mutex.h
 * @brief Apache Mutex support library
 *
 * @defgroup APACHE_CORE_MUTEX Mutex Library
 * @ingroup  APACHE_CORE
 * @{
 */

#ifndef UTIL_MUTEX_H
#define UTIL_MUTEX_H

#include "httpd.h"
#include "apr_global_mutex.h"

#ifdef __cplusplus
extern "C" {
#endif

AP_DECLARE_DATA extern const char ap_available_mutexes_string[];
AP_DECLARE_DATA extern const char ap_all_available_mutexes_string[];

/**
 * Get Mutex config data and parse it
 * @param arg The mutex config string
 * @param pool The allocation pool
 * @param mutexmech The APR mutex locking mechanism
 * @param mutexfile The lockfile to use as required
 * @return APR status code
 * @deffunc apr_status_t ap_parse_mutex(const char *arg, apr_pool_t *pool,
                                        apr_lockmech_e *mutexmech,
                                        const char **mutexfile)
 */
AP_DECLARE(apr_status_t) ap_parse_mutex(const char *arg, apr_pool_t *pool,
                                        apr_lockmech_e *mutexmech,
                                        const char **mutexfile);


#ifdef __cplusplus
}
#endif

#endif /* UTIL_MUTEX_H */
/** @} */
Loading