macos – ulimit第一次调用ok第二次调用失败,为什么?

macos – ulimit第一次调用ok第二次调用失败,为什么?,第1张

概述在macosx 10.7上,使用bash 第一次调用ulimit -n成功,而第二次调用失败. a:$ulimit -n 2560a:$ulimit -n 5000a:$ulimit -n 5000a:$ulimit -n 6000bash: ulimit: open files: cannot modify limit: Operation not permitted 但是,如果我尝 在macosx 10.7上,使用bash

第一次调用ulimit -n成功,而第二次调用失败.

a:$ulimit -n 2560a:$ulimit -n 5000a:$ulimit -n 5000a:$ulimit -n 6000bash: ulimit: open @R_301_6852@s: cannot modify limit: Operation not permitted

但是,如果我尝试使用新的shell(或其他shell)ulimit -n 6000,它会成功:

a:$ulimit -n 2560a:$ulimit -n 6000a:$ulimit -n 6000

这是为什么?

解决方法 从bash手册页:

A hard limit cannot be increased once it is set; a soft limit may be
increased up to the value of the hard limit. If neither -H nor -S is
specifIEd,both the soft and hard limits are set.

大多数现代* NIX实际上不再使用ulimit了.我猜OS X没有ulimit hard max set,所以你的第一个调用设置了soft和hard max,所以你的第二次调用每次都会失败.没有[limit]参数的第一个调用可能是打印soft max.

总结

以上是内存溢出为你收集整理的macos – ulimit第一次调用ok第二次调用失败,为什么?全部内容,希望文章能够帮你解决macos – ulimit第一次调用ok第二次调用失败,为什么?所遇到的程序开发问题。

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

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

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

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

发表评论

登录后才能评论

评论列表(0条)

保存