这篇教程C++ strsignal函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中strsignal函数的典型用法代码示例。如果您正苦于以下问题:C++ strsignal函数的具体用法?C++ strsignal怎么用?C++ strsignal使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了strsignal函数的30个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: main/* Main executed at runtime */int main(int argc, char ** argv){ // Declare Server and Socket HTTPserver httpServer; Socket sock; try{ // Sets the signals httpServer.setSignalHandler(); // Create socket sock.createSocket(argc, argv); // Start server with Socket object httpServer.runThreaded(sock); } catch (int signal){ // Create signal message and log it stringstream message; message << "Signal received: " << strsignal(signal) << " - " << signal << flush; // Output to console and log cout << message.str() << endl << flush; httpServer.logWrite(message.str()); } catch (exception &e){ // Create Error message stringstream message; message << "Fatal Exception: "<< e.what(); // Output to cerr and log cerr << message.str() << endl << flush; httpServer.logWrite(message.str()); } return (0);}
开发者ID:ideaJiang,项目名称:HTTP-Server,代码行数:42,
示例2: CloseHandlevoid VMBase::Free(){ if (syscallLogFile) { std::error_code err; syscallLogFile.Close(err); } if (!IsActive()) return; // First send a message signaling an exit to the VM // then delete the socket. This is needed because // recvmsg in NaCl doesn't return when the socket has // been closed. Util::Writer writer; writer.Write<uint32_t>(IPC::ID_EXIT); rootChannel.SendMsg(writer); rootChannel = IPC::Channel(); if (type != TYPE_NATIVE_DLL) {#ifdef _WIN32 // Closing the job object should kill the child process CloseHandle(processHandle);#else int status; if (waitpid(processHandle, &status, WNOHANG) != 0) { if (WIFSIGNALED(status)) Log::Warn("VM exited with signal %d: %s/n", WTERMSIG(status), strsignal(WTERMSIG(status))); else if (WIFEXITED(status)) Log::Warn("VM exited with non-zero exit code %d/n", WEXITSTATUS(status)); } kill(processHandle, SIGKILL); waitpid(processHandle, nullptr, 0);#endif processHandle = Sys::INVALID_HANDLE; } else { FreeInProcessVM(); }}
开发者ID:unrealarena,项目名称:unrealarena,代码行数:41,
示例3: reaper/******************************************************************* * reaper - clean up zombie children *******************************************************************/voidreaper(int sig){ pid_t cpid;#if defined(SOLARIS) || defined(AIX) || defined(LINUX) int status;#else union wait status;#endif /* SOLARIS */ while ((cpid = wait3(&status, WNOHANG, (struct rusage *) 0)) > 0) {#ifdef PRE_FORK int i;#endif server->child++;#ifdef PRE_FORK for (i = 0; i < server->max_child; i++) { if ((server->childs)[i].pid == cpid) { (server->childs)[i].pid = 0x00; (server->childs)[i].status = S_ERROR; server->error++;#ifdef WEB_ERROR_LOG#if 1 request_rec->atime = time(0); xstrncpy(request_rec->fromhost, "127.0.0.1", HOSTLEN);#endif weblog_line(server->error_log, "ERR=/"Child unexpected return, pid=%d, status=%d (%s)/"", (int) cpid, (int) status, strsignal(status)); fflush(server->error_log);#endif } }#endif } (void) signal(SIGCHLD, reaper); /* 再度 C++ strsncpy函数代码示例 C++ strsep函数代码示例
|