可以调用一个文件 core.foo 吗?

Okay to call a file core.foo?

在类 Unix 操作系统上,永远不要调用文件 core,因为它可能会被核心转储覆盖,因此该名称实际上保留供操作系统使用。

但是如果有扩展名,比如 core.c 呢?在我看来,这应该是完全没问题的; corecore.c 是两个不同的名称。

上面说的对吗,core.foo这样的名字可以吗?还是我遗漏了什么?

On Unix-like operating systems,

即。在符合 the single UNIX Specification (or just to POSIX). Or on a system belonging to the unix family.

的系统上

one should never call a file core because it might be overwritten by a core dump, so that name is de facto reserved for use by the operating system.

没有。我认为没有指定核心转储进入名为“核心”的文件的规范。都是“实现定义”,来自posix:

3.117 Core File

A file of unspecified format that may be generated when a process terminates abnormally.

如果创建了coredump,在什么地方创建,如何创建,内容是什么,就看实现了。 [Freebsd 为年龄创建了一个名为 executable_name.core 的文件。所以不是“在类 unix 操作系统上”。将开头更改为:

可以使您的句子有效

On a linux system with kernel version lower then 2.6 or 2.4.21 one should never call a file "core", because...

内核 2.6 和 2.4.21 已经超过 15 年了。较新的内核具有 /proc/sys/kernel/core_pattern,允许指定文件名和位置,甚至可以在 coredump 上指定 运行 的进程。因此,如果您使用的内核版本低于 2.6 或 2.4.21(或者 /proc/sys/kernel/core_pattern 的内容天真地设置为 core),那么是的,您在创建名为“核心”.

在当今世界,这种行为根本无关紧要,在大多数 linux 发行版中 systemd-coredump 会处理并在 /var/lib/systemd/coredump.

中创建核心转储

But what about with an extension, like core.c?

没关系 - corecore.c 是不同的文件名。点不是特殊字符,它只是一个像其他字符一样的字符,core.ccore 的区别与 core12coreAB 的区别一样多...

Is the above correct,

是的。

and names like core.foo are okay?

还好。

Or am I missing anything?

不知道,但如果你是,我当然希望你会找到它。