"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/doveadm/doveadm-oldstats.c" between
dovecot-2.3.16.tar.gz and dovecot-2.3.17.tar.gz

About: Dovecot is an IMAP and POP3 server, written with security primarily in mind.

doveadm-oldstats.c  (dovecot-2.3.16):doveadm-oldstats.c  (dovecot-2.3.17)
skipping to change at line 496 skipping to change at line 496
stats_top_start(&ctx); stats_top_start(&ctx);
i_stream_destroy(&ctx.input); i_stream_destroy(&ctx.input);
hash_table_destroy(&ctx.sessions); hash_table_destroy(&ctx.sessions);
array_free(&ctx.lines); array_free(&ctx.lines);
pool_unref(&ctx.prev_pool); pool_unref(&ctx.prev_pool);
pool_unref(&ctx.cur_pool); pool_unref(&ctx.cur_pool);
i_close_fd(&ctx.fd); i_close_fd(&ctx.fd);
} }
static void stats_reset(const char *path, const char **items ATTR_UNUSED) static void stats_reset(const char *path)
{ {
const char **ptr ATTR_UNUSED; const char **ptr ATTR_UNUSED;
int fd,ret; int fd,ret;
string_t *cmd; string_t *cmd;
struct istream *input; struct istream *input;
const char *line; const char *line;
fd = doveadm_connect(path); fd = doveadm_connect(path);
net_set_nonblock(fd, FALSE); net_set_nonblock(fd, FALSE);
input = i_stream_create_fd(fd, SIZE_MAX); input = i_stream_create_fd(fd, SIZE_MAX);
skipping to change at line 542 skipping to change at line 542
} else if (!str_begins(line, "OK")) { } else if (!str_begins(line, "OK")) {
i_error("%s",line); i_error("%s",line);
} else { } else {
i_info("Stats reset"); i_info("Stats reset");
} }
i_stream_destroy(&input); i_stream_destroy(&input);
i_close_fd(&fd); i_close_fd(&fd);
} }
static void cmd_stats_top(int argc, char *argv[]) static void cmd_stats_top(struct doveadm_cmd_context *cctx)
{ {
const char *path, *sort_type; const char *path, *sort_type;
int c; bool b;
path = t_strconcat(doveadm_settings->base_dir, "/old-stats", NULL); if (!doveadm_cmd_param_str(cctx, "socket-path", &path)) {
path = t_strconcat(doveadm_settings->base_dir,
while ((c = getopt(argc, argv, "bs:")) > 0) { "/old-stats", NULL);
switch (c) { }
case 'b': if (!doveadm_cmd_param_bool(cctx, "show-disk-io", &b) && b) {
disk_input_field = "read_bytes"; disk_input_field = "read_bytes";
disk_output_field = "write_bytes"; disk_output_field = "write_bytes";
break;
case 's':
path = optarg;
break;
default:
help_ver2(&doveadm_cmd_oldstats_top_ver2);
}
} }
argv += optind - 1; if (!doveadm_cmd_param_str(cctx, "sort-field", &sort_type))
if (argv[1] == NULL)
sort_type = "disk"; sort_type = "disk";
else if (argv[2] != NULL)
help_ver2(&doveadm_cmd_oldstats_top_ver2);
else
sort_type = argv[1];
doveadm_print_init(DOVEADM_PRINT_TYPE_TABLE); doveadm_print_init(DOVEADM_PRINT_TYPE_TABLE);
stats_top(path, sort_type); stats_top(path, sort_type);
} }
static void cmd_stats_reset(int argc, char *argv[]) static void cmd_stats_reset(struct doveadm_cmd_context *cctx)
{ {
const char *path; const char *path;
int c;
path = t_strconcat(doveadm_settings->base_dir, "/old-stats", NULL); if (!doveadm_cmd_param_str(cctx, "socket-path", &path)) {
while((c = getopt(argc, argv, "s:")) > 0) { path = t_strconcat(doveadm_settings->base_dir,
switch (c) { "/old-stats", NULL);
case 's':
path = optarg;
break;
default:
help_ver2(&doveadm_cmd_oldstats_reset_ver2);
}
}
argv += optind - 1;
/* items is now argv */
/* if (optind >= argc) {
i_fatal("missing item(s) to reset");
} }
*/
stats_reset(path, (const char**)argv); stats_reset(path);
} }
struct doveadm_cmd_ver2 doveadm_cmd_oldstats_dump_ver2 = { struct doveadm_cmd_ver2 doveadm_cmd_oldstats_dump_ver2 = {
.cmd = doveadm_cmd_stats_dump, .cmd = doveadm_cmd_stats_dump,
.name = "oldstats dump", .name = "oldstats dump",
.usage = "[-s <stats socket path>] <type> [<filter>]", .usage = "[-s <stats socket path>] <type> [<filter>]",
DOVEADM_CMD_PARAMS_START DOVEADM_CMD_PARAMS_START
DOVEADM_CMD_PARAM('s', "socket-path", CMD_PARAM_STR, 0) DOVEADM_CMD_PARAM('s', "socket-path", CMD_PARAM_STR, 0)
DOVEADM_CMD_PARAM('\0', "type", CMD_PARAM_STR, CMD_PARAM_FLAG_POSITIONAL) DOVEADM_CMD_PARAM('\0', "type", CMD_PARAM_STR, CMD_PARAM_FLAG_POSITIONAL)
DOVEADM_CMD_PARAM('\0', "filter", CMD_PARAM_STR, CMD_PARAM_FLAG_POSITIONAL) DOVEADM_CMD_PARAM('\0', "filter", CMD_PARAM_STR, CMD_PARAM_FLAG_POSITIONAL)
DOVEADM_CMD_PARAMS_END DOVEADM_CMD_PARAMS_END
}; };
struct doveadm_cmd_ver2 doveadm_cmd_oldstats_top_ver2 = { struct doveadm_cmd_ver2 doveadm_cmd_oldstats_top_ver2 = {
.old_cmd = cmd_stats_top, .cmd = cmd_stats_top,
.name = "oldstats top", .name = "oldstats top",
.usage = "[-s <stats socket path>] [-b] [<sort field>]", .usage = "[-s <stats socket path>] [-b] [<sort field>]",
DOVEADM_CMD_PARAMS_START DOVEADM_CMD_PARAMS_START
DOVEADM_CMD_PARAM('s', "socket-path", CMD_PARAM_STR, 0) DOVEADM_CMD_PARAM('s', "socket-path", CMD_PARAM_STR, 0)
DOVEADM_CMD_PARAM('b', "show-disk-io", CMD_PARAM_BOOL, 0) DOVEADM_CMD_PARAM('b', "show-disk-io", CMD_PARAM_BOOL, 0)
DOVEADM_CMD_PARAM('\0', "field", CMD_PARAM_STR, CMD_PARAM_FLAG_POSITIONAL) DOVEADM_CMD_PARAM('\0', "sort-field", CMD_PARAM_STR, CMD_PARAM_FLAG_POSITIONAL)
DOVEADM_CMD_PARAMS_END DOVEADM_CMD_PARAMS_END
}; };
struct doveadm_cmd_ver2 doveadm_cmd_oldstats_reset_ver2 = { struct doveadm_cmd_ver2 doveadm_cmd_oldstats_reset_ver2 = {
.old_cmd = cmd_stats_reset, .cmd = cmd_stats_reset,
.name = "oldstats reset", .name = "oldstats reset",
.usage = "[-s <stats socket path>]", .usage = "[-s <stats socket path>]",
DOVEADM_CMD_PARAMS_START DOVEADM_CMD_PARAMS_START
DOVEADM_CMD_PARAM('s', "socket-path", CMD_PARAM_STR, 0) DOVEADM_CMD_PARAM('s', "socket-path", CMD_PARAM_STR, 0)
DOVEADM_CMD_PARAMS_END DOVEADM_CMD_PARAMS_END
}; };
 End of changes. 13 change blocks. 
44 lines changed or deleted 20 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)