Apache HTTPD
dso.c
Go to the documentation of this file.
1/* Licensed to the Apache Software Foundation (ASF) under one or more
2 * contributor license agreements. See the NOTICE file distributed with
3 * this work for additional information regarding copyright ownership.
4 * The ASF licenses this file to You under the Apache License, Version 2.0
5 * (the "License"); you may not use this file except in compliance with
6 * the License. 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_arch_dso.h"
18#include "apr_strings.h"
19#include "apr_portable.h"
20#include <stdio.h>
21#include <string.h>
22
23#if APR_HAS_DSO
24
26{
28 int rc;
29
30 if (dso->handle == 0)
31 return APR_SUCCESS;
32
33 rc = DosFreeModule(dso->handle);
34
35 if (rc == 0)
36 dso->handle = 0;
37
38 return APR_FROM_OS_ERROR(rc);
39}
40
41
43{
44 char failed_module[200];
46 int rc;
47
48 *res_handle = apr_pcalloc(ctx, sizeof(**res_handle));
49 (*res_handle)->cont = ctx;
50 (*res_handle)->load_error = APR_SUCCESS;
51 (*res_handle)->failed_module = NULL;
52
53 if ((rc = DosLoadModule(failed_module, sizeof(failed_module), path, &handle)) != 0) {
54 (*res_handle)->load_error = APR_FROM_OS_ERROR(rc);
55 (*res_handle)->failed_module = apr_pstrdup(ctx, failed_module);
56 return APR_FROM_OS_ERROR(rc);
57 }
58
59 (*res_handle)->handle = handle;
61 return APR_SUCCESS;
62}
63
64
65
67{
69}
70
71
72
75 const char *symname)
76{
77 PFN func;
78 int rc;
79
80 if (symname == NULL || ressym == NULL)
81 return APR_ESYMNOTFOUND;
82
83 if ((rc = DosQueryProcAddr(handle->handle, 0, symname, &func)) != 0) {
84 handle->load_error = APR_FROM_OS_ERROR(rc);
85 return handle->load_error;
86 }
87
88 *ressym = func;
89 return APR_SUCCESS;
90}
91
92
93
95{
96 char message[200];
97 apr_strerror(dso->load_error, message, sizeof(message));
98
99 if (dso->failed_module != NULL) {
100 strcat(message, " (");
101 strcat(message, dso->failed_module);
102 strcat(message, ")");
103 }
104
106 return buffer;
107}
108
109
110
114{
115 *aprdso = apr_pcalloc(pool, sizeof **aprdso);
116 (*aprdso)->handle = osdso;
117 (*aprdso)->cont = pool;
118 (*aprdso)->load_error = APR_SUCCESS;
119 (*aprdso)->failed_module = NULL;
120 return APR_SUCCESS;
121}
122
123
124
127{
128 *osdso = aprdso->handle;
129 return APR_SUCCESS;
130}
131
132#endif
APR Portability Routines.
APR Strings library.
request_rec int int apr_table_t const char * path
#define APR_ESYMNOTFOUND
Definition apr_errno.h:336
apr_brigade_flush void * ctx
apr_pool_t const char apr_dbd_t ** handle
Definition apr_dbd.h:142
apr_redis_t * rc
Definition apr_redis.h:173
const void apr_status_t(*) apr_status_t(* APR_DECLARE)(void) apr_pool_pre_cleanup_register(apr_pool_t *p
Definition apr_pools.h:646
apr_size_t size
const char int apr_pool_t * pool
Definition apr_cstr.h:84
#define APR_FROM_OS_ERROR(e)
Definition apr_errno.h:1214
#define APR_SUCCESS
Definition apr_errno.h:225
int apr_status_t
Definition apr_errno.h:44
char * buffer
apr_size_t buflen
apr_interval_time_t apr_pollcb_cb_t func
Definition apr_poll.h:422
#define apr_pcalloc(p, size)
Definition apr_pools.h:465
void * apr_os_dso_handle_t
return NULL
Definition mod_so.c:359
static apr_status_t dso_cleanup(void *thedso)
Definition dso.c:41