Apache HTTPD
framework
httpd-2.4.62
srclib
apr
test
testshmconsumer.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_shm.h
"
18
#include "
apr_errno.h
"
19
#include "
apr_general.h
"
20
#include "
apr_lib.h
"
21
#include "
apr_strings.h
"
22
#include "
apr_time.h
"
23
#include "
testshm.h
"
24
#include "apr.h"
25
26
#if APR_HAVE_STDLIB_H
27
#include <stdlib.h>
28
#endif
29
30
31
#if APR_HAS_SHARED_MEMORY
32
33
int
main
(
void
)
34
{
35
apr_status_t
rv;
36
apr_pool_t
*
pool
;
37
apr_shm_t
*
shm
;
38
int
recvd
;
39
40
apr_initialize
();
41
42
if
(
apr_pool_create
(&
pool
,
NULL
) !=
APR_SUCCESS
) {
43
exit
(-1);
44
}
45
46
rv =
apr_shm_attach
(&
shm
,
SHARED_FILENAME
,
pool
);
47
if
(rv !=
APR_SUCCESS
) {
48
exit
(-2);
49
}
50
51
boxes
=
apr_shm_baseaddr_get
(
shm
);
52
53
/* consume messages on all of the boxes */
54
recvd
=
msgwait
(
MSG
,
N_MESSAGES
, 30, 1);
55
56
rv =
apr_shm_detach
(
shm
);
57
if
(rv !=
APR_SUCCESS
) {
58
exit
(-3);
59
}
60
61
return
recvd
;
62
}
63
64
#else
/* APR_HAS_SHARED_MEMORY */
65
66
int
main
(
void
)
67
{
68
/* Just return, this program will never be called, so we don't need
69
* to print a message
70
*/
71
return
0;
72
}
73
74
#endif
/* APR_HAS_SHARED_MEMORY */
75
apr_errno.h
APR Error Codes.
apr_general.h
APR Miscellaneous library routines.
apr_lib.h
APR general purpose library routines.
apr_shm.h
APR Shared Memory Routines.
apr_strings.h
APR Strings library.
apr_time.h
APR Time Library.
size
apr_size_t size
Definition
apr_allocator.h:115
pool
const char int apr_pool_t * pool
Definition
apr_cstr.h:84
APR_SUCCESS
#define APR_SUCCESS
Definition
apr_errno.h:225
apr_status_t
int apr_status_t
Definition
apr_errno.h:44
apr_pool_create
#define apr_pool_create(newpool, parent)
Definition
apr_pools.h:322
shm
apr_shm_t * shm
Definition
apr_portable.h:293
NULL
return NULL
Definition
mod_so.c:359
apr_pool_t
Definition
apr_pools.c:562
apr_shm_t
Definition
apr_arch_shm.h:61
testshm.h
MSG
#define MSG
Definition
testshm.h:37
boxes
mbox * boxes
Definition
testshm.h:31
SHARED_FILENAME
#define SHARED_FILENAME
Definition
testshm.h:36
N_MESSAGES
#define N_MESSAGES
Definition
testshm.h:34
main
int main(void)
Definition
testshmconsumer.c:66
Generated by
1.9.8