相关疑难解决方法(0)

核心文件大小限制对进程具有非确定性影响

我正在运行自定义2.6.27内核,我只是注意到在段错误期间生成的核心文件大于为进程设置的硬核文件大小限制.

更令人讨厌的是,核心文件有时只会被截断(但不会受到ulimit设置的限制).

例如,这是我将尝试崩溃的程序:

int main(int argc, char **argv)
{
    // Get the hard and soft limit from command line
    struct rlimit new = {atoi(argv[1]), atoi(argv[1])};

    // Create some memory so as to beef up the core file size
    void *p = malloc(10 * 1024 * 1024);

    if (!p)
        return 1;

    if (setrlimit(RLIMIT_CORE, &new)) // Set the hard and soft limit
        return 2;                     // for core files produced by this
                                      // process

    while (1);

    free(p);
    return 0;
}
Run Code Online (Sandbox Code Playgroud)

这是执行: …

c linux coredump

14
推荐指数
1
解决办法
700
查看次数

什么是稀疏文件,为什么需要它?

什么是稀疏文件,为什么需要它?我唯一能得到的是它是一个非常大的文件,它是高效的(千兆字节).效率如何?

filesystems system file disk sparse-file

13
推荐指数
2
解决办法
6301
查看次数

标签 统计

c ×1

coredump ×1

disk ×1

file ×1

filesystems ×1

linux ×1

sparse-file ×1

system ×1