diff options
author | Noriko Hosoi <nhosoi@redhat.com> | 2006-10-13 01:06:29 +0000 |
---|---|---|
committer | Noriko Hosoi <nhosoi@redhat.com> | 2006-10-13 01:06:29 +0000 |
commit | 57e9577e0e96da39c62cc0b2c3ae3c053ff9232f (patch) | |
tree | 9c276cb9c3f35cec42e4c63c24fcba21f25b929e /ldap/servers/slapd/snmp_collator.c | |
parent | 65dd96fe4a1effd42dfecaebd58c384ba7624518 (diff) | |
download | ds-57e9577e0e96da39c62cc0b2c3ae3c053ff9232f.tar.gz ds-57e9577e0e96da39c62cc0b2c3ae3c053ff9232f.tar.xz ds-57e9577e0e96da39c62cc0b2c3ae3c053ff9232f.zip |
[208672] parameterizing the hardcoded paths (phase 2. db, log, lock, pid, cert, and instance dir)
1) introduced these 3 new config attributes:
nsslapd-lockdir, nsslapd-tmpdir, nsslapd-certdir,
and eliminated: nsslapd-instancedir.
2) replaced the hardcoded paths with the corresponding attribute value in the
server as well as in the create/remove instance codes.
3) moved snmp stats file to the nsslapd-tmpdir
4) moved the server instance dir to <prefix>/lib/<brand>-ds/slapd-<id>
Diffstat (limited to 'ldap/servers/slapd/snmp_collator.c')
-rw-r--r-- | ldap/servers/slapd/snmp_collator.c | 64 |
1 files changed, 30 insertions, 34 deletions
diff --git a/ldap/servers/slapd/snmp_collator.c b/ldap/servers/slapd/snmp_collator.c index 79838247..043e3765 100644 --- a/ldap/servers/slapd/snmp_collator.c +++ b/ldap/servers/slapd/snmp_collator.c @@ -392,54 +392,50 @@ int snmp_collator_start() { int err; - char *instancedir = config_get_instancedir(); + char *statspath = config_get_tmpdir(); + char *lp = NULL; - /* - * Get directory for our stats file - */ + /* + * Get directory for our stats file + */ + if (NULL == statspath) { + statspath = slapi_ch_strdup("/tmp"); + } - PR_snprintf(szStatsFile, sizeof(szStatsFile), "%s/logs/%s", instancedir, - AGT_STATS_FILE); + PR_snprintf(szStatsFile, sizeof(szStatsFile), "%s/%s", + statspath, AGT_STATS_FILE); tmpstatsfile = szStatsFile; + slapi_ch_free((void **) &statspath); - slapi_ch_free((void **) &instancedir); - - - /* open the memory map */ - - if ((err = agt_mopen_stats(tmpstatsfile, O_RDWR, &hdl) != 0)) - { - if (err != EEXIST) /* Ignore if file already exists */ - { - printf("Failed to open stats file (%s) (error %d).\n", - AGT_STATS_FILE, err); - - exit(1); - } - } + /* open the memory map */ + if ((err = agt_mopen_stats(tmpstatsfile, O_RDWR, &hdl) != 0)) + { + if (err != EEXIST) /* Ignore if file already exists */ + { + printf("Failed to open stats file (%s) (error %d).\n", + szStatsFile, err); + exit(1); + } + } /* read config entry for entity table data */ - /* point stats struct at mmap data */ - stats = (struct agt_stats_t *) mmap_tbl [hdl].fp; + stats = (struct agt_stats_t *) mmap_tbl [hdl].fp; /* initialize stats data */ - snmp_collator_init(); + snmp_collator_init(); /* -* now that memmap is open and things point the right way -* an atomic set or increment anywhere in slapd should set -* the snmp memmap vars correctly and be able to be polled by snmp +* now that memmap is open and things point the right way +* an atomic set or increment anywhere in slapd should set +* the snmp memmap vars correctly and be able to be polled by snmp */ - /* Arrange to be called back periodically */ - snmp_eq_ctx = slapi_eq_repeat(snmp_collator_update, NULL, (time_t)0, - SLAPD_SNMP_UPDATE_INTERVAL); - - -return 0; - + /* Arrange to be called back periodically */ + snmp_eq_ctx = slapi_eq_repeat(snmp_collator_update, NULL, (time_t)0, + SLAPD_SNMP_UPDATE_INTERVAL); + return 0; } |