gpt4 book ai didi

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

转载 作者:塔克拉玛干 更新时间:2023-11-03 00:09:04 31 4
gpt4 key购买 nike

当我尝试使用以下两行执行 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/

31 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com