#endif
#ifdef NS_IMPL_COCOA
+ /* Some functions/methods in CoreFoundation/Foundation increase the
+ maximum number of open files for the process in their first call.
+ We make dummy calls to them and then reduce the resource limit
+ here, since pselect cannot handle file descriptors that are
+ greater than or equal to FD_SETSIZE. */
+ CFSocketGetTypeID ();
+ CFFileDescriptorGetTypeID ();
+ [[NSFileHandle alloc] init];
+ struct rlimit rlim;
+ if (getrlimit (RLIMIT_NOFILE, &rlim) == 0
+ && rlim.rlim_cur > FD_SETSIZE)
+ {
+ rlim.rlim_cur = FD_SETSIZE;
+ setrlimit (RLIMIT_NOFILE, &rlim);
+ }
if ([NSApp activationPolicy] == NSApplicationActivationPolicyProhibited) {
/* Set the app's activation policy to regular when we run outside
of a bundle. This is already done for us by Info.plist when we