daemon(0,0)

#include <unistd.h>
int daemon(int nochdir,int noclose)
在创建精灵进程的时候,往往需要将精灵进程的工作目录修改为"/"根目录
并且将标准输入,输出和错误输出重定向到/dev/null
daemon的作用就是当参数nochdir为0时,将根目录修改为工作目录
noclose为0时,做输入,输出以及错误输出重定向到/dev/null
执行成功返回0
错误返回-1 ......
string strMetadataPath = str(boost::format("%s/DCManager.xml") % PATH_METADATAFILE);
原文地址:https://www.cnblogs.com/BloodAndBone/p/1952671.html