Print this page
OS-399 zone phys. mem. cap should be a rctl and have associated kstat
        
*** 19,28 ****
--- 19,29 ----
   * CDDL HEADER END
   */
  
  /*
   * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+  * Copyright (c) 2011, Joyent, Inc. All rights reserved.
   */
  #include <alloca.h>
  #include <assert.h>
  #include <dirent.h>
  #include <dlfcn.h>
*** 2188,2198 ****
                  return (0);
          }
          return (rctlblk_get_value(rblk));
  }
  
! #define ZSD_NUM_RCTL_VALS 19
  
  /*
   * Fetch the limit information for a zone.  This uses zone_enter() as the
   * getrctl(2) system call only returns rctl information for the zone of
   * the caller.
--- 2189,2199 ----
                  return (0);
          }
          return (rctlblk_get_value(rblk));
  }
  
! #define ZSD_NUM_RCTL_VALS 20
  
  /*
   * Fetch the limit information for a zone.  This uses zone_enter() as the
   * getrctl(2) system call only returns rctl information for the zone of
   * the caller.
*** 2235,2250 ****
          *shmids = 0;
          *semids = 0;
          *msgids = 0;
          *lofi = 0;
  
-         /* Get the ram cap first since it is a zone attr */
-         ret = zone_getattr(zone->zsz_id, ZONE_ATTR_PHYS_MCAP,
-             ram_cap, sizeof (*ram_cap));
-         if (ret < 0 || *ram_cap == 0)
-                 *ram_cap = ZS_LIMIT_NONE;
- 
          /* Get the zone's default scheduling class */
          ret = zone_getattr(zone->zsz_id, ZONE_ATTR_SCHED_CLASS,
              class, sizeof (class));
          if (ret < 0)
                  return (-1);
--- 2236,2245 ----
*** 2296,2305 ****
--- 2291,2301 ----
                  vals[i++] = zsd_get_zone_rctl_usage("zone.max-sem-ids");
                  vals[i++] = zsd_get_zone_rctl_limit("zone.max-msg-ids");
                  vals[i++] = zsd_get_zone_rctl_usage("zone.max-msg-ids");
                  vals[i++] = zsd_get_zone_rctl_limit("zone.max-lofi");
                  vals[i++] = zsd_get_zone_rctl_usage("zone.max-lofi");
+                 vals[i++] = zsd_get_zone_rctl_usage("zone.max-physical-memory");
  
                  if (write(p[1], vals, ZSD_NUM_RCTL_VALS * sizeof (uint64_t)) !=
                      ZSD_NUM_RCTL_VALS * sizeof (uint64_t)) {
                          (void) close(p[1]);
                          _exit(1);
*** 2340,2349 ****
--- 2336,2346 ----
          *semids = vals[i++];
          *msgids_cap = vals[i++];
          *msgids = vals[i++];
          *lofi_cap = vals[i++];
          *lofi = vals[i++];
+         *ram_cap = vals[i++];
  
          /* Interpret maximum values as no cap */
          if (*cpu_cap == UINT32_MAX || *cpu_cap == 0)
                  *cpu_cap = ZS_LIMIT_NONE;
          if (*processes_cap == sys->zss_processes_max)