- MAX_DESCRIPTORS = 0;
- ServerInstance->Logs->Log("SOCKET", DEFAULT, "ERROR: Can't determine maximum number of open sockets: %s", strerror(errno));
- printf("ERROR: Can't determine maximum number of open sockets: %s\n", strerror(errno));
- ServerInstance->Exit(EXIT_STATUS_SOCKETENGINE);
- }
- return 0;
-#else
- if (!MAX_DESCRIPTORS)
- {
- int mib[2], maxfiles;
- size_t len;
-
- mib[0] = CTL_KERN;
- mib[1] = KERN_MAXFILES;
- len = sizeof(maxfiles);
- sysctl(mib, 2, &maxfiles, &len, NULL, 0);
- MAX_DESCRIPTORS = maxfiles;
- return maxfiles;
- }
- return MAX_DESCRIPTORS;
-#endif
-}