首页 > 其他 > 详细

NDK下vfork+execl启动程序

时间:2015-07-27 12:33:46      阅读:237      评论:0      收藏:0      [点我收藏+]
        pid_t _pid = vfork();
        if (_pid == 0)
        {//child process
            LOGV("[ContextSharing]in child process.");
            std::string s = std::string(MODEL_DIRECTORY) + "alljoyn_sharer";
            if (0 == chmod(s.c_str(), 00777))
            {
                if (execl(s.c_str(), "execl", s.c_str(), (char *)0) == -1)
                {
                    LOGV("[ContextSharing]execl() failed! %s", strerror(errno));
                }
            }
         }

  

如果使用

execl(s.c_str(), NULL)

则会崩溃,原因未知。

 

 

NDK下vfork+execl启动程序

原文:http://www.cnblogs.com/chutianyao/p/3374386.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!