📄 apr__thread__proc_8h-source.html
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
<title>Apache Portable Runtime: apr_thread_proc.h Source File</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.3.7 -->
<div class="qindex"><a class="qindex" href="index.html">Main Page</a> | <a class="qindex" href="modules.html">Modules</a> | <a class="qindex" href="annotated.html">Data Structures</a> | <a class="qindex" href="files.html">File List</a> | <a class="qindex" href="functions.html">Data Fields</a> | <a class="qindex" href="globals.html">Globals</a> | <a class="qindex" href="pages.html">Related Pages</a></div>
<h1>apr_thread_proc.h</h1><a href="apr__thread__proc_8h.html">Go to the documentation of this file.</a><pre class="fragment"><div>00001 <span class="comment">/* Copyright 2000-2005 The Apache Software Foundation or its licensors, as</span>
00002 <span class="comment"> * applicable.</span>
00003 <span class="comment"> *</span>
00004 <span class="comment"> * Licensed under the Apache License, Version 2.0 (the "License");</span>
00005 <span class="comment"> * you may not use this file except in compliance with the License.</span>
00006 <span class="comment"> * You may obtain a copy of the License at</span>
00007 <span class="comment"> *</span>
00008 <span class="comment"> * http://www.apache.org/licenses/LICENSE-2.0</span>
00009 <span class="comment"> *</span>
00010 <span class="comment"> * Unless required by applicable law or agreed to in writing, software</span>
00011 <span class="comment"> * distributed under the License is distributed on an "AS IS" BASIS,</span>
00012 <span class="comment"> * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.</span>
00013 <span class="comment"> * See the License for the specific language governing permissions and</span>
00014 <span class="comment"> * limitations under the License.</span>
00015 <span class="comment"> */</span>
00016
00017 <span class="preprocessor">#ifndef APR_THREAD_PROC_H</span>
00018 <span class="preprocessor"></span><span class="preprocessor">#define APR_THREAD_PROC_H</span>
00019 <span class="preprocessor"></span><span class="comment"></span>
00020 <span class="comment">/**</span>
00021 <span class="comment"> * @file apr_thread_proc.h</span>
00022 <span class="comment"> * @brief APR Thread and Process Library</span>
00023 <span class="comment"> */</span>
00024
00025 <span class="preprocessor">#include "apr.h"</span>
00026 <span class="preprocessor">#include "<a class="code" href="apr__file__io_8h.html">apr_file_io.h</a>"</span>
00027 <span class="preprocessor">#include "<a class="code" href="apr__pools_8h.html">apr_pools.h</a>"</span>
00028 <span class="preprocessor">#include "<a class="code" href="apr__errno_8h.html">apr_errno.h</a>"</span>
00029
00030 <span class="preprocessor">#if APR_HAVE_STRUCT_RLIMIT</span>
00031 <span class="preprocessor"></span><span class="preprocessor">#include <sys/time.h></span>
00032 <span class="preprocessor">#include <sys/resource.h></span>
00033 <span class="preprocessor">#endif</span>
00034 <span class="preprocessor"></span>
00035 <span class="preprocessor">#ifdef __cplusplus</span>
00036 <span class="preprocessor"></span><span class="keyword">extern</span> <span class="stringliteral">"C"</span> {
00037 <span class="preprocessor">#endif </span><span class="comment">/* __cplusplus */</span>
00038 <span class="comment"></span>
00039 <span class="comment">/**</span>
00040 <span class="comment"> * @defgroup apr_thread_proc Threads and Process Functions</span>
00041 <span class="comment"> * @ingroup APR </span>
00042 <span class="comment"> * @{</span>
00043 <span class="comment"> */</span>
00044
<a name="l00045"></a><a class="code" href="group__apr__thread__proc.html#ga68">00045</a> <span class="keyword">typedef</span> <span class="keyword">enum</span> {
00046 <a class="code" href="group__apr__thread__proc.html#gga68a29">APR_SHELLCMD</a>, <span class="comment">/**< use the shell to invoke the program */</span>
00047 <a class="code" href="group__apr__thread__proc.html#gga68a30">APR_PROGRAM</a>, <span class="comment">/**< invoke the program directly, no copied env */</span>
00048 <a class="code" href="group__apr__thread__proc.html#gga68a31">APR_PROGRAM_ENV</a>, <span class="comment">/**< invoke the program, replicating our environment */</span>
00049 <a class="code" href="group__apr__thread__proc.html#gga68a32">APR_PROGRAM_PATH</a>, <span class="comment">/**< find program on PATH, use our environment */</span>
00050 <a class="code" href="group__apr__thread__proc.html#gga68a33">APR_SHELLCMD_ENV</a> <span class="comment">/**< use the shell to invoke the program,</span>
00051 <span class="comment"> * replicating our environment</span>
00052 <span class="comment"> */</span>
00053 } <a class="code" href="group__apr__thread__proc.html#ga68">apr_cmdtype_e</a>;
00054
<a name="l00055"></a><a class="code" href="group__apr__thread__proc.html#ga69">00055</a> <span class="keyword">typedef</span> <span class="keyword">enum</span> {
00056 <a class="code" href="group__apr__thread__proc.html#gga69a34">APR_WAIT</a>, <span class="comment">/**< wait for the specified process to finish */</span>
00057 <a class="code" href="group__apr__thread__proc.html#gga69a35">APR_NOWAIT</a> <span class="comment">/**< do not wait -- just see if it has finished */</span>
00058 } <a class="code" href="group__apr__thread__proc.html#ga69">apr_wait_how_e</a>;
00059
00060 <span class="comment">/* I am specifically calling out the values so that the macros below make</span>
00061 <span class="comment"> * more sense. Yes, I know I don't need to, but I am hoping this makes what</span>
00062 <span class="comment"> * I am doing more clear. If you want to add more reasons to exit, continue</span>
00063 <span class="comment"> * to use bitmasks.</span>
00064 <span class="comment"> */</span>
<a name="l00065"></a><a class="code" href="group__apr__thread__proc.html#ga70">00065</a> <span class="keyword">typedef</span> <span class="keyword">enum</span> {
00066 <a class="code" href="group__apr__thread__proc.html#gga70a36">APR_PROC_EXIT</a> = 1, <span class="comment">/**< process exited normally */</span>
00067 <a class="code" href="group__apr__thread__proc.html#gga70a37">APR_PROC_SIGNAL</a> = 2, <span class="comment">/**< process exited due to a signal */</span>
00068 <a class="code" href="group__apr__thread__proc.html#gga70a38">APR_PROC_SIGNAL_CORE</a> = 4 <span class="comment">/**< process exited and dumped a core file */</span>
00069 } <a class="code" href="group__apr__thread__proc.html#ga70">apr_exit_why_e</a>;
00070 <span class="comment"></span>
00071 <span class="comment">/** did we exit the process */</span>
<a name="l00072"></a><a class="code" href="group__apr__thread__proc.html#ga54">00072</a> <span class="preprocessor">#define APR_PROC_CHECK_EXIT(x) (x & APR_PROC_EXIT)</span>
00073 <span class="preprocessor"></span><span class="comment">/** did we get a signal */</span>
<a name="l00074"></a><a class="code" href="group__apr__thread__proc.html#ga55">00074</a> <span class="preprocessor">#define APR_PROC_CHECK_SIGNALED(x) (x & APR_PROC_SIGNAL)</span>
00075 <span class="preprocessor"></span><span class="comment">/** did we get core */</span>
<a name="l00076"></a><a class="code" href="group__apr__thread__proc.html#ga56">00076</a> <span class="preprocessor">#define APR_PROC_CHECK_CORE_DUMP(x) (x & APR_PROC_SIGNAL_CORE)</span>
00077 <span class="preprocessor"></span><span class="comment"></span>
00078 <span class="comment">/** @see apr_procattr_io_set */</span>
<a name="l00079"></a><a class="code" href="group__apr__thread__proc.html#ga57">00079</a> <span class="preprocessor">#define APR_NO_PIPE 0</span>
00080 <span class="preprocessor"></span><span class="comment"></span>
00081 <span class="comment">/** @see apr_procattr_io_set */</span>
<a name="l00082"></a><a class="code" href="group__apr__thread__proc.html#ga58">00082</a> <span class="preprocessor">#define APR_FULL_BLOCK 1</span>
00083 <span class="preprocessor"></span><span class="comment">/** @see apr_procattr_io_set */</span>
<a name="l00084"></a><a class="code" href="group__apr__thread__proc.html#ga59">00084</a> <span class="preprocessor">#define APR_FULL_NONBLOCK 2</span>
00085 <span class="preprocessor"></span><span class="comment">/** @see apr_procattr_io_set */</span>
<a name="l00086"></a><a class="code" href="group__apr__thread__proc.html#ga60">00086</a> <span class="preprocessor">#define APR_PARENT_BLOCK 3</span>
00087 <span class="preprocessor"></span><span class="comment">/** @see apr_procattr_io_set */</span>
<a name="l00088"></a><a class="code" href="group__apr__thread__proc.html#ga61">00088</a> <span class="preprocessor">#define APR_CHILD_BLOCK 4</span>
00089 <span class="preprocessor"></span><span class="comment"></span>
00090 <span class="comment">/** @see apr_procattr_limit_set */</span>
<a name="l00091"></a><a class="code" href="group__apr__thread__proc.html#ga62">00091</a> <span class="preprocessor">#define APR_LIMIT_CPU 0</span>
00092 <span class="preprocessor"></span><span class="comment">/** @see apr_procattr_limit_set */</span>
<a name="l00093"></a><a class="code" href="group__apr__thread__proc.html#ga63">00093</a> <span class="preprocessor">#define APR_LIMIT_MEM 1</span>
00094 <span class="preprocessor"></span><span class="comment">/** @see apr_procattr_limit_set */</span>
<a name="l00095"></a><a class="code" href="group__apr__thread__proc.html#ga64">00095</a> <span class="preprocessor">#define APR_LIMIT_NPROC 2</span>
00096 <span class="preprocessor"></span><span class="comment">/** @see apr_procattr_limit_set */</span>
<a name="l00097"></a><a class="code" href="group__apr__thread__proc.html#ga65">00097</a> <span class="preprocessor">#define APR_LIMIT_NOFILE 3</span>
00098 <span class="preprocessor"></span><span class="comment"></span>
00099 <span class="comment">/**</span>
00100 <span class="comment"> * @defgroup APR_OC Other Child Flags</span>
00101 <span class="comment"> * @{</span>
00102 <span class="comment"> */</span>
<a name="l00103"></a><a class="code" href="group___a_p_r___o_c.html#ga0">00103</a> <span class="preprocessor">#define APR_OC_REASON_DEATH 0 </span><span class="comment">/**< child has died, caller must call</span>
00104 <span class="comment"> * unregister still */</span>
<a name="l00105"></a><a class="code" href="group___a_p_r___o_c.html#ga1">00105</a> <span class="preprocessor">#define APR_OC_REASON_UNWRITABLE 1 </span><span class="comment">/**< write_fd is unwritable */</span>
<a name="l00106"></a><a class="code" href="group___a_p_r___o_c.html#ga2">00106</a> <span class="preprocessor">#define APR_OC_REASON_RESTART 2 </span><span class="comment">/**< a restart is occuring, perform</span>
00107 <span class="comment"> * any necessary cleanup (including</span>
00108 <span class="comment"> * sending a special signal to child)</span>
00109 <span class="comment"> */</span>
<a name="l00110"></a><a class="code" href="group___a_p_r___o_c.html#ga3">00110</a> <span class="preprocessor">#define APR_OC_REASON_UNREGISTER 3 </span><span class="comment">/**< unregister has been called, do</span>
00111 <span class="comment"> * whatever is necessary (including</span>
00112 <span class="comment"> * kill the child) */</span>
<a name="l00113"></a><a class="code" href="group___a_p_r___o_c.html#ga4">00113</a> <span class="preprocessor">#define APR_OC_REASON_LOST 4 </span><span class="comment">/**< somehow the child exited without</span>
00114 <span class="comment"> * us knowing ... buggy os? */</span>
<a name="l00115"></a><a class="code" href="group___a_p_r___o_c.html#ga5">00115</a> <span class="preprocessor">#define APR_OC_REASON_RUNNING 5 </span><span class="comment">/**< a health check is occuring, </span>
00116 <span class="comment"> * for most maintainence functions</span>
00117 <span class="comment"> * this is a no-op.</span>
00118 <span class="comment"> */</span>
00119 <span class="comment">/** @} */</span>
00120 <span class="comment"></span>
00121 <span class="comment">/** The APR process type */</span>
<a name="l00122"></a><a class="code" href="structapr__proc__t.html">00122</a> <span class="keyword">typedef</span> <span class="keyword">struct </span><a class="code" href="structapr__proc__t.html">apr_proc_t</a> {<span class="comment"></span>
00123 <span class="comment"> /** The process ID */</span>
<a name="l00124"></a><a class="code" href="structapr__proc__t.html#o0">00124</a> pid_t <a class="code" href="structapr__proc__t.html#o0">pid</a>;<span class="comment"></span>
00125 <span class="comment"> /** Parent's side of pipe to child's stdin */</span>
<a name="l00126"></a><a class="code" href="structapr__proc__t.html#o1">00126</a> <a class="code" href="group__apr__file__io.html#ga2">apr_file_t</a> *<a class="code" href="structapr__proc__t.html#o1">in</a>;<span class="comment"></span>
00127 <span class="comment"> /** Parent's side of pipe to child's stdout */</span>
<a name="l00128"></a><a class="code" href="structapr__proc__t.html#o2">00128</a> <a class="code" href="group__apr__file__io.html#ga2">apr_file_t</a> *<a class="code" href="structapr__proc__t.html#o2">out</a>;<span class="comment"></span>
00129 <span class="comment"> /** Parent's side of pipe to child's stdouterr */</span>
<a name="l00130"></a><a class="code" href="structapr__proc__t.html#o3">00130</a> <a class="code" href="group__apr__file__io.html#ga2">apr_file_t</a> *<a class="code" href="structapr__proc__t.html#o3">err</a>;
00131 <span class="preprocessor">#if APR_HAS_PROC_INVOKED || defined(DOXYGEN)</span>
00132 <span class="preprocessor"></span><span class="comment"> /** Diagnositics/debugging string of the command invoked for </span>
00133 <span class="comment"> * this process [only present if APR_HAS_PROC_INVOKED is true]</span>
00134 <span class="comment"> * @remark Only enabled on Win32 by default.</span>
00135 <span class="comment"> * @bug This should either always or never be present in release</span>
00136 <span class="comment"> * builds - since it breaks binary compatibility. We may enable</span>
00137 <span class="comment"> * it always in APR 1.0 yet leave it undefined in most cases.</span>
00138 <span class="comment"> */</span>
<a name="l00139"></a><a class="code" href="structapr__proc__t.html#o4">00139</a> <span class="keywordtype">char</span> *<a class="code" href="structapr__proc__t.html#o4">invoked</a>;
00140 <span class="preprocessor">#endif</span>
00141 <span class="preprocessor"></span><span class="preprocessor">#if defined(WIN32) || defined(DOXYGEN)</span>
00142 <span class="preprocessor"></span><span class="comment"> /** (Win32 only) Creator's handle granting access to the process</span>
00143 <span class="comment"> * @remark This handle is closed and reset to NULL in every case</span>
00144 <span class="comment"> * corresponding to a waitpid() on Unix which returns the exit status.</span>
00145 <span class="comment"> * Therefore Win32 correspond's to Unix's zombie reaping characteristics</span>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -