#ifndef __FORKCHILD_H__ #define __FORKCHILD_H__ #include class fork_child { int _pid; public: fork_child() : _pid(0) { } ~fork_child() { #ifndef _WIN32 kill(_pid, SIGTERM); #endif } virtual void initialize_child() { } void run_child(const std::string& svrname, const StringList& args) { #ifndef _WIN32 _pid= fork(); if (-1==_pid) throw posixerror("clt:fork"); if (_pid!=0) { ipclog("parent(client), server.pid=%d\n", _pid); return; } ipclog("child(server)\n"); initialize_child(); // construct argv char**argv= (char**)malloc((args.size()+2)*sizeof(char*)); argv[0]= (char*)&svrname[0]; for (unsigned i=0 ; i