How to set maxfiles resource hard limit to unlimited(Max number of files that can be opened by a process)

6 views
Skip to first unread message

gaurav dewan

unread,
May 15, 2012, 4:43:01 AM5/15/12
to Darwi...@lists.apple.com, Darwin-u...@lists.apple.com

Hi all,

 

When we install mac OS from lab image, max number of open files for process getrlimit  hard limit is unlimited and soft limit is 256 (snowleopard and lion).

Given a MAC machine where hard limit for max number of open files is not unlimited(for example using the command below or due to some unidentified launch daemon/agent/config), is there a way we can reset it back to unlimited?

sudo launchctl limit maxfiles 10000

//changes the hard and soft limit for maxfiles to 10000 instead of unlimited

sudo launchctl limit maxfiles unlimited : This Does not work as Mac OS expects that argument for maxfiles must be numeric and not “unlimited” although unlimited works for other resources like core

Documentation for setrlimit

http://developer.apple.com/library/mac/#documentation/Darwin/Reference/ManPages/man2/setrlimit.2.html#//apple_ref/doc/man/2/setrlimit

 

A good discussion at:

http://lists.apple.com/archives/unix-porting/2010/Sep/msg00001.html


As 2^63-1 = 9223372036854775807
 launchctl limit maxfiles 9223372036854775807
 //Does not work as this command does not like a value greater than 32 bit 2147483647- why can't we enter 64 bit integer on terminal?

 

sysctl and ulimit commands do not help.


How can users control this setting at time of installation and after installation to change it to unlimited? (given superuser permission)

Are these limitations related to bugs in kernel? 


Thanks

Gaurav

Reply all
Reply to author
Forward
0 new messages