GME  13
apr_arch_inherit.h
Go to the documentation of this file.
00001 /* Licensed to the Apache Software Foundation (ASF) under one or more
00002  * contributor license agreements.  See the NOTICE file distributed with
00003  * this work for additional information regarding copyright ownership.
00004  * The ASF licenses this file to You under the Apache License, Version 2.0
00005  * (the "License"); you may not use this file except in compliance with
00006  * the License.  You may obtain a copy of the License at
00007  *
00008  *     http://www.apache.org/licenses/LICENSE-2.0
00009  *
00010  * Unless required by applicable law or agreed to in writing, software
00011  * distributed under the License is distributed on an "AS IS" BASIS,
00012  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00013  * See the License for the specific language governing permissions and
00014  * limitations under the License.
00015  */
00016 
00017 #ifndef INHERIT_H
00018 #define INHERIT_H
00019 
00020 #include "apr_inherit.h"
00021 
00022 #define APR_INHERIT (1 << 24)    /* Must not conflict with other bits */
00023 
00024 #define APR_IMPLEMENT_INHERIT_SET(name, flag, pool, cleanup)        \
00025 APR_DECLARE(apr_status_t) apr_##name##_inherit_set(apr_##name##_t *the##name) \
00026 {                                                                   \
00027     int rv;                                                         \
00028     ULONG state;                                                    \
00029     if (((rv = DosQueryFHState(attr->parent_err->filedes, &state))  \
00030             != 0) ||                                                \
00031         ((rv = DosSetFHState(attr->parent_err->filedes,             \
00032                             state & ~OPEN_FLAGS_NOINHERIT)) != 0))  \
00033         return APR_FROM_OS_ERROR(rv);                               \
00034     return APR_SUCCESS;                                             \
00035 }
00036 
00037 #define APR_IMPLEMENT_INHERIT_UNSET(name, flag, pool, cleanup)      \
00038 APR_DECLARE(apr_status_t) apr_##name##_inherit_unset(apr_##name##_t *the##name)\
00039 {                                                                   \
00040     int rv;                                                         \
00041     ULONG state;                                                    \
00042     if (((rv = DosQueryFHState(attr->parent_err->filedes, &state))  \
00043             != 0) ||                                                \
00044         ((rv = DosSetFHState(attr->parent_err->filedes,             \
00045                             state | OPEN_FLAGS_NOINHERIT)) != 0))   \
00046         return APR_FROM_OS_ERROR(rv);                               \
00047     return APR_SUCCESS;                                             \
00048 }
00049 
00050 #endif  /* ! INHERIT_H */