MCPcopy Create free account
hub / github.com/F-Stack/f-stack / updateMaxclients

Function updateMaxclients

app/redis-6.2.6/src/config.c:2297–2323  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2295}
2296
2297static int updateMaxclients(long long val, long long prev, const char **err) {
2298 /* Try to check if the OS is capable of supporting so many FDs. */
2299 if (val > prev) {
2300 adjustOpenFilesLimit();
2301 if (server.maxclients != val) {
2302 static char msg[128];
2303 sprintf(msg, "The operating system is not able to handle the specified number of clients, try with %d", server.maxclients);
2304 *err = msg;
2305 if (server.maxclients > prev) {
2306 server.maxclients = prev;
2307 adjustOpenFilesLimit();
2308 }
2309 return 0;
2310 }
2311 if ((unsigned int) aeGetSetSize(server.el) <
2312 server.maxclients + CONFIG_FDSET_INCR)
2313 {
2314 if (aeResizeSetSize(server.el,
2315 server.maxclients + CONFIG_FDSET_INCR) == AE_ERR)
2316 {
2317 *err = "The event loop API used by Redis is not able to handle the specified number of clients";
2318 return 0;
2319 }
2320 }
2321 }
2322 return 1;
2323}
2324
2325static int updateOOMScoreAdj(int val, int prev, const char **err) {
2326 UNUSED(prev);

Callers

nothing calls this directly

Calls 4

adjustOpenFilesLimitFunction · 0.85
sprintfFunction · 0.85
aeGetSetSizeFunction · 0.85
aeResizeSetSizeFunction · 0.85

Tested by

no test coverage detected