示例#1
0
static int
configure_eventer(const char *appname) {
    int rv = 0;
    mtev_boolean rlim_found = mtev_false;
    mtev_hash_table *table;
    char appscratch[1024];

    snprintf(appscratch, sizeof(appscratch), "/%s/eventer/config", appname);
    table = mtev_conf_get_hash(NULL, appscratch);
    if(table) {
        mtev_hash_iter iter = MTEV_HASH_ITER_ZERO;
        const char *key, *value;
        int klen;
        while(mtev_hash_next_str(table, &iter, &key, &klen, &value)) {
            int subrv;
            /* We want to set a sane default if the user doesn't provide an
             * rlim_nofiles value... however, we have to try to set the user
             * value before we set the default, because otherwise, if snowth
             * is being run as a non-privileged user and we set a default
             * lower than the user specified one, we can't raise it. Ergo -
             * try to set from the config first, then set a default if one
             * isn't specified */
            if ((strlen(key) == strlen("rlim_nofiles")) &&
                    (strncmp(key, "rlim_nofiles", strlen(key)) == 0) ) {
                rlim_found = mtev_true;
            }
            if((subrv = eventer_propset(key, value)) != 0)
                rv = subrv;
        }
        mtev_hash_destroy(table, free, free);
        free(table);
    }

    /* If no rlim_nofiles configuration was found, set a default
     * of (2048*2048) */
    if (!rlim_found) {
        eventer_propset("rlim_nofiles", "4194304");
    }
    return rv;
}
示例#2
0
static
int configure_eventer() {
  int rv = 0;
  mtev_hash_table *table;
  table = mtev_conf_get_hash(NULL, "/" APPNAME "/eventer/config");
  if(table) {
    mtev_hash_iter iter = MTEV_HASH_ITER_ZERO;
    const char *key, *value;
    int klen;
    while(mtev_hash_next_str(table, &iter, &key, &klen, &value)) {
      int subrv;
      if((subrv = eventer_propset(key, value)) != 0)
        rv = subrv;
    }
    mtev_hash_destroy(table, free, free);
    free(table);
  }
  return rv;
}
示例#3
0
static int
configure_eventer(const char *appname) {
  int rv = 0;
  noit_hash_table *table;
  char appscratch[1024];

  snprintf(appscratch, sizeof(appscratch), "/%s/eventer/config", appname);
  table = noit_conf_get_hash(NULL, appscratch);
  if(table) {
    noit_hash_iter iter = NOIT_HASH_ITER_ZERO;
    const char *key, *value;
    int klen;
    while(noit_hash_next_str(table, &iter, &key, &klen, &value)) {
      int subrv;
      if((subrv = eventer_propset(key, value)) != 0)
        rv = subrv;
    }
    noit_hash_destroy(table, free, free);
    free(table);
  }
  return rv;
}