if (in) {
if (in == APR_CHILD_BLOCK)
in = APR_READ_BLOCK;
else if (in == APR_PARENT_BLOCK) u
in = APR_WRITE_BLOCK;
stat = apr_create_nt_pipe(&attr->child_in, &attr->parent_in, in,
attr->pool);
if (stat == APR_SUCCESS)
stat = apr_file_inherit_unset(attr->parent_in);
}
if (out && stat == APR_SUCCESS) {
stat = apr_create_nt_pipe(&attr->parent_out, &attr->child_out, out,
attr->pool); v
if (stat == APR_SUCCESS)
stat = apr_file_inherit_unset(attr->parent_out);
}
if (err && stat == APR_SUCCESS) {
stat = apr_create_nt_pipe(&attr->parent_err, &attr->child_err, err,
attr->pool); w
if (stat == APR_SUCCESS)
stat = apr_file_inherit_unset(attr->parent_err);
}
return stat;
}
在Window下,管道的创建通过内部函数apr_create_nt_pipe实现,具体的创建细节我们在第七章的”管道章节”会详细描述。不过在Window管道中,
■ 第二部分
■ 第三部分
第三部分的内容是Window所独有的,主要用于Window的安全性。为了了解这几个成员的真实含义,我们必须对Window 的安全性有一定的了解。
首先我们来看use_token,它是一个HANDLE类型,表示用户的访问令牌。与Window9X系列操作系统相比,Window NT以上的版本的安全性都得到了极大的提高。在Windows中,安全性是指将对象所受的保护与用户的访问权进行比较。如果用户拥有足够的访问权(访问权等于或超过对象所受的保护),则用户能够使用这个对象。在Windows 的文档中将对象所受保护的级别称作安全描述符(securitydescriptor),这是一种结构,它能告诉安全系统:用户需要什么样的权力才能访问这个对象;而用户则有一个访问令牌(Access),它是另一种结构,它能告诉安全系统:在一个给定的位置,用户有什么样的访问权。令牌包括多方面的内容:用户安全标示符(SID)、组SID列表、特权列表和模拟(Impersonating)信息,可以用下图描述:
Token
关于作者 张中庆,目前主要的研究方向是嵌入式浏览器,移动中间件以及大规模服务器设计。目前正在进行Apache的源代码分析,计划出版《Apache源代码全景分析》上下册。Apache系列文章为本书的草案部分,对Apache感兴趣的朋友可以通过flydish1234 at sina.com.cn与之联系!