diff options
author | Sergey Poznyakoff <gray@gnu.org.ua> | 2006-09-05 13:17:51 +0000 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org.ua> | 2006-09-05 13:17:51 +0000 |
commit | fb7ff609c6ca3014e1c3ff63fde86d7b1e930e41 (patch) | |
tree | c1167739df1cd946df82303f58f62d6a81b551f4 /src/main.c | |
parent | febbd4f014a40864e95e3e6c340d5f11d2548f8e (diff) | |
download | mailfromd-fb7ff609c6ca3014e1c3ff63fde86d7b1e930e41.tar.gz mailfromd-fb7ff609c6ca3014e1c3ff63fde86d7b1e930e41.tar.bz2 |
New options --lock-retry-count and --lock-retry-timeout
git-svn-id: file:///svnroot/mailfromd/trunk@528 7a8a7f39-df28-0410-adc6-e0d955640f24
Diffstat (limited to 'src/main.c')
-rw-r--r-- | src/main.c | 126 |
1 files changed, 80 insertions, 46 deletions
@@ -1360,6 +1360,23 @@ set_source_info(void *value) source_info_option = (int) value; } +void +set_lock_retry_count(void *value) +{ +#ifdef USE_DBM + mu_locker_set_default_retry_count(strtoul(value, NULL, 0)); +#endif +} + +void +set_lock_retry_timeout(void *value) +{ +#ifdef USE_DBM + mu_locker_set_default_retry_timeout(*(time_t*) value); + free(value); +#endif +} + int option_string(char *opt, void **pval, char *newval) { @@ -1538,6 +1555,8 @@ struct option_cache { { "timeout", NULL, option_time, set_timeout }, { "relay", NULL, option_relay, set_relay, 1 }, { "source", NULL, option_source, set_source }, + { "lock-retry-count", NULL, option_number, set_lock_retry_count }, + { "lock-retry-timeout", NULL, option_time, set_lock_retry_timeout }, { NULL } }; @@ -1595,6 +1614,8 @@ enum mailfromd_option { OPTION_FOREGROUND, OPTION_IGNORE_FAILED_READS, OPTION_LIST, + OPTION_LOCK_RETRY_COUNT, + OPTION_LOCK_RETRY_TIMEOUT, OPTION_MILTER_TIMEOUT, OPTION_PIDFILE, OPTION_POSTMASTER_EMAIL, @@ -1644,83 +1665,88 @@ static struct argp_option options[] = { { "predict", OPTION_PREDICT_NEXT, N_("RATE"), 0, N_("Predict when the user will be able to " "send next message (use with --list --format=rates)"), GRP+1 }, + { "lock-retry-count", OPTION_LOCK_RETRY_COUNT, N_("NUMBER"), 0, + N_("Set maximum number of attempts to acquire the lock"), GRP+1 }, + { "lock-retry-timeout", OPTION_LOCK_RETRY_TIMEOUT, N_("TIME"), 0, + N_("Set timeout for acquiring the lockfile"), GRP+1 }, #endif #undef GRP #define GRP 20 { NULL, 0, NULL, 0, - "General options", GRP }, - { "config-file", 'c', "FILE", 0, - "Read configuration from FILE", GRP+1 }, - { "domain", 'D', "STRING", 0, - "Set default SMTP domain", GRP+1 }, + N_("General options"), GRP }, + { "config-file", 'c', N_("FILE"), 0, + N_("Read configuration from FILE"), GRP+1 }, + { "domain", 'D', N_("STRING"), 0, + N_("Set default SMTP domain"), GRP+1 }, { "ehlo", 0, NULL, OPTION_ALIAS, NULL, GRP+1 }, - { "postmaster-email", OPTION_POSTMASTER_EMAIL, "EMAIL", 0, - "Set postmaster email address", GRP+1 }, + { "postmaster-email", OPTION_POSTMASTER_EMAIL, N_("EMAIL"), 0, + N_("Set postmaster email address"), GRP+1 }, { "mailfrom", 0, NULL, OPTION_ALIAS, NULL, GRP+1 }, - { "port", 'p', "STRING", 0, - "Set communication socket", GRP+1 }, + { "port", 'p', N_("STRING"), 0, + N_("Set communication socket"), GRP+1 }, { "remove", 'r', NULL, 0, - "Force removing local socket file, if it already exists", + N_("Force removing local socket file, if it already exists"), GRP+1 }, { "foreground", OPTION_FOREGROUND, NULL, 0, - "Stay in foreground", GRP+1 }, - { "pidfile", OPTION_PIDFILE, "FILE", 0, - "Set pidfile name", GRP+1 }, - { "user", 'u', "NAME", 0, - "Switch to this user privileges after startup", GRP+1 }, - { "group", 'g', "NAME", 0, - "Retain the supplementary group NAME when switching to user privileges", + N_("Stay in foreground"), GRP+1 }, + { "pidfile", OPTION_PIDFILE, N_("FILE"), 0, + N_("Set pidfile name"), GRP+1 }, + { "user", 'u', N_("NAME"), 0, + N_("Switch to this user privileges after startup"), GRP+1 }, + { "group", 'g', N_("NAME"), 0, + N_("Retain the supplementary group NAME when switching to user " + "privileges"), GRP+1 }, - { "source", 'S', "ADDRESS", 0, - "Set source address for TCP connections", GRP+1 }, + { "source", 'S', N_("ADDRESS"), 0, + N_("Set source address for TCP connections"), GRP+1 }, #ifdef USE_DBM - { "expire-interval", 'e', "NUMBER", 0, - "Set cache expiration interval to NUMBER seconds", GRP+1 }, + { "expire-interval", 'e', N_("NUMBER"), 0, + N_("Set cache expiration interval to NUMBER seconds"), GRP+1 }, #endif #undef GRP #undef GRP #define GRP 30 { NULL, 0, NULL, 0, - "Timeout control", GRP }, - { "milter-timeout", OPTION_MILTER_TIMEOUT, "NUMBER", 0, - "Set MTA connection timeout", GRP+1 }, - { "timeout", OPTION_TIMEOUT, "NUMBER", 0, - "Set I/O operation timeout (seconds)", GRP+1 }, - { "retry", OPTION_RETRY, "NUMBER", 0, - "Retry failed I/O operations NUMBER times", GRP+1 }, - { "relayed-domain-file", OPTION_DOMAIN_FILE, "FILE", 0, - "Read relayed domains from FILE", GRP+1 }, + N_("Timeout control"), GRP }, + { "milter-timeout", OPTION_MILTER_TIMEOUT, N_("NUMBER"), 0, + N_("Set MTA connection timeout"), GRP+1 }, + { "timeout", OPTION_TIMEOUT, N_("NUMBER"), 0, + N_("Set I/O operation timeout (seconds)"), GRP+1 }, + { "retry", OPTION_RETRY, N_("NUMBER"), 0, + N_("Retry failed I/O operations NUMBER times"), GRP+1 }, + { "relayed-domain-file", OPTION_DOMAIN_FILE, N_("FILE"), 0, + N_("Read relayed domains from FILE"), GRP+1 }, #undef GRP #define GRP 40 { NULL, 0, NULL, 0, - "Informational and debugging options", GRP }, + N_("Informational and debugging options"), GRP }, { "transcript", 'X', NULL, 0, - "Enable transcript", GRP+1 }, + N_("Enable transcript"), GRP+1 }, { "trace", OPTION_TRACE, NULL, 0, - "Enable tracing configuration", GRP+1 }, + N_("Enable tracing configuration"), GRP+1 }, { "trace-program", OPTION_TRACE_PROGRAM, NULL, 0, - "Enable program tracing", GRP+1 }, - { "debug", 'd', "LEVEL", 0, - "Set debugging level", GRP+1 }, + N_("Enable program tracing"), GRP+1 }, + { "debug", 'd', N_("LEVEL"), 0, + N_("Set debugging level"), GRP+1 }, { "dump-code", OPTION_DUMP_CODE, NULL, 0, - "Dump disassembled code", GRP+1 }, + N_("Dump disassembled code"), GRP+1 }, { "dump-grammar-trace", OPTION_DUMP_GRAMMAR_TRACE, NULL, 0, - "Dump grammar traces when parsing the config", GRP+1 }, + N_("Dump grammar traces when parsing the config"), GRP+1 }, { "dump-lex-trace", OPTION_DUMP_LEX_TRACE, NULL, 0, - "Dump lexical analizer traces when parsing the config", GRP+1 }, + N_("Dump lexical analizer traces when parsing the config"), GRP+1 }, { "dump-tree", OPTION_DUMP_TREE, NULL, 0, - "Dump parser tree", GRP+1 }, + N_("Dump parser tree"), GRP+1 }, { "stderr", 's', NULL, 0, - "Log to stderr", GRP+1 }, + N_("Log to stderr"), GRP+1 }, { "syslog", OPTION_SYSLOG, NULL, 0, - "Log to syslog (default)", GRP+1 }, - { "log-tag", 'L', "STRING", 0, - "Set the identifier used in syslog messages to STRING",GRP+1 }, + N_("Log to syslog (default)"), GRP+1 }, + { "log-tag", 'L', N_("STRING"), 0, + N_("Set the identifier used in syslog messages to STRING"), GRP+1 }, { "source-info", OPTION_SOURCE_INFO, NULL, 0, - "Debug messages include source information", GRP+1 }, + N_("Debug messages include source information"), GRP+1 }, #undef GRP { NULL } }; @@ -1765,6 +1791,14 @@ parse_opt (int key, char *arg, struct argp_state *state) case OPTION_IGNORE_FAILED_READS: ignore_failed_reads_option = 1; break; + + case OPTION_LOCK_RETRY_COUNT: + set_option("lock-retry-count", arg, 1); + break; + + case OPTION_LOCK_RETRY_TIMEOUT: + set_option("lock-retry-timeout", arg, 1); + break; #endif case 'L': @@ -2246,7 +2280,7 @@ db_format_setup() mu_locker_set_default_flags (MU_LOCKER_KERNEL|MU_LOCKER_RETRY, mu_locker_assign); mu_locker_set_default_retry_timeout (1); - mu_locker_set_default_retry_count (1); + mu_locker_set_default_retry_count (3); #endif } |