diff options
author | rbb <rbb@13f79535-47bb-0310-9956-ffa450edef68> | 2001-07-16 16:11:05 +0000 |
---|---|---|
committer | rbb <rbb@13f79535-47bb-0310-9956-ffa450edef68> | 2001-07-16 16:11:05 +0000 |
commit | 0ae8a25e10d3e204cd9c0a4e2337e54c6f2bda76 (patch) | |
tree | 886c25dacc1462ca312253fd18f05fe3c616ce37 /include/apr_inherit.h | |
parent | 7d25c418141c496633f6552912298b690b31fcf4 (diff) | |
download | libapr-0ae8a25e10d3e204cd9c0a4e2337e54c6f2bda76.tar.gz |
Added an inherit flag to apr_socket_create and other socket creation
functions. This allows APR programs to specify that a socket should
be passed to any child processes that are created. The inherit flag
is only meaningful if programs use apr_process_create(). This
also adds a couple of macros that allow APR types to set and unset
the inherit flag.
This also fixes Apache to use the new API.
git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@61939 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'include/apr_inherit.h')
-rw-r--r-- | include/apr_inherit.h | 91 |
1 files changed, 91 insertions, 0 deletions
diff --git a/include/apr_inherit.h b/include/apr_inherit.h new file mode 100644 index 000000000..3b1882095 --- /dev/null +++ b/include/apr_inherit.h @@ -0,0 +1,91 @@ +/* ==================================================================== + * The Apache Software License, Version 1.1 + * + * Copyright (c) 2000-2001 The Apache Software Foundation. All rights + * reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * 3. The end-user documentation included with the redistribution, + * if any, must include the following acknowledgment: + * "This product includes software developed by the + * Apache Software Foundation (http://www.apache.org/)." + * Alternately, this acknowledgment may appear in the software itself, + * if and wherever such third-party acknowledgments normally appear. + * + * 4. The names "Apache" and "Apache Software Foundation" must + * not be used to endorse or promote products derived from this + * software without prior written permission. For written + * permission, please contact apache@apache.org. + * + * 5. Products derived from this software may not be called "Apache", + * nor may "Apache" appear in their name, without prior written + * permission of the Apache Software Foundation. + * + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR + * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF + * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * ==================================================================== + * + * This software consists of voluntary contributions made by many + * individuals on behalf of the Apache Software Foundation. For more + * information on the Apache Software Foundation, please see + * <http://www.apache.org/>. + */ + +#ifndef APR_INHERIT_H +#define APR_INHERIT_H + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +#define APR_NO_INHERIT 0 +#define APR_INHERIT 1 + +#define APR_DECLARE_SET_INHERIT(name) \ + void apr_##name##_set_inherit(apr_##name##_t *name) + +#define APR_SET_INHERIT(name, pool, cleanup, field_exists) \ +void apr_##name##_set_inherit(apr_##name##_t *name) \ +{ \ + name->inherit = 1; \ + apr_pool_cleanup_register(name->##pool, (void *)##name##, NULL, \ + cleanup); \ +} + +#define APR_DECLARE_UNSET_INHERIT(name) \ + void apr_##name##_unset_inherit(apr_##name##_t *name) + +#define APR_UNSET_INHERIT(name, pool, cleanup, field_exists) \ +void apr_##name##_unset_inherit(apr_##name##_t *name) \ +{ \ + name->inherit = 0; \ + apr_pool_cleanup_kill(name->##pool, (void *)##name##, NULL, \ + cleanup); \ +} + +#ifdef __cplusplus +} +#endif + +#endif /* ! APR_INHERIT_H */ |