Skip to content

Commit

Permalink
Deprecate -t option to ldmsd
Browse files Browse the repository at this point in the history
This turns -t into a no-op and a warning.
  • Loading branch information
baallan authored Nov 4, 2024
1 parent dcc50b5 commit ba359dd
Showing 1 changed file with 2 additions and 21 deletions.
23 changes: 2 additions & 21 deletions ldms/src/ldmsd/ldmsd.c
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,6 @@ int foreground;
int cfg_cntr = 0;
pthread_t event_thread = (pthread_t)-1;
char *logfile;
int log_truncate = 0;
char *pidfile;
char *bannerfile;

Expand Down Expand Up @@ -553,15 +552,6 @@ FILE *ldmsd_open_log()
return f;
}

if (log_truncate) {
int err = truncate(logfile, 0);
if (err && errno != ENOENT) {
ldmsd_log(LDMSD_LERROR, "Could not truncate the log file named '%s'. errno=%d\n",
logfile, errno);
cleanup(12, "log truncate failed");
}
}

f = fopen_perm(logfile, "a", LDMSD_DEFAULT_FILE_PERM);
if (!f) {
ldmsd_log(LDMSD_LERROR, "Could not open the log file named '%s'\n",
Expand Down Expand Up @@ -634,7 +624,7 @@ void usage_hint(char *argv[],char *hint)
printf(" -v LEVEL, --log_level LEVEL The available verbosity levels, in order of decreasing verbosity,\n"
" are DEBUG, INFO, ERROR, CRITICAL and QUIET.\n"
" The default level is ERROR.\n");
printf(" -t, --log_truncate Truncate the log file at start if the log file exists.\n");
printf(" -t, --log_truncate Deprecated & disabled. Removed in future release.\n");
printf(" -L optlog, --log_config optlog Log config commands; optlog is INT:PATH\n");
printf(" Communication Options\n");
printf(" -x xprt:port:host\n"
Expand Down Expand Up @@ -2116,7 +2106,7 @@ int ldmsd_process_cmd_line_arg(char opt, char *value)
}
break;
case 't':
/* already done log_truncate = 1; */
ldmsd_log(LDMSD_LWARNING, "-t option no longer supported\n");
break;
case 'x':
if (check_arg("x", value, LO_NAME))
Expand Down Expand Up @@ -2196,15 +2186,6 @@ int main(int argc, char *argv[])
exit(1);
}

int i;
for (i = 1; i < argc; i++) {
/* prescan for -t so log open/truncate is correctly done */
if (!strcmp(argv[i], "-t")) {
log_truncate = 1;
break;
}
}

opterr = 0;
while ((op = getopt_long(argc, argv, short_opts, long_opts, NULL)) != -1) {
switch (op) {
Expand Down

0 comments on commit ba359dd

Please sign in to comment.