我有一个用C编写的守护进程,我想为其配置核心转储目录.可选地,文件名模式也应该是可配置的.
我知道/ proc / sys / kernel / core_pattern,但这会全局改变模式和目录结构.
Apache有指令CoreDumpDirectory – 所以它似乎是可能的.
解决方法 不,您无法按流程设置它.如果模式包含目录,则核心文件将转储到进程的当前工作目录或/ proc / sys / kernel / core_pattern中设置的目录.apache中的CoreDumpDirectory是一个Hack,apache为所有导致核心转储的信号注册信号处理程序,并更改其信号处理程序中的当前目录.
/* handle all varIEtIEs of core dumPing signals */static voID sig_coredump(int sig){ apr_filepath_set(ap_coredump_dir,pconf); apr_signal(sig,SIG_DFL);#if AP_ENABLE_EXCEPTION_HOOK run_fatal_exception_hook(sig);#endif /* linuxthreads issue calling getpID() here: * This comparison won't match if the crashing thread is * some module's thread that runs in the parent process. * The fallout,which is limited to linuxthreads: * The special log message won't be written when such a * thread in the parent causes the parent to crash. */ if (getpID() == parent_pID) { ap_log_error(APLOG_MARK,APLOG_NOTICE,ap_server_conf,"seg fault or similar nasty error detected " "in the parent process"); /* XXX we can probably add some rudimentary cleanup code here,* like getting rID of the pID file. If any additional bad stuff * happens,we are protected from recursive errors taking down the * system since this function is no longer the signal handler GLA */ } kill(getpID(),sig); /* At this point we've got sig blocked,because we're still insIDe * the signal handler. When we leave the signal handler it will * be unblocked,and we'll take the signal... and coredump or whatever * is appropriate for this particular Unix. In addition the parent * will see the real signal we received -- whereas if we called * abort() here,the parent would only see SIGABRT. */}总结
以上是内存溢出为你收集整理的c – 每个进程可配置的核心转储目录全部内容,希望文章能够帮你解决c – 每个进程可配置的核心转储目录所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)