c - 使用 system() 函数运行 ulimit -d

标签 c linux ulimit

当我尝试使用以下两行执行 C 代码时,ulimit 仍然显示为无限制,但我希望答案为 1024。

系统(“ulimit -d 1024”); system("ulimit -d");

最佳答案

如果你想为调用进程设置ulimit,使用setrlimit(2) , with arguemnt RLIMIT_DATA.

system() 将 fork 并且 ulimit 命令只影响子进程,不影响调用进程。

关于c - 使用 system() 函数运行 ulimit -d,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40754610/

相关文章:

c++ - boost 文件系统的无效跨设备链接错误

c++ - 难以衡量 C/C++ 性能

c - 如何用c语言编写正则表达式?我正在使用 c 中的正则表达式概念对 Prime No. 进行测试用例,以下是我的源代码

c - 帮助自定义 getline() 函数

c - 试图从标准中理解有符号整数转换规则

linux - 什么是 ulimit -N 15 选项?

linux - Chromium 自动刷新命令行

linux - 使用 linux 过滤器程序更改缓冲区文本?

python - Python 中的 'ulimit' 是什么?

Node.js 和 ulimit