當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。