Python resource.RLIMIT_CORE Examples
The following are 5
code examples of resource.RLIMIT_CORE().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
resource
, or try the search function
.
Example #1
Source File: daemon.py From luscan-devel with GNU General Public License v2.0 | 6 votes |
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
Example #2
Source File: daemon.py From virt-who with GNU General Public License v2.0 | 6 votes |
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)
Example #3
Source File: lib.py From edgedb with Apache License 2.0 | 5 votes |
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))
Example #4
Source File: test_processutils.py From oslo.concurrency with Apache License 2.0 | 5 votes |
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)
Example #5
Source File: environment.py From jvmquake with Apache License 2.0 | 5 votes |
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))