Main Page | Modules | Data Structures | File List | Data Fields | Globals | Related Pages

apr_signal.h

Go to the documentation of this file.
00001 /* Copyright 2000-2004 The Apache Software Foundation
00002  *
00003  * Licensed under the Apache License, Version 2.0 (the "License");
00004  * you may not use this file except in compliance with the License.
00005  * You may obtain a copy of the License at
00006  *
00007  *     http://www.apache.org/licenses/LICENSE-2.0
00008  *
00009  * Unless required by applicable law or agreed to in writing, software
00010  * distributed under the License is distributed on an "AS IS" BASIS,
00011  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00012  * See the License for the specific language governing permissions and
00013  * limitations under the License.
00014  */
00015 
00016 #ifndef APR_SIGNAL_H
00017 #define APR_SIGNAL_H
00018 
00019 /**
00020  * @file apr_signal.h 
00021  * @brief APR Signal Handling
00022  */
00023 
00024 #include "apr.h"
00025 #include "apr_pools.h"
00026 
00027 #if APR_HAVE_SIGNAL_H
00028 #include <signal.h>
00029 #endif
00030 
00031 #ifdef __cplusplus
00032 extern "C" {
00033 #endif /* __cplusplus */
00034 
00035 /**
00036  * @defgroup apr_signal Handling
00037  * @ingroup APR 
00038  * @{
00039  */
00040 
00041 #if APR_HAVE_SIGACTION || defined(DOXYGEN)
00042 
00043 #if defined(DARWIN) && !defined(__cplusplus) && !defined(_ANSI_SOURCE)
00044 /* work around Darwin header file bugs
00045  *   http://www.opensource.apple.com/bugs/X/BSD%20Kernel/2657228.html
00046  */
00047 #undef SIG_DFL
00048 #undef SIG_IGN
00049 #undef SIG_ERR
00050 #define SIG_DFL (void (*)(int))0
00051 #define SIG_IGN (void (*)(int))1
00052 #define SIG_ERR (void (*)(int))-1
00053 #endif
00054 
00055 /** Function prototype for signal handlers */
00056 typedef void apr_sigfunc_t(int);
00057 
00058 /**
00059  * Set the signal handler function for a given signal
00060  * @param signo The signal (eg... SIGWINCH)
00061  * @param func the function to get called
00062  */
00063 APR_DECLARE(apr_sigfunc_t *) apr_signal(int signo, apr_sigfunc_t * func);
00064 
00065 #if defined(SIG_IGN) && !defined(SIG_ERR)
00066 #define SIG_ERR ((apr_sigfunc_t *) -1)
00067 #endif
00068 
00069 #else /* !APR_HAVE_SIGACTION */
00070 #define apr_signal(a, b) signal(a, b)
00071 #endif
00072 
00073 
00074 /**
00075  * Get the description for a specific signal number
00076  * @param signum The signal number
00077  * @return The description of the signal
00078  */
00079 APR_DECLARE(const char *) apr_signal_description_get(int signum);
00080 
00081 /**
00082  * APR-private function for initializing the signal package
00083  * @internal
00084  * @param pglobal The internal, global pool
00085  */
00086 void apr_signal_init(apr_pool_t *pglobal);
00087 
00088 /**
00089  * Block the delivery of a particular signal
00090  * @param signum The signal number
00091  * @return status
00092  */
00093 APR_DECLARE(apr_status_t) apr_signal_block(int signum);
00094 
00095 /**
00096  * Enable the delivery of a particular signal
00097  * @param signum The signal number
00098  * @return status
00099  */
00100 APR_DECLARE(apr_status_t) apr_signal_unblock(int signum);
00101 
00102 /** @} */
00103 
00104 #ifdef __cplusplus
00105 }
00106 #endif /* __cplusplus */
00107 
00108 #endif /* APR_SIGNAL_H */

Generated on Sun Mar 20 19:52:26 2005 for Apache Portable Runtime by  doxygen 1.3.9.1