Changeset 120

Show
Ignore:
Timestamp:
07/26/05 03:54:14 (3 years ago)
Author:
jtv
Message:

Cleaned up logging system; reworded "meekness" as "elasticity"

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • TODO

    r103 r120  
    66sure this is a bad thing, but it might create a risk of leaking files. 
    77 
    8 Describe the algorithm's finite state machine in Dot format. 
     8Describe the algorithm's finite state machine in Dot format, and convert to some 
     9readable format. 
    910 
    1011Adaptive cooldown times: recognize pattern of consistent policy reversals too 
     
    1819allow acquired state to be saved so as to reduce warmup time. 
    1920 
    20 Rephrase "meekness" as "elasticity". 
    21  
  • debian/changelog

    r105 r120  
    1919  * Checks swapdir's filesystem size on startup 
    2020  * Rewritten swapfile sizing formula 
     21  * Cleaned up logging system 
     22  * Rephrased "meekness" as "elasticity" 
    2123 
    2224 -- Jeroen T. Vermeulen <jtv@sipa.or.th>  Thu, 14 July 2005 19:30:00 +0700 
  • doc/swapspace.8

    r106 r120  
    6363behaviour in the face of varying memory requirements. 
    6464.TP 
    65 \fB\-B\fR \fIp\fR, \fB\-\-buffer_meekness\fR=\fIp\fR 
     65\fB\-B\fR \fIp\fR, \fB\-\-buffer_elasticity\fR=\fIp\fR 
    6666Consider \fIp\fR% of system-allocated I/O buffers to be available for other use. 
    6767.TP 
     
    6969Read \fIfile\fR instead of the default configuration file. 
    7070.TP 
    71 \fB\-C\fR \fIp\fR, \fB\-\-cache_meekness\fR=\fIp\fR 
     71\fB\-C\fR \fIp\fR, \fB\-\-cache_elasticity\fR=\fIp\fR 
    7272Consider \fIp\fR% of filesystem cache to be available for other use. 
    7373.TP 
  • src/log.c

    r102 r120  
    1717*/ 
    1818#include <errno.h> 
     19#include <stdarg.h> 
    1920#include <stdio.h> 
    2021#include <string.h> 
     
    7273 
    7374 
    74 void log_msg(int priority, const char msg[]
     75static void vlog(int priority, const char fmt[], va_list ap
    7576{ 
    76   if (logging) syslog(priority, "%s", msg); 
    77   else         fprintf(stream(priority), "%s%s\n", prefix(priority), msg); 
    78 
    79  
    80  
    81 void log_perr(int priority, const char msg[]) 
    82 
    83   log_perrno(priority, msg, errno); 
    84 
    85  
    86  
    87 void log_perrno(int priority, const char msg[], int fault_errno) 
    88 
    89   if (!fault_errno) 
    90     log_msg(priority, msg); 
     77  if (logging) 
     78  { 
     79    vsyslog(priority, fmt, ap); 
     80  } 
    9181  else 
    9282  { 
    93     const char *std = strerror(fault_errno); 
    94     if (logging) syslog(priority, "%s: %s", msg, std); 
    95     else fprintf(stream(priority), "%s%s: %s\n", prefix(priority), msg, std); 
     83    FILE *const out = stream(priority); 
     84    fprintf(out, "%s", prefix(priority)); 
     85    vfprintf(out, fmt, ap); 
     86    fprintf(out, "\n"); 
    9687  } 
    9788} 
    9889 
    9990 
    100 void log_str(int priority, const char msg[], const char arg[]
     91void logm(int priority, const char fmt[], ...
    10192{ 
    102   if (logging) syslog(priority, "%s '%s'", msg, arg); 
    103   else fprintf(stream(priority), "%s%s '%s'\n", prefix(priority), msg, arg); 
     93  va_list ap; 
     94  va_start(ap, fmt); 
     95  vlog(priority, fmt, ap); 
     96  va_end(ap); 
    10497} 
    10598 
    10699 
    107 void log_perrno_str(int priority, const char msg[], const char arg[], int err
     100void log_perr(int priority, const char msg[], int fault_errno
    108101{ 
    109   if (!err) 
    110   { 
    111     log_str(priority, msg, arg); 
    112   } 
    113   else 
    114   { 
    115     const char *std = strerror(err); 
    116     if (logging) 
    117       syslog(priority, "%s '%s': %s", msg, arg, std); 
    118     else 
    119       fprintf(stream(priority),"%s%s '%s': %s\n",prefix(priority),msg,arg,std); 
    120   } 
     102  if (!fault_errno) logm(priority, "%s", msg); 
     103  else logm(priority, "%s: %s", msg, strerror(fault_errno)); 
    121104} 
    122105 
    123106 
    124 void log_perr_str(int priority, const char msg[], const char arg[]
     107void log_perr_str(int priority, const char msg[], const char arg[], int err
    125108{ 
    126   log_perrno_str(priority, msg, arg, errno); 
    127 
    128  
    129  
    130 void log_int(int priority, const char msg[], int arg) 
    131 
    132   if (logging) syslog(priority, "%s '%d'", msg, arg); 
    133   else fprintf(stream(priority), "%s%s '%d'\n", prefix(priority), msg, arg); 
     109  if (!err) logm(priority, "%s '%s'", msg, arg); 
     110  else logm(priority, "%s '%s': %s", msg, arg, strerror(err)); 
    134111} 
    135112 
     
    142119    memsize_t found) 
    143120{ 
    144   if (logging) 
    145     syslog(priority, 
    146         "Discrepancy in swapfile %d: %s (%lld bytes vs. %lld)", 
    147         swapfile, 
    148         msg, 
    149         expected, 
    150         found); 
    151   else 
    152     fprintf(stream(priority), 
    153         "%sDiscrepancy in swapfile %d: %s (%lld bytes vs. %lld)\n", 
    154         prefix(priority), 
    155         swapfile, 
    156         msg, 
    157         expected, 
    158         found); 
     121  logm(priority, 
     122      "Discrepancy in swapfile %d: %s (%lld bytes vs. %lld)", 
     123      swapfile, 
     124      msg, 
     125      (long long)expected, 
     126      (long long)found); 
    159127} 
    160128#endif 
  • src/log.h

    r102 r120  
    3030void log_close(); 
    3131 
    32 /// Write plain message to log, or standard output/error as appropriate 
    33 void log_msg(int priority, const char msg[]); 
    34  
    35 /// Log plain message followed by quoted string 
    36 void log_str(int priority, const char msg[], const char arg[]); 
    37  
    38 /// Log message in perror() style (i.e. with errno-based message appended) 
    39 void log_perr(int priority, const char msg[]); 
     32/// Log formatted message to log, or stdout/sterr as appropriate 
     33void logm(int priority, const char fmt[], ...); 
    4034 
    4135/// Log message with given errno (or ignore error number if it is zero) 
    42 void log_perrno(int priority, const char msg[], int fault_errno); 
     36void log_perr(int priority, const char msg[], int fault_errno); 
    4337 
    4438/// Log message, perror()-style, but appending a quoted string 
    45 void log_perr_str(int priority, const char msg[], const char arg[]); 
    46  
    47 /// Log message, perror()-style, but appending a quoted string 
    48 void log_perrno_str(int priority, const char msg[], const char arg[], int err); 
    49  
    50 /// Log message, but appending a quoted integer argument 
    51 void log_int(int priority, const char msg[], int arg); 
    52  
    53 /// Log message, but appending an (unquoted) long long argument 
    54 void log_longlong(int priority, const char msg[], long long arg); 
     39void log_perr_str(int priority, const char msg[], const char arg[], int err); 
    5540 
    5641#ifndef NO_CONFIG 
  • src/main.c

    r107 r120  
    117117  if (unlikely(write(pidfd, localbuf, len) < len)) 
    118118  { 
    119     log_perr_str(LOG_ERR, "Could not write pidfile", pidfile); 
     119    log_perr_str(LOG_ERR, "Could not write pidfile", pidfile, errno); 
    120120    return false; 
    121121  } 
     
    137137  { 
    138138    if (errno == EEXIST) 
    139       log_str(LOG_ERR, "Daemon already running, or leftover pidfile", pidfile); 
     139      logm(LOG_ERR, 
     140          "Daemon already running, or leftover pidfile: '%s'", 
     141          pidfile); 
    140142    else 
    141       log_perr_str(LOG_ERR, "Could not create pidfile", pidfile); 
     143      log_perr_str(LOG_ERR, "Could not create pidfile", pidfile, errno); 
    142144    return false; 
    143145  } 
     
    360362  if (swapfs_size() < minswapfile) 
    361363  { 
    362     log_msg(LOG_CRIT,  
     364    logm(LOG_CRIT,  
    363365        "The filesystem holding swapspace's swap directory isn't big enough " 
    364366        "to hold useful swapfiles."); 
    365     log_msg(LOG_CRIT, 
     367    logm(LOG_CRIT, 
    366368        "Please try to expand this partition or relocate it to a larger one, " 
    367369        "if possible; or if all else fails, choose a different swap directory " 
     
    371373 
    372374  if (swapfs_free() < minswapfile) 
    373     log_msg(LOG_WARNING, 
     375    logm(LOG_WARNING, 
    374376        "Not enough free space on swap directory.  As things stand now, " 
    375377        "swapspace will not be able to create swap files."); 
     
    417419  { 
    418420#ifndef NO_CONFIG 
    419     if (verbose) log_msg(LOG_DEBUG, "daemonizing..."); 
     421    if (verbose) logm(LOG_DEBUG, "daemonizing..."); 
    420422#endif 
    421423    const pid_t pid = daemonize(); 
     
    433435      lseek(pidfd, 0, SEEK_SET); 
    434436#ifndef NO_CONFIG 
    435       if (verbose) log_int(LOG_DEBUG, "got process id", pid); 
     437      if (verbose) logm(LOG_DEBUG, "got process id %d", pid); 
    436438#endif 
    437439      return writepid(pid) ? EXIT_SUCCESS : EXIT_FAILURE; 
  • src/memory.c

    r105 r120  
    4040 
    4141/// Configuration item: what percentage of buffer space do we consider "free"? 
    42 static int buffer_meekness=30; 
     42static int buffer_elasticity=30; 
    4343 
    4444// TODO: Make this adaptive based on actual cache usage, to avoid thrashing? 
    4545// TODO: Any way of detecting actual cache flexibility or minimum size? 
    4646/// Configuration item: what percentage of cache space do we consider "free"? 
    47 static int cache_meekness=80; 
     47static int cache_elasticity=80; 
    4848 
    4949#ifndef NO_CONFIG 
     
    6363  return NULL; 
    6464} 
    65 char *set_buffer_meekness(long long pct) 
    66 { 
    67   buffer_meekness = (int)pct; 
     65char *set_buffer_elasticity(long long pct) 
     66{ 
     67  buffer_elasticity = (int)pct; 
    6868  return NULL; 
    6969} 
    70 char *set_cache_meekness(long long pct) 
    71 { 
    72   cache_meekness = (int)pct; 
     70char *set_cache_elasticity(long long pct) 
     71{ 
     72  cache_elasticity = (int)pct; 
    7373  return NULL; 
    7474} 
     
    245245  if (unlikely(!fp)) 
    246246  { 
    247     log_perr(LOG_ERR, "Could not open /proc/meminfo for reading"); 
     247    log_perr(LOG_ERR, "Could not open /proc/meminfo for reading", errno); 
    248248    return false; 
    249249  } 
     
    254254  if (unlikely(inf.entry[0])) 
    255255  { 
    256     log_perrno(LOG_ERR, inf.entry, inf.value); 
     256    log_perr(LOG_ERR, inf.entry, inf.value); 
    257257    return false; 
    258258  } 
     
    260260  if (unlikely(!s->MemTotal)) 
    261261  { 
    262     log_msg(LOG_ERR, 
     262    logm(LOG_ERR, 
    263263        "No memory detected! Perhaps /proc/meminfo is in an unexpected format"); 
    264264    return false; 
     
    266266  if (unlikely(s->MemTotal < s->MemFree+s->Buffers+s->Cached+s->SwapCached)) 
    267267  { 
    268     log_msg(LOG_ERR, "Memory statistics read from /proc/meminfo don't add up"); 
     268    logm(LOG_ERR, "Memory statistics read from /proc/meminfo don't add up"); 
    269269    return false; 
    270270  } 
     
    283283    printf("Initial memory status: "); 
    284284    if (init_req > 0) 
    285       sprintf(localbuf, "would prefer %lld extra bytes", init_req); 
     285      logm(LOG_INFO, "would prefer %lld extra bytes", init_req); 
    286286    else 
    287       sprintf(localbuf, "%lld bytes to spare", -init_req); 
    288     log_msg(LOG_INFO, localbuf); 
     287      logm(LOG_INFO, "%lld bytes to spare", -init_req); 
    289288  } 
    290289#endif 
     
    296295static inline memsize_t buffers_free(const struct memstate *st) 
    297296{ 
    298   return (st->Buffers/100) * buffer_meekness
     297  return (st->Buffers/100) * buffer_elasticity
    299298} 
    300299 
     
    304303{ 
    305304  const memsize_t cache = st->Cached - (st->Dirty + st->Writeback); 
    306   return (cache > 0) ? (cache/100)*cache_meekness : 0; 
     305  return (cache > 0) ? (cache/100)*cache_elasticity : 0; 
    307306} 
    308307 
     
    449448    long long cached) 
    450449{ 
    451   sprintf(localbuf
     450  logm(LOG_INFO
    452451      "%s: %lld total, %lld free (%lld used); %lld cached", 
    453452      category, 
     
    456455      (total - free), 
    457456      cached); 
    458   log_msg(LOG_INFO, localbuf); 
    459457} 
    460458 
     
    472470      st.Cached + st.SwapCached); 
    473471 
    474   sprintf(localbuf
     472  logm(LOG_INFO
    475473      "bufs: %lld, dirty: %lld, writeback: %lld", 
    476474      st.Buffers, 
    477475      st.Dirty, 
    478476      st.Writeback); 
    479   log_msg(LOG_INFO, localbuf); 
    480477 
    481478  const int pf = pct_free(&st); 
    482   sprintf(localbuf
     479  logm(LOG_INFO
    483480      "estimate free: %lld cache, %lld bufs, %lld total (%d%%)", 
    484481      cache_free(&st), 
     
    486483      space_free(&st), 
    487484      pf); 
    488   log_msg(LOG_INFO, localbuf); 
    489   sprintf(localbuf, 
     485  logm(LOG_INFO, 
    490486      "thresholds: %d%% < %d%% < %d%%", 
    491487      lower_freelimit, 
    492488      pf, 
    493489      upper_freelimit); 
    494   log_msg(LOG_INFO, localbuf); 
    495 
    496  
    497  
     490
     491 
     492 
  • src/memory.h

    r105 r120  
    6969char *set_upper_freelimit(long long pct); 
    7070char *set_freetarget(long long pct); 
    71 char *set_buffer_meekness(long long pct); 
    72 char *set_cache_meekness(long long pct); 
     71char *set_buffer_elasticity(long long pct); 
     72char *set_cache_elasticity(long long pct); 
    7373 
    7474bool memory_check_config(void); 
  • src/opts.c

    r105 r120  
    7777static const struct option options[] = 
    7878{ 
    79   { "buffer_meekness", 'B', at_num,  0, 100, set_buffer_meekness
     79  { "buffer_elasticity",'B', at_num,  0, 100, set_buffer_elasticity
    8080  "Consider n% of buffer memory to be \"available\"" }, 
    81   { "cache_meekness",  'C', at_num,  0, 100, set_cache_meekness
     81  { "cache_elasticity",        'C', at_num,  0, 100, set_cache_elasticity
    8282  "Consider n% of cache memory to be \"available\"" }, 
    8383  { "configfile",       'c', at_str,  1, PATH_MAX, set_configfile, 
     
    205205    assert(ptlen < strlen(pad)); 
    206206 
    207     printf("    -%c%s,%s--%s%s%*s\t%s\n", 
     207    printf("  -%c%s,%s--%s%s%*s\t%s\n", 
    208208        options[i].shortopt, 
    209209        pt, 
  • src/state.c

    r102 r120  
    8787{ 
    8888#ifndef NO_CONFIG 
    89   if (verbose) 
    90   { 
    91     sprintf(localbuf, "%s -> %s", Statenames[the_state], Statenames[s]); 
    92     log_msg(LOG_DEBUG, localbuf); 
    93   } 
     89  if (verbose) logm(LOG_DEBUG,"%s -> %s",Statenames[the_state],Statenames[s]); 
    9490#endif 
    9591  the_state = s; 
     
    167163void dump_state(void) 
    168164{ 
    169   sprintf(localbuf, "state: %s", Statenames[the_state]); 
    170   log_msg(LOG_INFO, localbuf); 
    171   if (timer > 0) 
    172   { 
    173     sprintf(localbuf, "timer: %ld", (long)timer); 
    174     log_msg(LOG_INFO, localbuf); 
    175   } 
     165  logm(LOG_INFO, "state: %s", Statenames[the_state]); 
     166  if (timer > 0) logm(LOG_INFO, "timer: %ld", (long)timer); 
    176167} 
    177168 
  • src/swaps.c

    r108 r120  
    100100  if (swappath[0] != '/') 
    101101  { 
    102     log_str(LOG_ERR,"Swap path is not absolute (must start with '/')",swappath); 
     102    logm(LOG_ERR, 
     103        "Swap path is not absolute (must start with '/'): '%s'", 
     104        swappath); 
    103105    return false; 
    104106  } 
     
    116118    const int err = errno; 
    117119    bool please_reinstall = false; 
    118     log_perr_str(LOG_ERR, "Could not cd to swap directory", swappath); 
     120    log_perr_str(LOG_ERR, "Could not cd to swap directory", swappath, errno); 
    119121    switch (err) 
    120122    { 
     
    133135    } 
    134136    if (please_reinstall) 
    135       log_msg(LOG_ERR, "swapspace installed incorrectly.  Please reinstall!"); 
     137      logm(LOG_ERR, "swapspace installed incorrectly.  Please reinstall!"); 
    136138    return false; 
    137139  } 
     
    145147  if (!getcwd(swappath, sizeof(swappath))) 
    146148  { 
    147     log_msg(LOG_CRIT, "Swap path too long"); 
     149    logm(LOG_CRIT, "Swap path too long"); 
    148150    return false; 
    149151  } 
     
    157159  for (int i=swappath_len-1; i >= 0; --i) if (isspace(swappath[i])) 
    158160  { 
    159     log_msg(LOG_ERR, "Not supported: swap path contains whitespace"); 
     161    logm(LOG_ERR, "Not supported: swap path contains whitespace"); 
    160162    return false; 
    161163  } 
     
    197199void dump_stats(void) 
    198200{ 
    199   sprintf(localbuf, "clock: %lld", (long long)clock); 
    200   log_msg(LOG_INFO, localbuf); 
     201  logm(LOG_INFO, "clock: %lld", (long long)clock); 
    201202 
    202203  dump_state(); 
     
    208209  int activeswaps = 0; 
    209210  for (int i=0; i<MAX_SWAPFILES; ++i) if (swapfiles[i].size) ++activeswaps; 
    210   sprintf(localbuf, "swapfiles in use: %d", activeswaps); 
    211   log_msg(LOG_INFO, localbuf); 
     211  logm(LOG_INFO, "swapfiles in use: %d", activeswaps); 
    212212  if (activeswaps) 
    213213  { 
    214     log_msg(LOG_INFO, 
     214    logm(LOG_INFO, 
    215215        "file            size            used         created  seen"); 
    216216    for (int i=0; i<MAX_SWAPFILES; ++i) if (swapfiles[i].size) 
    217     { 
    218       sprintf(localbuf, 
     217      logm(LOG_INFO, 
    219218          "%4d%16lld%16lld%16lld  %d", 
    220219          i, 
     
    223222          swapfiles[i].created, 
    224223          (int)swapfiles[i].observed_in_wild); 
    225       log_msg(LOG_INFO, localbuf); 
    226     } 
    227224  } 
    228225} 
     
    245242    log_perr_str(LOG_ERR, 
    246243        "Could not get filesystem information for swap directory", 
    247         swappath); 
     244        swappath, 
     245        errno); 
    248246 
    249247  return !fail; 
     
    293291  runcommand("mkswap", file); 
    294292  const bool ok = (swapon(file, 0) == 0); 
    295   if (unlikely(!ok)) log_perr_str(LOG_ERR, "Could not enable swapfile", file); 
     293  if (unlikely(!ok)) 
     294    log_perr_str(LOG_ERR, "Could not enable swapfile", file, errno); 
    296295  return ok; 
    297296} 
     
    358357  { 
    359358    const int err = errno; 
    360     log_perr_str(LOG_ERR, "Error writing swapfile", file); 
     359    log_perr_str(LOG_ERR, "Error writing swapfile", file, errno); 
    361360    switch (err) 
    362361    { 
     
    368367#ifndef NO_CONFIG 
    369368        if (verbose) 
    370         { 
    371           sprintf(localbuf, "Restricting swapfile size to %lld", bytes); 
    372           log_msg(LOG_INFO, localbuf); 
    373         } 
     369          logm(LOG_INFO, "Restricting swapfile size to %lld", (long long)bytes); 
    374370#endif 
    375371      } 
     
    381377      break; 
    382378    default: 
    383         log_msg(LOG_WARNING, "Unexpected error writing swap file"); 
     379        logm(LOG_WARNING, "Unexpected error writing swap file"); 
    384380    } 
    385381    bytes = 0; 
     
    413409  if (unlikely(fd == -1)) 
    414410  { 
    415     log_perr_str(LOG_ERR, "Could not create swapfile", file); 
     411    log_perr_str(LOG_ERR, "Could not create swapfile", file, errno); 
    416412    return 0; 
    417413  } 
     
    455451  if (unlikely(fd == -1)) 
    456452  { 
    457     log_perr_str(LOG_WARNING, "Can't determine size of", name); 
     453    log_perr_str(LOG_WARNING, "Can't determine size of", name, errno); 
    458454    return -1; 
    459455  } 
     
    461457  memsize_t pos = SEEK(fd, 0, SEEK_END); 
    462458  if (unlikely(pos == -1)) 
    463     log_perr_str(LOG_WARNING, "Can't determine size of", name); 
     459    log_perr_str(LOG_WARNING, "Can't determine size of", name, errno); 
    464460 
    465461  return pos; 
     
    472468  if (unlikely(!dir)) 
    473469  { 
    474     log_perr(LOG_ERR, "Cannot read swap directory"); 
     470    log_perr(LOG_ERR, "Cannot read swap directory", errno); 
    475471    return false; 
    476472  } 
     
    481477    { 
    482478#ifndef NO_CONFIG 
    483       if (!quiet) log_int(LOG_INFO, "Found old swapfile", seqno); 
     479      if (!quiet) logm(LOG_INFO, "Found old swapfile '%d'", seqno); 
    484480#endif 
    485481      const memsize_t size = filesize(d->d_name);  
     
    491487      { 
    492488#ifndef NO_CONFIG 
    493         if (!quiet) log_int(LOG_NOTICE, "Deleting unusable swapfile", seqno); 
     489        if (!quiet) logm(LOG_NOTICE, "Deleting unusable swapfile '%d'", seqno); 
    494490#endif 
    495491        unlink(d->d_name); 
     
    508504{ 
    509505  FILE *fp = fopen("/proc/swaps", "r"); 
    510   if (unlikely(!fp)) log_perr(LOG_ERR, "Could not open /proc/swaps"); 
     506  if (unlikely(!fp)) log_perr(LOG_ERR, "Could not open /proc/swaps", errno); 
    511507  return fp; 
    512508} 
     
    517513{ 
    518514  char c; 
    519   if (unlikely(sscanf(localbuf, "Filename Type Size Used %c",&c) < 1)) 
    520   { 
    521     log_msg(LOG_ERR, "/proc/swaps is not in the expected format"); 
     515  if (unlikely(sscanf(buf, "Filename Type Size Used %c",&c) < 1)) 
     516  { 
     517    logm(LOG_ERR, "/proc/swaps is not in the expected format"); 
    522518    return false; 
    523519  } 
     
    566562      if (!check_proc_swaps_header(localbuf)) 
    567563      { 
    568         log_str(LOG_ERR, "Parse error in /proc/swaps:", localbuf); 
     564        logm(LOG_ERR, "Parse error in /proc/swaps: '%s'", localbuf); 
    569565        return false; 
    570566      } 
     
    585581        // We didn't know about this swapfile yet.  Adopt it. 
    586582#ifndef NO_CONFIG 
    587         if (!quiet) log_int(LOG_NOTICE, "Detected swapfile", result->seqno); 
     583        if (!quiet) logm(LOG_NOTICE, "Detected swapfile '%d'", result->seqno); 
    588584#endif 
    589585        swapfiles[result->seqno].created = clock; 
     
    677673  snprintf(namebuf, sizeof(namebuf), "%d", file); 
    678674#ifndef NO_CONFIG 
    679   if (!quiet) log_int(LOG_NOTICE, "Retiring swapfile", file); 
     675  if (!quiet) logm(LOG_NOTICE, "Retiring swapfile '%d'", file); 
    680676#endif 
    681677  if (unlikely(swapoff(namebuf) == -1)) return false; 
     
    759755  // We can allocate another swapfile.  Great. 
    760756#ifndef NO_CONFIG 
    761   if (!quiet) log_int(LOG_NOTICE, "Allocating swapfile", newswap); 
     757  if (!quiet) logm(LOG_NOTICE, "Allocating swapfile '%d'", newswap); 
    762758#endif 
    763759  char file[30];