MCPcopy Create free account
hub / github.com/BTCGPU/BTCGPU / RaiseFileDescriptorLimit

Function RaiseFileDescriptorLimit

src/util.cpp:1068–1085  ·  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

1066 * It returns the actual file descriptor limit (which may be more or less than nMinFD)
1067 */
1068int RaiseFileDescriptorLimit(int nMinFD) {
1069#if defined(WIN32)
1070 return 2048;
1071#else
1072 struct rlimit limitFD;
1073 if (getrlimit(RLIMIT_NOFILE, &limitFD) != -1) {
1074 if (limitFD.rlim_cur < (rlim_t)nMinFD) {
1075 limitFD.rlim_cur = nMinFD;
1076 if (limitFD.rlim_cur > limitFD.rlim_max)
1077 limitFD.rlim_cur = limitFD.rlim_max;
1078 setrlimit(RLIMIT_NOFILE, &limitFD);
1079 getrlimit(RLIMIT_NOFILE, &limitFD);
1080 }
1081 return limitFD.rlim_cur;
1082 }
1083 return nMinFD; // getrlimit failed, assume it's fine
1084#endif
1085}
1086
1087/**
1088 * this function tries to make a particular range of a file allocated (corresponding to disk space)

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected