1251875Speter/* Licensed to the Apache Software Foundation (ASF) under one or more
2251875Speter * contributor license agreements.  See the NOTICE file distributed with
3251875Speter * this work for additional information regarding copyright ownership.
4251875Speter * The ASF licenses this file to You under the Apache License, Version 2.0
5251875Speter * (the "License"); you may not use this file except in compliance with
6251875Speter * the License.  You may obtain a copy of the License at
7251875Speter *
8251875Speter *     http://www.apache.org/licenses/LICENSE-2.0
9251875Speter *
10251875Speter * Unless required by applicable law or agreed to in writing, software
11251875Speter * distributed under the License is distributed on an "AS IS" BASIS,
12251875Speter * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13251875Speter * See the License for the specific language governing permissions and
14251875Speter * limitations under the License.
15251875Speter */
16251875Speter
17251875Speter/* common .c
18251875Speter * This file has any function that is truly common and platform
19251875Speter * neutral.  Or at least that's the theory.
20251875Speter *
21251875Speter * The header files are a problem so there are a few #ifdef's to take
22251875Speter * care of those.
23251875Speter *
24251875Speter */
25251875Speter
26251875Speter#include "apr.h"
27251875Speter#include "apr_private.h"
28251875Speter#include "apr_mmap.h"
29251875Speter#include "apr_errno.h"
30251875Speter
31251875Speter#if APR_HAS_MMAP || defined(BEOS)
32251875Speter
33251875SpeterAPR_DECLARE(apr_status_t) apr_mmap_offset(void **addr, apr_mmap_t *mmap,
34251875Speter                                          apr_off_t offset)
35251875Speter{
36251875Speter    if (offset < 0 || (apr_size_t)offset > mmap->size)
37251875Speter        return APR_EINVAL;
38251875Speter
39251875Speter    (*addr) = (char *) mmap->mm + offset;
40251875Speter    return APR_SUCCESS;
41251875Speter}
42251875Speter
43251875Speter#endif
44