【问题标题】:What is the unit of getrlimit?getrlimit的单位是什么?
【发布时间】:2020-08-28 05:18:57
【问题描述】:

请帮助理解getrlimit 的单位是什么。我想它是字节,但它仍然是一个巨大的价值。

>>> import resource
>>> soft, hard = resource.getrlimit(resource.RLIMIT_AS)
>>> soft
9223372036854775807
>>> hard
9223372036854775807

【问题讨论】:

  • 那么您是否阅读了您提供的链接?就在那里,您希望有人从链接中复制文本并将其发布到本网站上吗?

标签: linux ulimit


【解决方案1】:

rlim_t 通常是 unsigned integer 类型,在 64 位机器上,最大/无限地址空间为 (2^64) - 1,但是您在机器上看到的最大限制为 9223372036854775807。在 CentOS/Ubuntu 机器上,我看到 RLIM_INFINITY 设置为 -1,而在 MacOS 上,它设置 9223372036854775807 为表示无限限制的常量。

resource.RLIM_INFINITY : 常量用于表示无限资源的限制。

在 CentOS 机器上:

[root ~]# cat /etc/redhat-release
CentOS Linux release 7.6.1810 (Core)
[root ~]# ulimit -a | grep virtual
virtual memory          (kbytes, -v) unlimited
[root ~]# python
Python 2.7.5 (default, Oct 30 2018, 23:45:53)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-36)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import resource
>>> resource.RLIM_INFINITY
-1
>>> soft, hard = resource.getrlimit(resource.RLIMIT_AS)
>>> soft
-1
>>> hard
-1
>>>

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2013-07-24
    • 2016-09-08
    • 1970-01-01
    • 2013-12-07
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多