Print this page
Reduce lint

Split Close
Expand all
Collapse all
          --- old/usr/src/cmd/zoneadmd/mcap.c
          +++ new/usr/src/cmd/zoneadmd/mcap.c
↓ open down ↓ 154 lines elided ↑ open up ↑
 155  155  static cond_t   shutdown_cv;
 156  156  static int      shutting_down = 0;
 157  157  static thread_t mcap_tid;
 158  158  static FILE     *debug_log_fp = NULL;
 159  159  static uint64_t zone_rss_cap;           /* RSS cap(KB) */
 160  160  static char     over_cmd[2 * BUFSIZ];   /* same size as zone_attr_value */
 161  161  static boolean_t skip_vmusage = B_FALSE;
 162  162  static boolean_t skip_pageout = B_FALSE;
 163  163  static boolean_t skip_pf_throttle = B_FALSE;
 164  164  
 165      -static zlog_t   *logp;
 166      -
 167  165  static int64_t check_suspend();
 168  166  static void get_mcap_tunables();
 169  167  
 170  168  /*
 171  169   * Structure to hold current state about a process address space that we're
 172  170   * working on.
 173  171   */
 174  172  typedef struct {
 175  173          int pr_curr;            /* the # of the mapping we're working on */
 176  174          int pr_nmap;            /* number of mappings in address space */
↓ open down ↓ 204 lines elided ↑ open up ↑
 381  379  /*
 382  380   * Work through a process paging out mappings until the whole address space was
 383  381   * examined or the excess is < 0.  Return our estimate of the updated excess.
 384  382   */
 385  383  static int64_t
 386  384  pageout_process(pid_t pid, int64_t excess)
 387  385  {
 388  386          int                     psfd;
 389  387          prmap_t                 *pmap;
 390  388          proc_map_t              cur;
 391      -        int                     res;
 392  389          int64_t                 sum_d_rss, d_rss;
 393  390          int64_t                 old_rss;
 394  391          int                     map_cnt;
 395  392          psinfo_t                psinfo;
 396  393          char                    pathbuf[MAXPATHLEN];
 397  394  
 398  395          (void) snprintf(pathbuf, sizeof (pathbuf), "%s/%d/psinfo", zoneproc,
 399  396              pid);
 400  397          if ((psfd = open(pathbuf, O_RDONLY, 0000)) < 0)
 401  398                  return (excess);
↓ open down ↓ 31 lines elided ↑ open up ↑
 433  430  
 434  431          debug("pid %ld: nmap %d sz %dKB rss %lldKB %s\n",
 435  432              pid, cur.pr_nmap, psinfo.pr_size, old_rss, psinfo.pr_psargs);
 436  433  
 437  434          /*
 438  435           * Within the process's address space, attempt to page out mappings.
 439  436           */
 440  437          sum_d_rss = 0;
 441  438          while (excess > 0 && pmap != NULL && !shutting_down) {
 442  439                  /* invalidate the entire mapping */
 443      -                if ((res = pageout_mapping(pid, pmap)) < 0)
      440 +                if (pageout_mapping(pid, pmap) < 0)
 444  441                          debug("pid %ld: mapping 0x%p %ldkb unpageable (%d)\n",
 445      -                            pid, pmap->pr_vaddr, pmap->pr_size / 1024, errno);
      442 +                            pid, (void *)pmap->pr_vaddr,
      443 +                            (long)pmap->pr_size / 1024L, errno);
 446  444  
 447  445                  map_cnt++;
 448  446  
 449  447                  /*
 450  448                   * Re-check the process rss and get the delta.
 451  449                   */
 452  450                  if (pread(psfd, &psinfo, sizeof (psinfo), 0)
 453  451                      != sizeof (psinfo)) {
 454  452                          excess -= old_rss;
 455  453                          goto done;
↓ open down ↓ 693 lines elided ↑ open up ↑
1149 1147          debug("thread shutdown\n");
1150 1148  }
1151 1149  
1152 1150  void
1153 1151  create_mcap_thread(zlog_t *zlogp, zoneid_t id)
1154 1152  {
1155 1153          int             res;
1156 1154  
1157 1155          shutting_down = 0;
1158 1156          zid = id;
1159      -        logp = zlogp;
1160 1157  
1161 1158          /* all but the lx brand currently use /proc */
1162 1159          if (strcmp(brand_name, "lx") == 0) {
1163 1160                  (void) snprintf(zoneproc, sizeof (zoneproc),
1164 1161                      "%s/root/native/proc", zonepath);
1165 1162          } else {
1166 1163                  (void) snprintf(zoneproc, sizeof (zoneproc), "%s/root/proc",
1167 1164                      zonepath);
1168 1165          }
1169 1166  
↓ open down ↓ 22 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX