MCPcopy Create free account
hub / github.com/4paradigm/OpenMLDB / SwapIsEnabled

Function SwapIsEnabled

src/cmd/fedb.cc:211–233  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

209}
210
211int SwapIsEnabled() {
212#if defined(__linux__) || defined(__mac_tablet__)
213 char buf[1024];
214 FILE* fp = fopen("/proc/swaps", "r");
215 if (!fp) {
216 return 0;
217 }
218 if (fgets(buf, sizeof(buf), fp) == NULL) {
219 fclose(fp);
220 return 0;
221 }
222 // if the swap is disabled, there is only one line in /proc/swaps.
223 // Filename Type Size Used Priority
224 if (fgets(buf, sizeof(buf), fp) == NULL) {
225 fclose(fp);
226 return 0;
227 }
228 fclose(fp);
229 return 1;
230#else
231 return 0;
232#endif
233}
234
235void StartTablet() {
236 if (THPIsEnabled()) {

Callers 1

StartTabletFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected