aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org>2019-07-22 14:53:37 +0300
committerSergey Poznyakoff <gray@gnu.org>2019-07-22 14:53:37 +0300
commitb369ed6ad26c07d3aec65a1bf0910c0d828c400f (patch)
tree525b13a5bbda244cbec3fe10c25c47aa2975e2a5
parent0917d1276103d9cc893e8ac091e9e63c5e6182f8 (diff)
downloadwydawca-b369ed6ad26c07d3aec65a1bf0910c0d828c400f.tar.gz
wydawca-b369ed6ad26c07d3aec65a1bf0910c0d828c400f.tar.bz2
Finish mod_logstat implementation. Document it.
* doc/wydawca.texi: Document mod_logstat. * include/wydawca/wydawca.h (wy_ev_statistics): Rename to wy_ev_finish. All uses changed. (wydawca_stat): New enum (from src/wydawca.h) (WY_STAT_MASK,WY_STAT_MASK_NONE) (WY_STAT_MASK_ALL): New macros. All uses changed. * modules/logstat/mod_logstat.c (stat_mask): Default to WY_STAT_MASK_ALL. (wy_notify): Provide default output.
-rw-r--r--doc/wydawca.texi93
-rw-r--r--include/wydawca/wydawca.h23
-rw-r--r--modules/logstat/mod_logstat.c50
-rw-r--r--modules/mailutils/mod_mailutils.c2
-rw-r--r--src/config.c34
-rw-r--r--src/directive.c6
-rw-r--r--src/diskio.c14
-rw-r--r--src/event.c4
-rw-r--r--src/gpg.c16
-rw-r--r--src/null.c8
-rw-r--r--src/triplet.c6
-rw-r--r--src/wydawca.c24
-rw-r--r--src/wydawca.h29
-rw-r--r--tests/etc/mailstats.rcin2
14 files changed, 216 insertions, 95 deletions
diff --git a/doc/wydawca.texi b/doc/wydawca.texi
index db06139..1f76e71 100644
--- a/doc/wydawca.texi
+++ b/doc/wydawca.texi
@@ -2409,7 +2409,14 @@ uploader.
@kwindex check-failure
@item check-failure
Distribution verification failed. @xref{verification}, for a
-detailed description.
+detailed description.
+
+@kwindex finish
+@item finish
+ This event is reported at the end of the wydawca job, when all
+spools have been processed. It is normally used to produce final
+statistic reports. @xref{statreports}, for an example.
+See also @ref{mod_logstat}.
@end table
@end deffn
@@ -2650,6 +2657,16 @@ mail-statistics @{
gpg-sign @var{key};
@}
@end smallexample
+
+To arrange for sending the reports, the configuration must contain the
+following statement:
+
+@smallexample
+notify-event @{
+ event finish;
+ module mailutils;
+@}
+@end smallexample
@end deffn
@deffn {mail-statistics} message text-or-id
@@ -2690,6 +2707,7 @@ The statistics message is sent to addresses configured by
@cindex meta-variables in admin notifications
The meta-variables available for use in statistics reports are:
+@anchor{statistics variables}
@multitable @columnfractions 0.30 0.70
@headitem Variable @tab Replaced with
@kwindex date
@@ -3044,6 +3062,11 @@ module-init mailutils @{
@}
notify-event @{
+ event finish;
+ module mailutils;
+@}
+
+notify-event @{
event success;
module mailutils;
module-config @{
@@ -3068,13 +3091,73 @@ notify-event @{
@}
@end example
-For the sake of brevity, this example defines only one
-@code{notify-event} statement. More statements for others events can
+For the sake of brevity, this example defines only two
+@code{notify-event} statements. More statements for others events can
be added as needed.
@node mod_logstat
-@subsection Notification to syslog
-@UNREVISED
+@subsection @command{mod_logstat} -- statistics logging
+
+The module @command{mod_logstat} logs the supplied message text at the
+end of the run.
+
+The simplest configuration for this module is:
+
+@smallexample
+@group
+module logstat mod_logstat.so;
+
+notify-event @{
+ event finish;
+ module logstat;
+@}
+@end group
+@end smallexample
+
+This will produce on the default logging channel the detailed
+statistics, as discussed in @ref{statistics}.
+
+There is no specific @code{module-init} statements. The module should
+be called from @code{notify-event} block on the @samp{finish} event.
+The module's @code{module-config} statement can contain the following
+statements:
+
+@deffn {mod_logstat config} statistics list
+Configures what statistics items should be included in the output.
+@xref{statistics}, for a detailed discussion of @var{list}.
+
+This statement is ignored if the @code{message} statement is present.
+@end deffn
+
+@deffn {mod_logstat config} message text
+Specifies the message to be logged. The @var{text} argument can
+contain references to statistics variables (@pxref{statistics
+variables}).
+@end deffn
+
+If no @code{message} statement is present, the following default is
+assumed:
+
+@example
+@group
+message <<EOT
+errors: $@{stat:errors@}
+warnings: $@{stat:warnings@}
+bad signatures: $@{stat:bad_signatures@}
+access violation attempts: $@{stat:access_violations@}
+complete triplets: $@{stat:complete_triplets@}
+incomplete triplets: $@{stat:incomplete_triplets@}
+bad triplets: $@{stat:bad_triplets@}
+expired triplets: $@{stat:expired_triplets@}
+triplet successes: $@{stat:triplet_success@}
+files uploaded: $@{stat:uploads@}
+files archived: $@{stat:archives@}
+symlinks created: $@{stat:symlinks@}
+symlinks removed: $@{stat:rmsymlinks@}
+check failures: $@{stat:check-failures@}
+EOT;
+@end group
+@end example
@node wydawca.rc
@chapter @command{Wydawca} configuration file.
diff --git a/include/wydawca/wydawca.h b/include/wydawca/wydawca.h
index bc5a5a5..5af2996 100644
--- a/include/wydawca/wydawca.h
+++ b/include/wydawca/wydawca.h
@@ -54,12 +54,33 @@ enum wy_event {
wy_ev_bad_directive_signature,
wy_ev_bad_detached_signature,
wy_ev_check_fail,
- wy_ev_statistics,
+ wy_ev_finish,
WY_N_EVENT
};
const char *wy_event_str(enum wy_event evt);
+
+enum wydawca_stat {
+ WY_STAT_ERRORS,
+ WY_STAT_WARNINGS,
+ WY_STAT_BAD_SIGNATURE,
+ WY_STAT_ACCESS_VIOLATIONS,
+ WY_STAT_COMPLETE_TRIPLETS,
+ WY_STAT_INCOMPLETE_TRIPLETS,
+ WY_STAT_BAD_TRIPLETS,
+ WY_STAT_EXPIRED_TRIPLETS,
+ WY_STAT_TRIPLET_SUCCESS,
+ WY_STAT_UPLOADS,
+ WY_STAT_ARCHIVES,
+ WY_STAT_SYMLINKS,
+ WY_STAT_RMSYMLINKS,
+ WY_STAT_CHECK_FAIL,
+ WY_MAX_STAT
+};
+#define WY_STAT_MASK(c) (1<<(c))
+#define WY_STAT_MASK_NONE 0
+#define WY_STAT_MASK_ALL (WY_STAT_MASK(WY_MAX_STAT) - 1)
struct wy_user {
struct wy_user *next;
diff --git a/modules/logstat/mod_logstat.c b/modules/logstat/mod_logstat.c
index bf73588..60b9da8 100644
--- a/modules/logstat/mod_logstat.c
+++ b/modules/logstat/mod_logstat.c
@@ -16,6 +16,7 @@
#include <config.h>
#include <stdlib.h>
+#include <string.h>
#include <syslog.h>
#include <grecs.h>
#include <wydawca/wydawca.h>
@@ -23,7 +24,7 @@
#define WY_MODULE mod_logstat
-static int stat_mask;
+static int stat_mask = WY_STAT_MASK_ALL;
static struct grecs_list *log_msg;
static struct grecs_keyword logstat_kw[] = {
@@ -47,21 +48,62 @@ wy_config(grecs_node_t *node)
return &stat_mask;
}
+static void
+logmsg(char *s)
+{
+ char *p;
+
+ while ((p = strchr(s, '\n'))) {
+ *p++ = 0;
+ wy_log(LOG_INFO, "%s", s);
+ s = p;
+ }
+ if (*s)
+ wy_log(LOG_INFO, "%s", s);
+}
+
+static char *default_log_message[] = {
+ "errors: ${stat:errors}",
+ "warnings: ${stat:warnings}",
+ "bad signatures: ${stat:bad_signatures}",
+ "access violation attempts: ${stat:access_violations}",
+ "complete triplets: ${stat:complete_triplets}",
+ "incomplete triplets: ${stat:incomplete_triplets}",
+ "bad triplets: ${stat:bad_triplets}",
+ "expired triplets: ${stat:expired_triplets}",
+ "triplet successes: ${stat:triplet_success}",
+ "files uploaded: ${stat:uploads}",
+ "files archived: ${stat:archives}",
+ "symlinks created: ${stat:symlinks}",
+ "symlinks removed: ${stat:rmsymlinks}",
+ "check failures: ${stat:check-failures}",
+ NULL
+};
+
void
wy_notify(void *data, int ev, wy_triplet_t trp)
{
struct grecs_list_entry *ep;
char *text;
-
- if (ev != wy_ev_statistics)
+
+ if (ev != wy_ev_finish || !wy_stat_mask_p(stat_mask))
return;
if (log_msg) {
for (ep = log_msg->head; ep; ep = ep->next) {
text = wy_expand_stats(ep->data);
- wy_log(LOG_INFO, "%s", text);
+ logmsg(text);
free(text);
}
+ } else {
+ int i;
+ for (i = 0; default_log_message[i]; i++) {
+ if (wy_stat_mask_p(WY_STAT_MASK(i))) {
+ text = wy_expand_stats(default_log_message[i]);
+ logmsg(text);
+ free(text);
+ }
+ }
}
}
diff --git a/modules/mailutils/mod_mailutils.c b/modules/mailutils/mod_mailutils.c
index 052caf1..bbd34f0 100644
--- a/modules/mailutils/mod_mailutils.c
+++ b/modules/mailutils/mod_mailutils.c
@@ -813,7 +813,7 @@ wy_notify(void *data, int ev, wy_triplet_t trp)
if (trp)
t_notify(evt, ev, trp);
- else if (ev == wy_ev_statistics)
+ else if (ev == wy_ev_finish)
mail_stats(evt);
}
diff --git a/src/config.c b/src/config.c
index f6305c5..0d7da22 100644
--- a/src/config.c
+++ b/src/config.c
@@ -217,7 +217,7 @@ static struct keyword event_tab[] = {
{ "bad-directive-signature", wy_ev_bad_directive_signature },
{ "bad-detached-signature", wy_ev_bad_detached_signature },
{ "check-failure", wy_ev_check_fail },
- { "statistics", wy_ev_statistics },
+ { "finish", wy_ev_finish },
{NULL}
};
@@ -351,19 +351,19 @@ cb_set_umask(enum grecs_callback_command cmd,
}
static struct keyword stat_tab[] = {
- { "errors", STAT_ERRORS },
- { "warnings", STAT_WARNINGS },
- { "bad-signatures", STAT_BAD_SIGNATURE },
- { "access-violations", STAT_ACCESS_VIOLATIONS },
- { "complete-triplets", STAT_COMPLETE_TRIPLETS },
- { "incomplete-triplets", STAT_INCOMPLETE_TRIPLETS },
- { "bad-triplets", STAT_BAD_TRIPLETS },
- { "expired-triplets", STAT_EXPIRED_TRIPLETS },
- { "triplet-success", STAT_TRIPLET_SUCCESS },
- { "uploads", STAT_UPLOADS },
- { "archives", STAT_ARCHIVES },
- { "symlinks", STAT_SYMLINKS },
- { "rmsymlinks", STAT_RMSYMLINKS },
+ { "errors", WY_STAT_ERRORS },
+ { "warnings", WY_STAT_WARNINGS },
+ { "bad-signatures", WY_STAT_BAD_SIGNATURE },
+ { "access-violations", WY_STAT_ACCESS_VIOLATIONS },
+ { "complete-triplets", WY_STAT_COMPLETE_TRIPLETS },
+ { "incomplete-triplets", WY_STAT_INCOMPLETE_TRIPLETS },
+ { "bad-triplets", WY_STAT_BAD_TRIPLETS },
+ { "expired-triplets", WY_STAT_EXPIRED_TRIPLETS },
+ { "triplet-success", WY_STAT_TRIPLET_SUCCESS },
+ { "uploads", WY_STAT_UPLOADS },
+ { "archives", WY_STAT_ARCHIVES },
+ { "symlinks", WY_STAT_SYMLINKS },
+ { "rmsymlinks", WY_STAT_RMSYMLINKS },
{ NULL },
};
@@ -383,11 +383,11 @@ parse_single_statmask(grecs_locus_t *locus, const grecs_value_t *val,
arg = val->v.string;
if (strcmp(arg, "all") == 0) {
- *pmask = STAT_MASK_ALL;
+ *pmask = WY_STAT_MASK_ALL;
*invert = 1;
return 0;
} else if (strcmp(arg, "none") == 0) {
- *pmask = STAT_MASK_NONE;
+ *pmask = WY_STAT_MASK_NONE;
*invert = 0;
return 0;
}
@@ -397,7 +397,7 @@ parse_single_statmask(grecs_locus_t *locus, const grecs_value_t *val,
arg);
return 1;
}
- *pmask = STAT_MASK(x);
+ *pmask = WY_STAT_MASK(x);
return 0;
}
diff --git a/src/directive.c b/src/directive.c
index 5dd1724..8ce1ca2 100644
--- a/src/directive.c
+++ b/src/directive.c
@@ -559,7 +559,7 @@ external_check(struct wy_triplet *trp)
free(file);
if (rc) {
- UPDATE_STATS(STAT_CHECK_FAIL);
+ UPDATE_STATS(WY_STAT_CHECK_FAIL);
notify(spool->notification, trp, wy_ev_check_fail);
}
@@ -599,7 +599,7 @@ process_directives(struct wy_triplet *trp)
const struct spool *spool;
ASGN_SPOOL(spool, trp, return 1);
- UPDATE_STATS(STAT_COMPLETE_TRIPLETS);
+ UPDATE_STATS(WY_STAT_COMPLETE_TRIPLETS);
timer_start("triplet");
report_init();
for (n = directive_first(trp, &key, &val); n;
@@ -671,7 +671,7 @@ process_directives(struct wy_triplet *trp)
trp->file[file_directive].name, strerror(errno));
}
- UPDATE_STATS(STAT_TRIPLET_SUCCESS);
+ UPDATE_STATS(WY_STAT_TRIPLET_SUCCESS);
report_finish();
timer_stop("triplet");
notify(spool->notification, trp, wy_ev_success);
diff --git a/src/diskio.c b/src/diskio.c
index 7916b3f..a86997e 100644
--- a/src/diskio.c
+++ b/src/diskio.c
@@ -237,7 +237,7 @@ tar_append_file(const char *archive, const char *file)
wy_debug(1, (_("tarring %s to %s"), file, archive));
if (wy_dry_run) {
- UPDATE_STATS(STAT_ARCHIVES);
+ UPDATE_STATS(WY_STAT_ARCHIVES);
return 0;
}
@@ -250,7 +250,7 @@ tar_append_file(const char *archive, const char *file)
switch (wydawca_exec(6, argv, NULL)) {
case exec_success:
- UPDATE_STATS(STAT_ARCHIVES);
+ UPDATE_STATS(WY_STAT_ARCHIVES);
return 0;
case exec_fail:
@@ -351,13 +351,13 @@ do_archive_file(const char *dst_file, const char *dst_dir, const char *file,
case archive_directory:
if (backup_file(dst_file, dst_dir, file, archive, reldir))
return 1;
- UPDATE_STATS(STAT_ARCHIVES);
+ UPDATE_STATS(WY_STAT_ARCHIVES);
break;
case archive_tar:
if (tar_append_file(archive->name, dst_file))
return 1;
- UPDATE_STATS(STAT_ARCHIVES);
+ UPDATE_STATS(WY_STAT_ARCHIVES);
break;
}
@@ -431,7 +431,7 @@ dir_move_file(struct wy_triplet *trp, enum file_type file_id)
free(dst_file);
free(dst_dir);
if (rc == 0)
- UPDATE_STATS(STAT_UPLOADS);
+ UPDATE_STATS(WY_STAT_UPLOADS);
return rc;
}
@@ -616,7 +616,7 @@ dir_symlink_file(struct wy_triplet *trp,
free(dst);
free(dst_dir);
if (rc == 0)
- UPDATE_STATS(STAT_SYMLINKS);
+ UPDATE_STATS(WY_STAT_SYMLINKS);
return rc;
}
@@ -648,7 +648,7 @@ do_rmsymlink_file(const char *dst_file, int noentok)
strerror(errno));
return 1;
}
- UPDATE_STATS(STAT_RMSYMLINKS);
+ UPDATE_STATS(WY_STAT_RMSYMLINKS);
return 0;
}
diff --git a/src/event.c b/src/event.c
index 11e902a..d359814 100644
--- a/src/event.c
+++ b/src/event.c
@@ -28,9 +28,9 @@ notify(struct notification *n, struct wy_triplet *t,
}
void
-notify_stats()
+notify_finish()
{
- notify(default_notification, NULL, wy_ev_statistics);
+ notify(default_notification, NULL, wy_ev_finish);
}
void
diff --git a/src/gpg.c b/src/gpg.c
index f439803..927faa3 100644
--- a/src/gpg.c
+++ b/src/gpg.c
@@ -152,27 +152,27 @@ checksig(gpgme_signature_t sig, const char *uid, struct wy_triplet *trp)
break;
case GPG_ERR_BAD_SIGNATURE:
- UPDATE_STATS(STAT_BAD_SIGNATURE);
+ UPDATE_STATS(WY_STAT_BAD_SIGNATURE);
wy_log(LOG_ERR, _("BAD signature from %s"), uid);
return 0;
case GPG_ERR_NO_PUBKEY:
- UPDATE_STATS(STAT_ACCESS_VIOLATIONS);
+ UPDATE_STATS(WY_STAT_ACCESS_VIOLATIONS);
wy_log(LOG_ERR, _("No public key"));
return 0;
case GPG_ERR_NO_DATA:
- UPDATE_STATS(STAT_BAD_TRIPLETS);
+ UPDATE_STATS(WY_STAT_BAD_TRIPLETS);
wy_log(LOG_ERR, _("No signature"));
return 0;
case GPG_ERR_SIG_EXPIRED:
- UPDATE_STATS(STAT_BAD_SIGNATURE);
+ UPDATE_STATS(WY_STAT_BAD_SIGNATURE);
wy_log(LOG_ERR, _("Expired signature from %s"), uid);
return 0;
case GPG_ERR_KEY_EXPIRED:
- UPDATE_STATS(STAT_BAD_SIGNATURE);
+ UPDATE_STATS(WY_STAT_BAD_SIGNATURE);
wy_log(LOG_ERR, _("Key expired (%s)"), uid);
return 0;
@@ -245,7 +245,7 @@ verify_directive_signature(struct wy_triplet *trp)
result = gpgme_op_verify_result(ctx);
if (!gpg_verify_signature(ctx, result->signatures, trp)) {
- UPDATE_STATS(STAT_BAD_SIGNATURE);
+ UPDATE_STATS(WY_STAT_BAD_SIGNATURE);
notify(trp->spool->notification, trp,
wy_ev_bad_directive_signature);
rc = 1;
@@ -253,7 +253,7 @@ verify_directive_signature(struct wy_triplet *trp)
rc = 0;
} else {
rc = 1;
- UPDATE_STATS(STAT_BAD_SIGNATURE);
+ UPDATE_STATS(WY_STAT_BAD_SIGNATURE);
wy_log(LOG_ERR, _("%s: directive verification failed: %s"),
trp->name, gpgme_strerror(ec));
}
@@ -301,7 +301,7 @@ verify_detached_signature(struct wy_triplet *trp)
return 0;
case exec_fail:
- UPDATE_STATS(STAT_BAD_SIGNATURE);
+ UPDATE_STATS(WY_STAT_BAD_SIGNATURE);
wy_log(LOG_ERR, _("BAD detached signature for %s"), trp->name);
notify(spool->notification, trp, wy_ev_bad_detached_signature);
break;
diff --git a/src/null.c b/src/null.c
index 3595836..b91cfe2 100644
--- a/src/null.c
+++ b/src/null.c
@@ -24,7 +24,7 @@ null_move_file(struct wy_triplet *trp, enum file_type file_id)
const char *file_name = trp->file[file_id].name;
wy_debug(1, (_("spool %s: installing file `%s/%s'"),
spool->tag, trp->relative_dir, file_name));
- UPDATE_STATS(STAT_UPLOADS);
+ UPDATE_STATS(WY_STAT_UPLOADS);
if (!wy_dry_run && unlink(file_name)) {
wy_log(LOG_ERR, _("cannot unlink %s: %s"),
file_name, strerror(errno));
@@ -38,7 +38,7 @@ null_archive_file(struct wy_triplet *trp, const char *file_name)
{
wy_debug(1, (_("spool %s: archiving `%s'"),
trp->spool->tag, file_name));
- UPDATE_STATS(STAT_ARCHIVES);
+ UPDATE_STATS(WY_STAT_ARCHIVES);
return 0;
}
@@ -48,7 +48,7 @@ null_symlink_file(struct wy_triplet *trp,
{
wy_debug(1, (_("spool %s: symlinking `%s' to `%s'"),
trp->spool->tag, wanted_src, wanted_dst));
- UPDATE_STATS(STAT_SYMLINKS);
+ UPDATE_STATS(WY_STAT_SYMLINKS);
return 0;
}
@@ -57,6 +57,6 @@ null_rmsymlink_file(struct wy_triplet *trp, const char *file_name)
{
wy_debug(1, (_("spool %s: removing symlink `%s/%s'"),
trp->spool->tag, trp->relative_dir, file_name));
- UPDATE_STATS(STAT_RMSYMLINKS);
+ UPDATE_STATS(WY_STAT_RMSYMLINKS);
return 0;
}
diff --git a/src/triplet.c b/src/triplet.c
index 067bc01..7c79af0 100644
--- a/src/triplet.c
+++ b/src/triplet.c
@@ -373,17 +373,17 @@ triplet_processor(void *data, void *proc_data)
case triplet_incomplete:
wy_debug(1, (_("%s: incomplete triplet"), trp->name));
/* ignore unless expired (see below); */
- UPDATE_STATS(STAT_INCOMPLETE_TRIPLETS);
+ UPDATE_STATS(WY_STAT_INCOMPLETE_TRIPLETS);
break;
case triplet_bad:
- UPDATE_STATS(STAT_BAD_TRIPLETS);
+ UPDATE_STATS(WY_STAT_BAD_TRIPLETS);
remove_triplet(trp, 0);
return 0;
}
if (triplet_expired_p(trp)) {
- UPDATE_STATS(STAT_EXPIRED_TRIPLETS);
+ UPDATE_STATS(WY_STAT_EXPIRED_TRIPLETS);
remove_triplet(trp, 0);
}
diff --git a/src/wydawca.c b/src/wydawca.c
index 4bd3620..00d779c 100644
--- a/src/wydawca.c
+++ b/src/wydawca.c
@@ -52,7 +52,7 @@ char *wy_gpg_homedir;
char *default_check_script;
struct grecs_sockaddr listen_sockaddr;
-unsigned wydawca_stat[MAX_STAT];
+unsigned wydawca_stat[WY_MAX_STAT];
unsigned min_directive_version = MIN_DIRECTIVE_VERSION;
unsigned max_directive_version = MAX_DIRECTIVE_VERSION;
@@ -117,11 +117,11 @@ wy_log(int prio, char *fmt, ...)
case LOG_ALERT:
case LOG_CRIT:
case LOG_ERR:
- UPDATE_STATS(STAT_ERRORS);
+ UPDATE_STATS(WY_STAT_ERRORS);
break;
case LOG_WARNING:
- UPDATE_STATS(STAT_WARNINGS);
+ UPDATE_STATS(WY_STAT_WARNINGS);
}
va_start(ap, fmt);
@@ -140,7 +140,7 @@ wy_dbg(char *fmt, ...)
}
-static char *stat_name[MAX_STAT] = {
+static char *stat_name[WY_MAX_STAT] = {
N_("errors"),
N_("warnings"),
N_("bad signatures"),
@@ -157,7 +157,7 @@ static char *stat_name[MAX_STAT] = {
N_("check failures"),
};
-static char *stat_kwname[MAX_STAT] = {
+static char *stat_kwname[WY_MAX_STAT] = {
"stat:errors",
"stat:warnings",
"stat:bad_signatures",
@@ -179,8 +179,8 @@ wy_stat_mask_p(unsigned long mask)
{
int i;
- for (i = 0; i < MAX_STAT; i++)
- if (wydawca_stat[i] != 0 && (mask && STAT_MASK(i)))
+ for (i = 0; i < WY_MAX_STAT; i++)
+ if (wydawca_stat[i] != 0 && (mask && WY_STAT_MASK(i)))
return 1;
return 0;
}
@@ -202,9 +202,9 @@ make_stat_expansion(size_t count)
{
int i;
struct wy_metadef *def, *p;
- def = grecs_calloc(MAX_STAT + count + 1, sizeof(def[0]));
+ def = grecs_calloc(WY_MAX_STAT + count + 1, sizeof(def[0]));
p = def + count;
- for (i = 0; i < MAX_STAT; i++, p++) {
+ for (i = 0; i < WY_MAX_STAT; i++, p++) {
p->kw = stat_kwname[i];
p->value = NULL;
p->storage = NULL;
@@ -221,13 +221,13 @@ logstats()
int i;
if (wy_stat_mask_p(print_stats)) {
- for (i = 0; i < MAX_STAT; i++)
- if (print_stats & STAT_MASK(i))
+ for (i = 0; i < WY_MAX_STAT; i++)
+ if (print_stats & WY_STAT_MASK(i))
wy_log(LOG_INFO, "%s: %u",
gettext(stat_name[i]), wydawca_stat[i]);
}
- notify_stats();
+ notify_finish();
}
void
diff --git a/src/wydawca.h b/src/wydawca.h
index 0dd99e1..580d0be 100644
--- a/src/wydawca.h
+++ b/src/wydawca.h
@@ -263,31 +263,6 @@ struct spool {
} \
} while (0)
-enum wydawca_stat {
- STAT_ERRORS,
- STAT_WARNINGS,
- STAT_BAD_SIGNATURE,
- STAT_ACCESS_VIOLATIONS,
- STAT_COMPLETE_TRIPLETS,
- STAT_INCOMPLETE_TRIPLETS,
- STAT_BAD_TRIPLETS,
- STAT_EXPIRED_TRIPLETS,
- STAT_TRIPLET_SUCCESS,
- STAT_UPLOADS,
- STAT_ARCHIVES,
- STAT_SYMLINKS,
- STAT_RMSYMLINKS,
- STAT_CHECK_FAIL,
- MAX_STAT
-};
-
-#define STAT_MASK(c) (1<<(c))
-#define STAT_MASK_NONE 0
-#define STAT_MASK_ALL (STAT_MASK(MAX_STAT) - 1)
-
-int wy_cb_statistics(enum grecs_callback_command cmd, grecs_node_t *node,
- void *varptr, void *cb_data);
-
struct notification {
struct notification *next;
enum wy_event ev;
@@ -351,7 +326,7 @@ extern int syslog_include_prio; /* Syslog priority indication */
extern time_t file_sweep_time; /* Unlink stale file after this amount of time
*/
extern char *tar_command_name; /* Name of the tar command */
-extern unsigned wydawca_stat[MAX_STAT];
+extern unsigned wydawca_stat[WY_MAX_STAT];
extern unsigned long print_stats;
extern int archive_signatures;
@@ -385,7 +360,7 @@ extern int inotify_enable;
extern struct notification *default_notification;
#define UPDATE_STATS(what) do { \
- if (what >= MAX_STAT) abort(); \
+ if (what >= WY_MAX_STAT) abort(); \
wydawca_stat[what]++; \
} while (0)
diff --git a/tests/etc/mailstats.rcin b/tests/etc/mailstats.rcin
index ccae480..0c69811 100644
--- a/tests/etc/mailstats.rcin
+++ b/tests/etc/mailstats.rcin
@@ -51,6 +51,6 @@ EOT;
}
notify-event {
- event statistics;
+ event finish;
module mailutils;
}

Return to:

Send suggestions and report system problems to the System administrator.