本文整理汇总了C++中ACE_Process_Options::getruid方法的典型用法代码示例。如果您正苦于以下问题:C++ ACE_Process_Options::getruid方法的具体用法?C++ ACE_Process_Options::getruid怎么用?C++ ACE_Process_Options::getruid使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ACE_Process_Options
的用法示例。
在下文中一共展示了ACE_Process_Options::getruid方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: if
//.........这里部分代码省略.........
&& ACE_OS::setpgid (0,
options.getgroup ()) < 0)
{
#if !defined (ACE_HAS_THREADS)
// We can't emit this log message because ACE_ERROR(), etc.
// will invoke async signal unsafe functions, which results
// in undefined behavior in threaded programs.
ACE_ERROR ((LM_ERROR,
ACE_TEXT ("%p.\n"),
ACE_TEXT ("ACE_Process::spawn: setpgid failed.")));
#endif
}
# endif /* ACE_LACKS_SETPGID */
# if !defined (ACE_LACKS_SETREGID)
if (options.getrgid () != (uid_t) -1
|| options.getegid () != (uid_t) -1)
if (ACE_OS::setregid (options.getrgid (),
options.getegid ()) == -1)
{
#if !defined (ACE_HAS_THREADS)
// We can't emit this log message because ACE_ERROR(), etc.
// will invoke async signal unsafe functions, which results
// in undefined behavior in threaded programs.
ACE_ERROR ((LM_ERROR,
ACE_TEXT ("%p.\n"),
ACE_TEXT ("ACE_Process::spawn: setregid failed.")));
#endif
}
# endif /* ACE_LACKS_SETREGID */
# if !defined (ACE_LACKS_SETREUID)
// Set user and group id's.
if (options.getruid () != (uid_t) -1
|| options.geteuid () != (uid_t) -1)
if (ACE_OS::setreuid (options.getruid (),
options.geteuid ()) == -1)
{
#if !defined (ACE_HAS_THREADS)
// We can't emit this log message because ACE_ERROR(), etc.
// will invoke async signal unsafe functions, which results
// in undefined behavior in threaded programs.
ACE_ERROR ((LM_ERROR,
ACE_TEXT ("%p.\n"),
ACE_TEXT ("ACE_Process::spawn: setreuid failed.")));
#endif
}
# endif /* ACE_LACKS_SETREUID */
this->child (ACE_OS::getppid ());
}
else if (this->child_id_ != -1)
this->parent (this->child_id_);
// If we're not supposed to exec, return the process id.
if (ACE_BIT_ENABLED (options.creation_flags (),
ACE_Process_Options::NO_EXEC))
return this->child_id_;
switch (this->child_id_)
{
case -1:
// Error.
return ACE_INVALID_PID;
case 0:
// Child process...exec the