当前位置: 首页>>代码示例>>Python>>正文


Python resource.RLIMIT_CORE属性代码示例

本文整理汇总了Python中resource.RLIMIT_CORE属性的典型用法代码示例。如果您正苦于以下问题:Python resource.RLIMIT_CORE属性的具体用法?Python resource.RLIMIT_CORE怎么用?Python resource.RLIMIT_CORE使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在resource的用法示例。


在下文中一共展示了resource.RLIMIT_CORE属性的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: prevent_core_dump

# 需要导入模块: import resource [as 别名]
# 或者: from resource import RLIMIT_CORE [as 别名]
def prevent_core_dump():
    """ Prevent this process from generating a core dump.

        Sets the soft and hard limits for core dump size to zero. On
        Unix, this prevents the process from creating core dump
        altogether.

        """
    core_resource = resource.RLIMIT_CORE

    try:
        # Ensure the resource limit exists on this platform, by requesting
        # its current value
        core_limit_prev = resource.getrlimit(core_resource)
    except ValueError, exc:
        error = DaemonOSEnvironmentError(
            "System does not support RLIMIT_CORE resource limit (%(exc)s)"
            % vars())
        raise error

    # Set hard and soft limits to zero, i.e. no core dump at all 
开发者ID:blackye,项目名称:luscan-devel,代码行数:23,代码来源:daemon.py

示例2: prevent_core_dump

# 需要导入模块: import resource [as 别名]
# 或者: from resource import RLIMIT_CORE [as 别名]
def prevent_core_dump():
    """ Prevent this process from generating a core dump.

        Sets the soft and hard limits for core dump size to zero. On
        Unix, this prevents the process from creating core dump
        altogether.

        """
    core_resource = resource.RLIMIT_CORE

    try:
        # Ensure the resource limit exists on this platform, by requesting
        # its current value
        resource.getrlimit(core_resource)
    except ValueError as exc:
        error = DaemonOSEnvironmentError(
            "System does not support RLIMIT_CORE resource limit (%s)" % exc)
        raise error

    # Set hard and soft limits to zero, i.e. no core dump at all
    core_limit = (0, 0)
    resource.setrlimit(core_resource, core_limit) 
开发者ID:candlepin,项目名称:virt-who,代码行数:24,代码来源:daemon.py

示例3: prevent_core_dump

# 需要导入模块: import resource [as 别名]
# 或者: from resource import RLIMIT_CORE [as 别名]
def prevent_core_dump():
    """Prevent this process from generating a core dump."""
    core_resource = resource.RLIMIT_CORE

    try:
        resource.getrlimit(core_resource)
    except ValueError as ex:
        raise DaemonError(
            'Unable to limit core dump size: '
            'system does not support RLIMIT_CORE resource limit') from ex

    # Set hard & soft limits to 0, i.e. no core dump at all
    resource.setrlimit(core_resource, (0, 0)) 
开发者ID:edgedb,项目名称:edgedb,代码行数:15,代码来源:lib.py

示例4: test_core_size

# 需要导入模块: import resource [as 别名]
# 或者: from resource import RLIMIT_CORE [as 别名]
def test_core_size(self):
        size = self.soft_limit(resource.RLIMIT_CORE, 1, 1024)
        prlimit = processutils.ProcessLimits(core_file_size=size)
        self.check_limit(prlimit, 'RLIMIT_CORE', prlimit.core_file_size) 
开发者ID:openstack,项目名称:oslo.concurrency,代码行数:6,代码来源:test_processutils.py

示例5: core_ulimit

# 需要导入模块: import resource [as 别名]
# 或者: from resource import RLIMIT_CORE [as 别名]
def core_ulimit():
    import resource
    (x, y) = resource.getrlimit(resource.RLIMIT_CORE)
    resource.setrlimit(
        resource.RLIMIT_CORE,
        (resource.RLIM_INFINITY, resource.RLIM_INFINITY)
    )
    yield
    resource.setrlimit(resource.RLIMIT_CORE, (x, y)) 
开发者ID:Netflix-Skunkworks,项目名称:jvmquake,代码行数:11,代码来源:environment.py


注:本文中的resource.RLIMIT_CORE属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。