I'm simply not getting "out of file descriptor" condition around 256th opened file... Tried to run the above test (with an increased N) in the console app just now, got this:
failed to open 7164th file
which is way above the 256 that ulimit -n
returns. On the same machine the UI app (either app sandboxed or not) correctly hits this limit (failing after 252th file or so). Weird.