本文整理汇总了C++中ACE_Process_Options::release_handles方法的典型用法代码示例。如果您正苦于以下问题:C++ ACE_Process_Options::release_handles方法的具体用法?C++ ACE_Process_Options::release_handles怎么用?C++ ACE_Process_Options::release_handles使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ACE_Process_Options
的用法示例。
在下文中一共展示了ACE_Process_Options::release_handles方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: io
void
SO_Group::add_executable (const char * path)
{
ACE_Process proc;
ACE_Process_Options opts;
ACE_HANDLE pipe[2];
ACE_Pipe io(pipe);
opts.set_handles (ACE_STDIN,pipe[1]);
int result = opts.command_line ("ldd %s",path);
// Prevent compiler warning about "unused variable" if ACE_ASSERT is
// an empty macro.
ACE_UNUSED_ARG (result);
ACE_ASSERT (result == 0);
proc.spawn (opts);
if (ACE_OS::close(pipe[1]) == -1)
ACE_DEBUG ((LM_DEBUG, "%p\n", "close"));
opts.release_handles();
const int max_line_length = 1000;
char line[max_line_length];
while (1) {
ACE_OS::memset (line,0,max_line_length);
int len = 0;
int nread = 0;
int bogus = 0;
// skip initial whitespace
while ((nread = ACE_OS::read(pipe[0],line,1)) == 1 &&
(*line == ' ' || *line == '\t'));
if (nread != 1)
break;
// read the library name
len = 1;
while ((nread = ACE_OS::read(pipe[0],line + len,1)) == 1 &&
(line[len] != ' '))
if (! bogus && ++len == max_line_length)
{
bogus = 1;
break;
}
if (nread != 1 || bogus)
break;
line[len] = 0;
char * dot = ACE_OS::strchr (line,'.');
if (dot)
*dot = 0;
char * libname = line + 3; // skip over "lib"
// check to see if this is a new library
int found = 0;
for (int i = 0; !found && i < num_libs_; i++)
found = (libs_[i]->name() == libname);
if (!found) {
Library *nlib = new Library(libname);
ACE_OS::memset (line,0,max_line_length);
// skip over '=> '
if (ACE_OS::read(pipe[0],line,3) != 3)
break;
// get library path
len = 0;
while ((nread = ACE_OS::read(pipe[0],line + len,1)) == 1 &&
(line[len] != ' '))
if (! bogus && ++len == max_line_length)
{
bogus = 1;
break;
}
if (nread != 1 || bogus)
break;
line[len] = 0;
nlib->set_path (line);
libs_[num_libs_++] = nlib;
ACE_ASSERT (num_libs_ < max_libs_); // grow max libs?
}
// skip the rest of the line
while ((nread = ACE_OS::read(pipe[0],line,1)) == 1 && *line != '\n');
if (nread != 1)
break;
}
proc.wait ();
ACE_OS::close (pipe[0]);
undef_wrapper_.add_source(path,1);
// now do the ldd, iterate over the results to add new libs, etc.
}