Print this page
OS-11 rcapd behaves poorly when under extreme load
        
*** 19,28 ****
--- 19,29 ----
   * CDDL HEADER END
   */
  
  /*
   * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
+  * Copyright (c) 2011, Joyent, Inc. All rights reserved.
   */
  
  #include <sys/param.h>
  #include <libintl.h>
  #include <stdarg.h>
*** 254,333 ****
                  warn(gettext("illegal argument -- %s\n"), p);
                  return (-1);
          } else {
                  return (i);
          }
- }
- 
- /*
-  * get_running_zones() calls zone_list(2) to find out how many zones are
-  * running.  It then calls zone_list(2) again to fetch the list of running
-  * zones (stored in *zents).
-  */
- int
- get_running_zones(uint_t *nzents, zone_entry_t **zents)
- {
-         zoneid_t *zids;
-         uint_t nzents_saved;
-         int i;
-         zone_entry_t *zentp;
-         zone_state_t zstate;
- 
-         *zents = NULL;
-         if (zone_list(NULL, nzents) != 0) {
-                 warn(gettext("could not get zoneid list\n"));
-                 return (E_ERROR);
-         }
- 
- again:
-         if (*nzents == 0)
-                 return (E_SUCCESS);
- 
-         if ((zids = (zoneid_t *)calloc(*nzents, sizeof (zoneid_t))) == NULL) {
-                 warn(gettext("out of memory: zones will not be capped\n"));
-                 return (E_ERROR);
-         }
- 
-         nzents_saved = *nzents;
- 
-         if (zone_list(zids, nzents) != 0) {
-                 warn(gettext("could not get zone list\n"));
-                 free(zids);
-                 return (E_ERROR);
-         }
-         if (*nzents != nzents_saved) {
-                 /* list changed, try again */
-                 free(zids);
-                 goto again;
-         }
- 
-         *zents = calloc(*nzents, sizeof (zone_entry_t));
-         if (*zents == NULL) {
-                 warn(gettext("out of memory: zones will not be capped\n"));
-                 free(zids);
-                 return (E_ERROR);
-         }
- 
-         zentp = *zents;
-         for (i = 0; i < *nzents; i++) {
-                 char name[ZONENAME_MAX];
- 
-                 if (getzonenamebyid(zids[i], name, sizeof (name)) < 0) {
-                         warn(gettext("could not get name for "
-                             "zoneid %d\n"), zids[i]);
-                         continue;
-                 }
- 
-                 (void) strlcpy(zentp->zname, name, sizeof (zentp->zname));
-                 zentp->zid = zids[i];
-                 if (zone_get_state(name, &zstate) != Z_OK ||
-                     zstate != ZONE_STATE_RUNNING)
-                         continue;
- 
- 
-                 zentp++;
-         }
-         *nzents = zentp - *zents;
- 
-         free(zids);
-         return (E_SUCCESS);
  }
--- 255,260 ----