MCPcopy Create free account
hub / github.com/LUX-Core/lux / RaiseFileDescriptorLimit

Function RaiseFileDescriptorLimit

src/util.cpp:721–739  ·  view source on GitHub ↗

* this function tries to raise the file descriptor limit to the requested number. * It returns the actual file descriptor limit (which may be more or less than nMinFD) */

Source from the content-addressed store, hash-verified

719 * It returns the actual file descriptor limit (which may be more or less than nMinFD)
720 */
721int RaiseFileDescriptorLimit(int nMinFD)
722{
723#if defined(WIN32)
724 return 2048;
725#else
726 struct rlimit limitFD;
727 if (getrlimit(RLIMIT_NOFILE, &limitFD) != -1) {
728 if (limitFD.rlim_cur < (rlim_t)nMinFD) {
729 limitFD.rlim_cur = nMinFD;
730 if (limitFD.rlim_cur > limitFD.rlim_max)
731 limitFD.rlim_cur = limitFD.rlim_max;
732 setrlimit(RLIMIT_NOFILE, &limitFD);
733 getrlimit(RLIMIT_NOFILE, &limitFD);
734 }
735 return limitFD.rlim_cur;
736 }
737 return nMinFD; // getrlimit failed, assume it's fine
738#endif
739}
740
741/**
742 * this function tries to make a particular range of a file allocated (corresponding to disk space)

Callers 1

AppInit2Function · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected