Changeset 102
- Timestamp:
- 07/14/05 08:28:54 (3 years ago)
- Files:
-
- README (modified) (3 diffs)
- debian/changelog (modified) (1 diff)
- doc/swapspace.8 (modified) (1 diff)
- src/Makefile (modified) (1 diff)
- src/log.c (modified) (2 diffs)
- src/log.h (modified) (2 diffs)
- src/main.c (modified) (14 diffs)
- src/main.h (modified) (2 diffs)
- src/memory.c (modified) (9 diffs)
- src/memory.h (modified) (2 diffs)
- src/opts.c (modified) (11 diffs)
- src/state.c (modified) (4 diffs)
- src/state.h (modified) (1 diff)
- src/swaps.c (modified) (16 diffs)
- src/swaps.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
README
r92 r102 33 33 34 34 Robustness and user-friendliness are the first priorities of development. For 35 example, all alternatives we have found will unnecessarily allocate several 36 chunks of memory in dealing with low-memory situations. Allocation failure will 37 typically crash these programs, whereas swapspace categorically avoids all 38 reliance on dynamically allocated memory. 35 example, all alternatives we looked at perversely needed to allocate multiple 36 chunks of memory in dealing with low-memory situations; allocation failure would 37 typically crash these programs. It turned out that none of these allocations 38 were really necessary, and swapspace avoids them categorically. This kills two 39 birds with one stone when it comes to reliability: (i) the program doesn't ask 40 for memory just when the least memory is available and (ii) it eliminates one of 41 the most important causes of programming bugs as a risk factor. 39 42 40 43 User-friendliness primarily means that no silly questions are asked of the user. 41 44 The daemon tries to be sensible and figure out what is needed at runtime, by 42 itself, and without user intervention. 45 itself, and without user intervention. You should not have any need to learn 46 about the configuration parameters, or tweak them. They exist mostly for 47 development purposes. 43 48 44 49 The swapspace daemon has been in production use for several months on various … … 57 62 state. 58 63 64 Swapspace itself is a small program: about 40 kilobytes on my system--or even 65 less in a special version that doesn't accept most options and ignores its 66 configuration file. On top of that it allocates no memory at runtime (although 67 the system will allocate some, of course) and does not use much stack space. 68 59 69 60 70 When not to use it … … 63 73 need to remain responsive at all times; depending on the system and the 64 74 cicrumstances, the creation a large new swapfile can take as long as half a 65 minute and occupy quite a lot of the system's attention. The program attempts66 t o minimize the frequency of allocations, but cannot avoid them altogether while67 still being useful. 75 minute and occupy quite a lot of the system's attention. The program minimizes 76 the number of times swapfiles are created, but it wouldn't be very useful if it 77 never created any swapfiles at all! 68 78 69 We are hoping to address this shortcomingin the future. Since the problem79 We are hoping to bring further improvements in the future. Since the problem 70 80 appears to be caused mostly by system code, however, it's hard to be sure that 71 this is really possible. 81 this is really possible. It may turn out to be possible for the kernel, with 82 some modifications, to extend an existing swapfile while it is already in use. 83 That would probably help a great deal, but we don't know at the moment how much 84 work it would take. 72 85 73 86 debian/changelog
r96 r102 6 6 * New -v|--verbose option logs state transitions and other debug info 7 7 * Updated documentation 8 * Makefile installs binary as world-executable (and strips it first) 9 * Can be built with most configuration features disabled 10 * Much more extensive dumps of internal state on signal receipt 11 * Add own C/cpp options to those set in environment 8 12 9 -- Jeroen T. Vermeulen <jtv@sipa.or.th> Sat, 02 July 2005 15:30:00 +070013 -- Jeroen T. Vermeulen <jtv@sipa.or.th> Thu, 14 July 2005 19:30:00 +0700 10 14 11 15 swapspace (1.4) unstable; urgency=low doc/swapspace.8
r91 r102 11 11 This program aims to reduce or do away with the need for swapfiles. 12 12 .PP 13 The following options are accepted. 13 .B swapspace 14 can be built in two configurations: the full-featured one (which is 15 now the default) or the unconfigurable version. The latter only accepts a few 16 options, disabling all features that are probably only relevant to developers. 17 At some point in the feature, when enough confidence exists that the various 18 configuration parameters are either good enough for everyone or have been made 19 unnecessary, the unconfigurable build may become the default. 20 .PP 21 The following options are accepted in the unconfigurable version. All of these 22 have more extensive equivalents in the full-featured version. 23 .TP 24 \fB\-d\fR 25 Quietly ignored; always enabled in unconfigurable version. 26 .TP 27 \fB\-h\fR 28 Display usage information and exit. 29 .TP 30 \fB\-p\fR 31 Write process identifier to \fI/var/lib/swapspace.pid\fR when starting (and 32 delete it when shutting down). The file's name and location cannot be changed 33 in the unconfigurable version. 34 .TP 35 \fB\-q\fR 36 Quietly ignored; always enabled in unconfigurable version. 37 .TP 38 \fB\-v\fR 39 Quietly ignored; always enabled in unconfigurable version. 40 .TP 41 \fB\-V\fR 42 Print program version information and exit. 43 .PP 44 In most cases, these should be the only options of any interest for normal use 45 of the program. All files are kept in their default locations, which were 46 chosen in accordance with the Linux Filesystem Hierarchy Standard, and 47 algorithmic parameters are left at defaults that have been tested to work well 48 for a wide range of uses. 49 .PP 50 The full-featured configuration accepts more options, as listed below. 14 51 The long-format options may also be specified, without the leading "\-\-", in a 15 52 configuration file. By default, \fI/etc/swapspace.conf\fR is read on startup. src/Makefile
r85 r102 4 4 # swapspace is written in C99, but with at least one extension that isn't 5 5 # supported in gcc's C99 mode: sigaction() (though it is part of POSIX). 6 CFLAGS =--std=gnu99 -Wall --pedantic -Wshadow -O2 -g7 CPPFLAGS =-DSUPPORT_LARGE_FILES -DVERSION="\"$(VERSION)\"" -DDATE="\"$(DATE)\""6 CFLAGS += --std=gnu99 -Wall --pedantic -Wshadow -O2 -g 7 CPPFLAGS += -DSUPPORT_LARGE_FILES -DVERSION="\"$(VERSION)\"" -DDATE="\"$(DATE)\"" 8 8 RM=rm -f 9 10 # Uncomment this to build a special ultra-lightweight unconfigurable version of 11 # swapspace. This saves perhaps 20 kilobytes of binary size and breaks all but 12 # a few of the command line options. You probably don't want this; it's mostly 13 # here as a proof-of-concept and testing ground for the future elimination of 14 # configuration items. 15 #CPPFLAGS += -DNO_CONFIG 16 17 # Uncomment this to disable assertions and internal consistency checking that 18 # you probably don't need after release. 19 # CPPFLAGS += -DNDEBUG 9 20 10 21 all : swapspace hog src/log.c
r93 r102 135 135 136 136 137 #ifndef NO_CONFIG 137 138 void log_discrep(int priority, 138 139 const char msg[], … … 157 158 found); 158 159 } 160 #endif 159 161 src/log.h
r93 r102 48 48 void log_perrno_str(int priority, const char msg[], const char arg[], int err); 49 49 50 /// Log message, but appending a ninteger argument50 /// Log message, but appending a quoted integer argument 51 51 void log_int(int priority, const char msg[], int arg); 52 52 53 /// Log message, but appending an (unquoted) long long argument 54 void log_longlong(int priority, const char msg[], long long arg); 55 56 #ifndef NO_CONFIG 53 57 /// Log logfile size discrepancy 54 58 void log_discrep(int priority, … … 57 61 memsize_t expected, 58 62 memsize_t found); 63 #endif 59 64 60 65 #endif src/main.c
r94 r102 43 43 #include "swaps.h" 44 44 45 46 47 static bool godaemon = false;48 49 char *set_daemon(long long dummy)50 {51 godaemon = true;52 return NULL;53 }54 55 56 bool quiet = false;57 bool verbose = false;58 59 45 char localbuf[8192]; 60 61 46 time_t clock = 0; 47 62 48 63 49 static char pidfile[PATH_MAX] = "/var/run/swapspace.pid"; … … 71 57 } 72 58 59 #ifndef NO_CONFIG 60 static bool godaemon = false; 61 62 char *set_daemon(long long dummy) 63 { 64 godaemon = true; 65 return NULL; 66 } 67 68 bool quiet = false; 69 bool verbose = false; 70 73 71 char *set_quiet(long long dummy) 74 72 { … … 76 74 return NULL; 77 75 } 78 79 76 char *set_verbose(long long dummy) 80 77 { … … 83 80 } 84 81 85 86 82 bool main_check_config(void) 87 83 { … … 89 85 return true; 90 86 } 91 92 93 94 /// Was a dump of statistics requested? 95 static volatile bool print_status=false; 96 97 /// Was an immediate adjustment requested? 98 static volatile bool adjust_swap=false; 87 #else 88 #define godaemon true 89 #endif 99 90 100 91 … … 103 94 unlink(pidfile); 104 95 } 105 106 96 107 97 /// Write our process identifier to pid file. Clobbers localbuf. … … 117 107 return true; 118 108 } 119 120 109 121 110 /// Create pidfile, if requested … … 143 132 } 144 133 145 146 134 /// Signal handler that causes program to abort, but cleans up pidfile first 147 135 static void sighand_die(int sig) … … 151 139 exit(EXIT_FAILURE); 152 140 } 153 154 155 141 156 142 /// Write process id to pidfile if requested, and close it. Clobbers localbuf. … … 172 158 } 173 159 174 175 160 static pid_t daemonize(void) 176 161 { … … 182 167 183 168 169 /// Was a dump of statistics requested? 170 static volatile bool print_status=false; 171 172 /// Was an immediate adjustment requested? 173 static volatile bool adjust_swap=false; 174 184 175 185 176 /// Signal handler that requests generation of a status report to stdout … … 237 228 if (unlikely(!read_proc_swaps()) || 238 229 unlikely(!activate_old_swaps()) || 239 unlikely(!check_memory_status()) || 240 unlikely(!startpidfile())) 230 unlikely(!check_memory_status())) 241 231 return EXIT_FAILURE; 232 233 if (unlikely(!startpidfile())) return EXIT_FAILURE; 242 234 243 235 /* Do a first iteration here so we can report any startup errors, and if we're … … 252 244 { 253 245 if (!read_proc_swaps()) return EXIT_FAILURE; 246 #ifndef NO_CONFIG 254 247 if (!quiet && !proc_swaps_parsed()) 255 248 fputs("[/proc/swaps is empty, so cannot check its format]\n", stderr); 249 #endif 256 250 } 257 251 258 252 if (godaemon) 259 253 { 254 #ifndef NO_CONFIG 260 255 if (verbose) log_msg(LOG_DEBUG, "daemonizing..."); 256 #endif 261 257 const pid_t pid = daemonize(); 262 258 if (unlikely(pid < 0)) … … 272 268 */ 273 269 lseek(pidfd, 0, SEEK_SET); 270 #ifndef NO_CONFIG 274 271 if (verbose) log_int(LOG_DEBUG, "got process id", pid); 272 #endif 275 273 return writepid(pid) ? EXIT_SUCCESS : EXIT_FAILURE; 276 274 } src/main.h
r89 r102 45 45 extern time_t clock; 46 46 47 #ifndef NO_CONFIG 47 48 /// Suppress informational output and warnings? 48 49 extern bool quiet; … … 50 51 extern bool verbose; 51 52 52 char *set_daemon(long long dummy);53 char *set_pidfile(long long dummy);54 53 char *set_quiet(long long dummy); 55 54 char *set_verbose(long long dummy); 56 55 57 56 bool main_check_config(void); 57 #endif 58 59 char *set_daemon(long long dummy); 60 char *set_pidfile(long long dummy); 58 61 59 62 #endif src/memory.c
r86 r102 47 47 static int cache_meekness=80; 48 48 49 #ifndef NO_CONFIG 49 50 char *set_freetarget(long long pct) 50 51 { … … 52 53 return NULL; 53 54 } 54 55 55 char *set_lower_freelimit(long long pct) 56 56 { … … 58 58 return NULL; 59 59 } 60 61 60 char *set_upper_freelimit(long long pct) 62 61 { … … 64 63 return NULL; 65 64 } 66 67 65 char *set_buffer_meekness(long long pct) 68 66 { … … 70 68 return NULL; 71 69 } 72 73 70 char *set_cache_meekness(long long pct) 74 71 { … … 76 73 return NULL; 77 74 } 78 79 75 80 76 bool memory_check_config(void) … … 85 81 return true; 86 82 } 83 #endif 87 84 88 85 … … 280 277 { 281 278 const memsize_t init_req = memory_target(); 282 if (init_req == MEMSIZE_ERROR) return false; 279 if (unlikely(init_req == MEMSIZE_ERROR)) return false; 280 #ifndef NO_CONFIG 283 281 if (init_req && !quiet) 284 282 { 285 283 printf("Initial memory status: "); 286 if (init_req > 0) printf("would prefer %lld extra bytes\n", init_req); 287 else if (init_req < 0) printf("%lld bytes to spare\n", -init_req); 288 } 284 if (init_req > 0) 285 sprintf(localbuf, "would prefer %lld extra bytes", init_req); 286 else 287 sprintf(localbuf, "%lld bytes to spare", -init_req); 288 log_msg(LOG_INFO, localbuf); 289 } 290 #endif 289 291 return true; 290 292 } … … 379 381 return request; 380 382 } 383 384 385 static void dump_memline(const char category[], 386 long long total, 387 long long free, 388 long long cached) 389 { 390 sprintf(localbuf, 391 "%s: %lld total, %lld free (%lld used); %lld cached", 392 category, 393 total, 394 free, 395 (total - free), 396 cached); 397 log_msg(LOG_INFO, localbuf); 398 } 399 400 void dump_memory(void) 401 { 402 struct memstate st = { 0, 0, 0, 0, 0, 0, 0, 0 }; 403 if (unlikely(!read_proc_meminfo(&st))) return; 404 check_memory_status(); 405 406 dump_memline("core", st.MemTotal, st.MemFree, st.Cached); 407 dump_memline("swap", st.SwapTotal, st.SwapFree, st.SwapCached); 408 dump_memline("total", 409 space_total(&st), 410 st.MemFree + st.SwapFree, 411 st.Cached + st.SwapCached); 412 413 sprintf(localbuf, 414 "bufs: %lld, dirty: %lld, writeback: %lld", 415 st.Buffers, 416 st.Dirty, 417 st.Writeback); 418 log_msg(LOG_INFO, localbuf); 419 420 const int pf = pct_free(&st); 421 sprintf(localbuf, 422 "estimate free: %lld cache, %lld bufs, %lld total (%d%%)", 423 cache_free(&st), 424 buffers_free(&st), 425 space_free(&st), 426 pf); 427 log_msg(LOG_INFO, localbuf); 428 sprintf(localbuf, 429 "thresholds: %d%% < %d%% < %d%%", 430 lower_freelimit, 431 pf, 432 upper_freelimit); 433 log_msg(LOG_INFO, localbuf); 434 } 435 436 src/memory.h
r78 r102 41 41 memsize_t memory_target(void); 42 42 43 void dump_memory(void); 44 45 #ifndef NO_CONFIG 43 46 char *set_lower_freelimit(long long pct); 44 47 char *set_upper_freelimit(long long pct); … … 48 51 49 52 bool memory_check_config(void); 53 #endif 50 54 51 55 #endif 56 src/opts.c
r95 r102 31 31 #include "opts.h" 32 32 #include "support.h" 33 #include "state.h" 33 34 #include "swaps.h" 34 35 36 37 static const char copyright[] = "\n" 38 "Copyright (c) 2004-2005 Software Industry Promotion Agency of Thailand\n" 39 "Written by Jeroen T. Vermeulen <jtv@sipa.or.th>\n" 40 "This program is free software, and is available for use under the GNU\n" 41 "General Public License (GPL).\n"; 42 43 44 #ifndef NO_CONFIG 35 45 static char configfile[PATH_MAX] = "/etc/swapspace.conf"; 36 46 … … 42 52 static char *set_help(long long dummy); 43 53 static char *set_version(long long dummy); 44 45 54 46 55 enum argtype { at_none, at_num, at_str }; … … 57 66 const char *desc; 58 67 }; 59 60 68 61 69 /// Available options, sorted alphabetically by long option name … … 97 105 98 106 107 static int optcmp(const void *o1, const void *o2) 108 { 109 return strcmp(((const struct option *)o1)->name, 110 ((const struct option *)o2)->name); 111 } 112 113 99 114 #ifndef NDEBUG 100 115 static bool options_okay(void) … … 141 156 return true; 142 157 } 143 #endif 158 #endif // NDEBUG 144 159 145 160 static const char *argproto(int opt, bool shortopt) … … 154 169 return result; 155 170 } 156 157 const char copyright[] = "\n"158 "Copyright (c) 2004-2005 Software Industry Promotion Agency of Thailand\n"159 "Written by Jeroen T. Vermeulen <jtv@sipa.or.th>\n"160 "This program is free software, and is available for use under the GNU\n"161 "General Public License (GPL).\n";162 171 163 172 static char *set_help(long long dummy) … … 197 206 exit(EXIT_SUCCESS); 198 207 } 208 #else 209 210 static void short_usage(void) 211 { 212 puts("This is the unconfigurable version of swapspace.\n" 213 "\n" 214 "Usage: swapspace [-d] [-h] [-p] [-V]\n" 215 "\t-d run as daemon" 216 "\t-h display this overview and exit\n" 217 "\t-p create pidfile\n" 218 "\t-q (ignored)\n" 219 "\t-v (ignored)\n" 220 "\t-V display version information and exit\n" 221 "\n" 222 "Use zero-argument version for normal operation."); 223 puts(copyright); 224 exit(EXIT_SUCCESS); 225 } 226 227 #endif // NO_CONFIG 199 228 200 229 … … 207 236 208 237 209 static int optcmp(const void *o1, const void *o2) 210 { 211 return strcmp(((const struct option *)o1)->name, 212 ((const struct option *)o2)->name); 213 } 214 215 216 238 #ifndef NO_CONFIG 217 239 /// Emit error message about configuration. Returns false. 218 240 static bool config_error(const char msg[]) … … 292 314 return true; 293 315 } 294 295 316 296 317 … … 411 432 return true; 412 433 } 413 434 #endif // NO_CONFIG 414 435 415 436 416 437 bool configure(int argc, char *argv[]) 417 438 { 439 #ifndef NO_CONFIG 440 418 441 assert(options_okay()); 419 442 … … 427 450 428 451 return main_check_config() && swaps_check_config() && memory_check_config(); 429 } 430 452 453 #else 454 455 // Unconfigurable build; we only do a minimal options loop. 456 for (int a=1; argv[a]; ++a) 457 { 458 if (argv[a][0] != '-') 459 { 460 fprintf(stderr, "Invalid argument: '%s'. Try the -h option.\n", argv[a]); 461 return false; 462 } 463 switch (argv[a][1]) 464 { 465 case 'd': break; // Quietly ignored 466 case 'h': short_usage(); break; // Does not return 467 case 'p': set_pidfile(0); break; 468 case 'q': break; // Quietly ignored 469 case 'v': break; // Quietly ignored 470 case 'V': set_version(0); break; // Does not return 471 default: 472 fprintf(stderr,"Invalid option: '%s'. Try -h instead.\n",argv[a]); 473 return false; 474 } 475 } 476 return swaps_check_config(); 477 478 #endif 479 } 480 481 src/state.c
r96 r102 51 51 static inline bool timer_timeout(void) { return timer <= 0; } 52 52 53 #ifndef NO_CONFIG 53 54 char *set_cooldown(long long duration) 54 55 { … … 57 58 return NULL; 58 59 } 60 #endif 59 61 60 62 … … 84 86 static void state_to(enum State s) 85 87 { 88 #ifndef NO_CONFIG 86 89 if (verbose) 87 90 { … … 89 92 log_msg(LOG_DEBUG, localbuf); 90 93 } 94 #endif 91 95 the_state = s; 92 96 timer_reset(); src/state.h
r96 r102 28 28 void request_diet(void); 29 29 30 #ifndef NO_CONFIG 31 char *set_cooldown(long long duration); 30 32 #endif 31 33 34 #endif 35 src/swaps.c
r98 r102 56 56 static size_t swappath_len; 57 57 58 char *set_swappath(long long dummy)59 {60 return swappath;61 }62 58 63 59 /// Smallest allowed swapfile size … … 70 66 71 67 68 #ifndef NO_CONFIG 69 char *set_swappath(long long dummy) 70 { 71 return swappath; 72 } 72 73 char *set_min_swapsize(long long size) 73 74 { … … 75 76 return NULL; 76 77 } 77 78 78 char *set_max_swapsize(long long size) 79 79 { … … 81 81 return NULL; 82 82 } 83 #endif 83 84 84 85 85 86 bool swaps_check_config(void) 86 87 { 88 #ifndef NO_CONFIG 87 89 CHECK_CONFIG_ERR(min_swapsize > max_swapsize); 88 90 CHECK_CONFIG_ERR(min_swapsize < 10*PAGE_SIZE); 91 #endif 89 92 90 93 if (chdir(swappath) == -1) … … 93 96 return false; 94 97 } 98 99 swappath_len = strlen(swappath); 100 101 #ifndef NO_CONFIG 95 102 if (!getcwd(swappath, sizeof(swappath))) 96 103 { … … 98 105 return false; 99 106 } 100 swappath_len = strlen(swappath);101 107 // Remove trailing slash, if any 102 108 if (swappath_len && swappath[swappath_len-1] == '/') … … 110 116 return false; 111 117 } 118 #endif 112 119 113 120 return true; … … 150 157 151 158 dump_state(); 152 153 // TODO: Print memory overview, and include percentages 154 155 log_msg(LOG_INFO, "swapfiles in use:"); 156 log_msg(LOG_INFO, "file size used"); 157 for (int i=0; i<MAX_SWAPFILES; ++i) if (swapfiles[i].size) 158 { 159 sprintf(localbuf,"%4d%16lld%16lld",i,swapfiles[i].size,swapfiles[i].used); 160 log_msg(LOG_INFO, localbuf); 159 dump_memory(); 160 161 // Count active swapfiles. Note that we don't remember this anywhere; it's 162 // rarely needed (only when requested), it's not very costly to derive, and 163 // keeping a redundant counter is just asking for minor bugs. 164 int activeswaps = 0; 165 for (int i=0; i<MAX_SWAPFILES; ++i) if (swapfiles[i].size) ++activeswaps; 166 sprintf(localbuf, "swapfiles in use: %d", activeswaps); 167 log_msg(LOG_INFO, localbuf); 168 if (activeswaps) 169 { 170 log_msg(LOG_INFO, "file size used"); 171 for (int i=0; i<MAX_SWAPFILES; ++i) if (swapfiles[i].size) 172 { 173 sprintf(localbuf,"%4d%16lld%16lld",i,swapfiles[i].size,swapfiles[i].used); 174 log_msg(LOG_INFO, localbuf); 175 } 161 176 } 162 177 } … … 220 235 { 221 236 max_swapsize = TRUNC_TO_PAGE(bytes); 237 #ifndef NO_CONFIG 222 238 if (verbose) 223 239 { … … 225 241 log_msg(LOG_INFO, localbuf); 226 242 } 243 #endif 227 244 } 228 245 break; … … 332 349 if (valid_swapfile(d->d_name, &seqno) && !swapfiles[seqno].size) 333 350 { 351 #ifndef NO_CONFIG 334 352 if (!quiet) log_int(LOG_INFO, "Found old swapfile", seqno); 353 #endif 335 354 const memsize_t size = filesize(d->d_name); 336 355 if (likely(size > min_swapsize && enable_swapfile(d->d_name))) … … 340 359 else 341 360 { 361 #ifndef NO_CONFIG 342 362 if (!quiet) log_int(LOG_NOTICE, "Deleting unusable swapfile", seqno); 363 #endif 343 364 unlink(d->d_name); 344 365 } … … 430 451 { 431 452 // We didn't know about this swapfile yet. Adopt it. 453 #ifndef NO_CONFIG 432 454 if (!quiet) log_int(LOG_NOTICE, "Detected swapfile", result->seqno); 455 #endif 433 456 swapfiles[result->seqno].created = clock; 434 457 } 458 #ifndef NO_CONFIG 435 459 else if (unlikely(swapfiles[result->seqno].size != result->size)) 436 460 { … … 461 485 result->used, 462 486 result->size); 487 #endif 463 488 464 489 swapfiles[result->seqno].size = result->size; … … 510 535 char namebuf[30]; 511 536 snprintf(namebuf, sizeof(namebuf), "%d", file); 537 #ifndef NO_CONFIG 512 538 if (!quiet) log_int(LOG_NOTICE, "Retiring swapfile", file); 539 #endif 513 540 if (unlikely(swapoff(namebuf) == -1)) return false; 514 541 swapfiles[file].size = 0; … … 565 592 566 593 // We can allocate another swapfile. Great. 594 #ifndef NO_CONFIG 567 595 if (!quiet) log_int(LOG_NOTICE, "Allocating swapfile", newswap); 596 #endif 568 597 char file[30]; 569 598 snprintf(file, sizeof(file), "%d", newswap); src/swaps.h
r82 r102 64 64 void free_swapfile(memsize_t maxsize); 65 65 66 #ifndef NO_CONFIG 66 67 char *set_min_swapsize(long long size); 67 68 char *set_max_swapsize(long long size); 68 char *set_cooldown(long long duration);69 69 char *set_swappath(long long dummy); 70 #endif 70 71 71 72 /// Verify configuration for swaps module; cd into swappath
