本文整理汇总了C++中CommandArgs::GetExecArgs方法的典型用法代码示例。如果您正苦于以下问题:C++ CommandArgs::GetExecArgs方法的具体用法?C++ CommandArgs::GetExecArgs怎么用?C++ CommandArgs::GetExecArgs使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CommandArgs
的用法示例。
在下文中一共展示了CommandArgs::GetExecArgs方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: container_main
int container_main(void* arg)
{
// no need to delete it because we execv finally.
CommandArgs* args = reinterpret_cast<CommandArgs*>(arg);
printf("Container [%d] - inside the container!\n", getpid());
printf("Container: eUID = %ld; eGID = %ld, UID=%ld, GID=%ld\n",
(long) geteuid(), (long) getegid(), (long) getuid(), (long) getgid());
char ch;
close(pipefd[1]);
int ret = read(pipefd[0], &ch, 1);
if (ret < 0) {
printf("Error: read failed: %d, %s\n", errno, strerror(errno));
return 1;
}
close(pipefd[0]);
printf("Container: eUID = %ld; eGID = %ld, UID=%ld, GID=%ld\n",
(long) geteuid(), (long) getegid(), (long) getuid(), (long) getgid());
mount("proc", "/proc", "proc", 0, NULL);
char** argv = args->GetExecArgs();
execv(argv[0], argv);
printf("Something's wrong!\n");
return 1;
}