Move fixLimits function to util

This commit is contained in:
Brandon Heller
2009-12-26 07:40:57 -08:00
parent 89bf31030b
commit e3621eb057
2 changed files with 10 additions and 8 deletions
+8 -1
View File
@@ -2,6 +2,7 @@
'''Utility functions for Mininet.'''
from time import sleep
from resource import setrlimit, RLIMIT_NPROC, RLIMIT_NOFILE
import select
from subprocess import call, check_call, Popen, PIPE, STDOUT
@@ -166,4 +167,10 @@ def createLink(node1, node2):
retry(3, MOVEINTF_DELAY, moveIntf, intf2, node2)
node1.connection[intf1] = (node2, intf2)
node2.connection[intf2] = (node1, intf1)
return intf1, intf2
return intf1, intf2
def fixLimits():
'''Fix ridiculously small resource limits.'''
setrlimit( RLIMIT_NPROC, (4096, 8192))
setrlimit( RLIMIT_NOFILE, (16384, 32768))