linux – 如何仅为特定应用程序更改核心模式?

linux – 如何仅为特定应用程序更改核心模式?,第1张

概述我的应用程序要求以特定模式生成核心文件. 如何在不影响其他流程的情况下执行此 *** 作? 当/ proc是只读时,我该怎么做? 男人核心告诉我们: Piping core dumps to a program Since kernel 2.6.19, Linux supports an alternate syntax for the /proc/sys/kernel/core_pattern file 我的应用程序要求以特定模式生成核心文件.

如何在不影响其他流程的情况下执行此 *** 作?

当/ proc是只读时,我该怎么做?

解决方法 男人核心告诉我们:

PiPing core dumps to a program

Since kernel 2.6.19,Linux supports an alternate Syntax for the
/proc/sys/kernel/core_pattern file. If the first character of this
file is a pipe symbol (|),then the remainder of the line is
interpreted as a program to be executed. Instead of being written to
a disk file,the core dump is given as standard input to the program.

Note the following points:

The program must be specifIEd using an absolute pathname (or a
pathname relative to the root directory,/),and must immediately
follow the ‘|’ character.

The process created to run the program runs as user and group
root.

Command-line arguments can be supplIEd to the program (since linux
2.6.24),delimited by white space (up to a total line length of
128 bytes).

The command-line arguments can include any of the % specifIErs
Listed above. For example,to pass the PID of the process that is
being dumped,specify %p in an argument.

你可以在那里放一个脚本,例如

| /path/to/myscript %p %s %c

您可以检测哪个进程正在触发coredump 总结

以上是内存溢出为你收集整理的linux – 如何仅为特定应用程序更改核心模式?全部内容,希望文章能够帮你解决linux – 如何仅为特定应用程序更改核心模式?所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/yw/1018172.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-23
下一篇 2022-05-23

发表评论

登录后才能评论

评论列表(0条)

保存