Sync usage with man page.
[netbsd-mini2440.git] / external / ibm-public / postfix / dist / src / qmgr / qmgr_enable.c
blob74885785c1a350ecdbfb30a3195dbec408758efd
1 /* $NetBSD$ */
3 /*++
4 /* NAME
5 /* qmgr_enable
6 /* SUMMARY
7 /* enable dead transports or sites
8 /* SYNOPSIS
9 /* #include "qmgr.h"
11 /* void qmgr_enable_queue(queue)
12 /* QMGR_QUEUE *queue;
14 /* QMGR_QUEUE *qmgr_enable_transport(transport)
15 /* QMGR_TRANSPORT *transport;
17 /* void qmgr_enable_all(void)
18 /* DESCRIPTION
19 /* This module purges dead in-core state information, effectively
20 /* re-enabling delivery.
22 /* qmgr_enable_queue() enables deliveries to the named dead site.
23 /* Empty queues are destroyed. The existed solely to indicate that
24 /* a site is dead.
26 /* qmgr_enable_transport() enables deliveries via the specified
27 /* transport, and calls qmgr_enable_queue() for each destination
28 /* on that transport. Empty queues are destroyed.
30 /* qmgr_enable_all() enables all transports and queues.
31 /* See above for the side effects caused by doing this.
32 /* BUGS
33 /* The side effects of calling this module can be quite dramatic.
34 /* DIAGNOSTICS
35 /* Panic: consistency check failure. Fatal: out of memory.
36 /* LICENSE
37 /* .ad
38 /* .fi
39 /* The Secure Mailer license must be distributed with this software.
40 /* AUTHOR(S)
41 /* Wietse Venema
42 /* IBM T.J. Watson Research
43 /* P.O. Box 704
44 /* Yorktown Heights, NY 10598, USA
45 /*--*/
47 /* System library. */
49 #include <sys_defs.h>
51 /* Utility library. */
53 #include <msg.h>
54 #include <vstream.h>
56 /* Application-specific. */
58 #include "qmgr.h"
60 /* qmgr_enable_all - enable transports and queues */
62 void qmgr_enable_all(void)
64 QMGR_TRANSPORT *xport;
66 if (msg_verbose)
67 msg_info("qmgr_enable_all");
70 * The number of transports does not change as a side effect, so this can
71 * be a straightforward loop.
73 for (xport = qmgr_transport_list.next; xport; xport = xport->peers.next)
74 qmgr_enable_transport(xport);
77 /* qmgr_enable_transport - defer todo entries for named transport */
79 void qmgr_enable_transport(QMGR_TRANSPORT *transport)
81 QMGR_QUEUE *queue;
82 QMGR_QUEUE *next;
85 * Proceed carefully. Queues may disappear as a side effect.
87 if (transport->flags & QMGR_TRANSPORT_STAT_DEAD) {
88 if (msg_verbose)
89 msg_info("enable transport %s", transport->name);
90 qmgr_transport_unthrottle(transport);
92 for (queue = transport->queue_list.next; queue; queue = next) {
93 next = queue->peers.next;
94 qmgr_enable_queue(queue);
98 /* qmgr_enable_queue - enable and possibly delete queue */
100 void qmgr_enable_queue(QMGR_QUEUE *queue)
102 if (QMGR_QUEUE_THROTTLED(queue)) {
103 if (msg_verbose)
104 msg_info("enable site %s/%s", queue->transport->name, queue->name);
105 qmgr_queue_unthrottle(queue);
107 if (QMGR_QUEUE_READY(queue) && queue->todo.next == 0 && queue->busy.next == 0)
108 qmgr_queue_done(queue);