~ubuntu-branches/ubuntu/feisty/apache2/feisty

« back to all changes in this revision

Viewing changes to srclib/apr/locks/netware/proc_mutex.c

  • Committer: Bazaar Package Importer
  • Author(s): Andreas Barth
  • Date: 2006-12-09 21:05:45 UTC
  • mfrom: (0.6.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20061209210545-h70s0xaqc2v8vqr2
Tags: 2.2.3-3.2
* Non-maintainer upload.
* 043_ajp_connection_reuse: Patch from upstream Bugzilla, fixing a critical
  issue with regard to connection reuse in mod_proxy_ajp.
  Closes: #396265

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* Copyright 2000-2005 The Apache Software Foundation or its licensors, as
 
2
 * applicable.
 
3
 *
 
4
 * Licensed under the Apache License, Version 2.0 (the "License");
 
5
 * you may not use this file except in compliance with the License.
 
6
 * You may obtain a copy of the License at
 
7
 *
 
8
 *     http://www.apache.org/licenses/LICENSE-2.0
 
9
 *
 
10
 * Unless required by applicable law or agreed to in writing, software
 
11
 * distributed under the License is distributed on an "AS IS" BASIS,
 
12
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 
13
 * See the License for the specific language governing permissions and
 
14
 * limitations under the License.
 
15
 */
 
16
 
 
17
#include "apr.h"
 
18
#include "apr_private.h"
 
19
#include "apr_portable.h"
 
20
#include "apr_arch_proc_mutex.h"
 
21
#include "apr_arch_thread_mutex.h"
 
22
 
 
23
APR_DECLARE(apr_status_t) apr_proc_mutex_create(apr_proc_mutex_t **mutex,
 
24
                                                const char *fname,
 
25
                                                apr_lockmech_e mech,
 
26
                                                apr_pool_t *pool)
 
27
{
 
28
    apr_status_t ret;
 
29
    apr_proc_mutex_t *new_mutex = NULL;
 
30
    new_mutex = (apr_proc_mutex_t *)apr_pcalloc(pool, sizeof(apr_proc_mutex_t));
 
31
        
 
32
        if(new_mutex ==NULL) {
 
33
        return APR_ENOMEM;
 
34
    }     
 
35
    
 
36
    new_mutex->pool = pool;
 
37
    ret = apr_thread_mutex_create(&(new_mutex->mutex), APR_THREAD_MUTEX_DEFAULT, pool);
 
38
 
 
39
    if (ret == APR_SUCCESS)
 
40
        *mutex = new_mutex;
 
41
 
 
42
    return ret;
 
43
}
 
44
 
 
45
APR_DECLARE(apr_status_t) apr_proc_mutex_child_init(apr_proc_mutex_t **mutex,
 
46
                                                    const char *fname,
 
47
                                                    apr_pool_t *pool)
 
48
{
 
49
    return APR_SUCCESS;
 
50
}
 
51
    
 
52
APR_DECLARE(apr_status_t) apr_proc_mutex_lock(apr_proc_mutex_t *mutex)
 
53
{
 
54
    if (mutex)
 
55
        return apr_thread_mutex_lock(mutex->mutex);
 
56
    return APR_ENOLOCK;
 
57
}
 
58
 
 
59
APR_DECLARE(apr_status_t) apr_proc_mutex_trylock(apr_proc_mutex_t *mutex)
 
60
{
 
61
    if (mutex)
 
62
        return apr_thread_mutex_trylock(mutex->mutex);
 
63
    return APR_ENOLOCK;
 
64
}
 
65
 
 
66
APR_DECLARE(apr_status_t) apr_proc_mutex_unlock(apr_proc_mutex_t *mutex)
 
67
{
 
68
    if (mutex)
 
69
        return apr_thread_mutex_unlock(mutex->mutex);
 
70
    return APR_ENOLOCK;
 
71
}
 
72
 
 
73
APR_DECLARE(apr_status_t) apr_proc_mutex_cleanup(void *mutex)
 
74
{
 
75
    return apr_proc_mutex_destroy(mutex);
 
76
}
 
77
 
 
78
APR_DECLARE(apr_status_t) apr_proc_mutex_destroy(apr_proc_mutex_t *mutex)
 
79
{
 
80
    if (mutex)
 
81
        return apr_thread_mutex_destroy(mutex->mutex);
 
82
    return APR_ENOLOCK;
 
83
}
 
84
 
 
85
APR_DECLARE(const char *) apr_proc_mutex_lockfile(apr_proc_mutex_t *mutex)
 
86
{
 
87
    return NULL;
 
88
}
 
89
 
 
90
APR_DECLARE(const char *) apr_proc_mutex_name(apr_proc_mutex_t *mutex)
 
91
{
 
92
    return "netwarethread";
 
93
}
 
94
 
 
95
APR_DECLARE(const char *) apr_proc_mutex_defname(void)
 
96
{
 
97
    return "netwarethread";
 
98
}
 
99
 
 
100
APR_POOL_IMPLEMENT_ACCESSOR(proc_mutex)
 
101
 
 
102
/* Implement OS-specific accessors defined in apr_portable.h */
 
103
 
 
104
apr_status_t apr_os_proc_mutex_get(apr_os_proc_mutex_t *ospmutex,
 
105
                                   apr_proc_mutex_t *pmutex)
 
106
{
 
107
    if (pmutex)
 
108
        ospmutex = pmutex->mutex->mutex;
 
109
    return APR_ENOLOCK;
 
110
}
 
111
 
 
112
apr_status_t apr_os_proc_mutex_put(apr_proc_mutex_t **pmutex,
 
113
                                   apr_os_proc_mutex_t *ospmutex,
 
114
                                   apr_pool_t *pool)
 
115
{
 
116
    return APR_ENOTIMPL;
 
117
}
 
118