The default limit for the max open files on Mac OS X is 256 (ulimit -n) and my application needs about 400 file handlers.
I tried to change the limit with setrlimit(
I know that's sound a silly question, but you really need 400 files opened at the same time? By the way, are you running this code as root are you?