1 /* $NetBSD: mail_flush.c,v 1.1.1.2 2013/09/25 19:06:30 tron Exp $ */ 2 3 /*++ 4 /* NAME 5 /* mail_flush 3 6 /* SUMMARY 7 /* flush backed up mail 8 /* SYNOPSIS 9 /* #include <mail_flush.h> 10 /* 11 /* int mail_flush_deferred() 12 /* 13 /* int mail_flush_maildrop() 14 /* DESCRIPTION 15 /* This module triggers delivery of backed up mail. 16 /* 17 /* mail_flush_deferred() triggers delivery of all deferred 18 /* or incoming mail. This function tickles the queue manager. 19 /* 20 /* mail_flush_maildrop() triggers delivery of all mail in 21 /* the maildrop directory. This function tickles the pickup 22 /* service. 23 /* DIAGNOSTICS 24 /* The result is 0 in case of success, -1 in case of failure. 25 /* FILES 26 /* $queue_directory/public/pickup, server endpoint 27 /* $queue_directory/public/qmgr, server endpoint 28 /* SEE ALSO 29 /* mail_trigger(3), see note about event_drain() usage 30 /* LICENSE 31 /* .ad 32 /* .fi 33 /* The Secure Mailer license must be distributed with this software. 34 /* AUTHOR(S) 35 /* Wietse Venema 36 /* IBM T.J. Watson Research 37 /* P.O. Box 704 38 /* Yorktown Heights, NY 10598, USA 39 /*--*/ 40 41 /* System library. */ 42 43 #include "sys_defs.h" 44 45 /* Utility library. */ 46 47 /* Global library. */ 48 49 #include <mail_params.h> 50 #include <mail_proto.h> 51 #include <mail_flush.h> 52 53 /* mail_flush_deferred - flush deferred/incoming queue */ 54 55 int mail_flush_deferred(void) 56 { 57 static char qmgr_trigger[] = { 58 QMGR_REQ_FLUSH_DEAD, /* all hosts, all transports */ 59 QMGR_REQ_SCAN_ALL, /* all time stamps */ 60 QMGR_REQ_SCAN_DEFERRED, /* scan deferred queue */ 61 QMGR_REQ_SCAN_INCOMING, /* scan incoming queue */ 62 }; 63 64 /* 65 * Trigger the flush queue service. 66 */ 67 return (mail_trigger(MAIL_CLASS_PUBLIC, var_queue_service, 68 qmgr_trigger, sizeof(qmgr_trigger))); 69 } 70 71 /* mail_flush_maildrop - flush maildrop queue */ 72 73 int mail_flush_maildrop(void) 74 { 75 static char wakeup[] = {TRIGGER_REQ_WAKEUP}; 76 77 /* 78 * Trigger the pickup service. 79 */ 80 return (mail_trigger(MAIL_CLASS_PUBLIC, var_pickup_service, 81 wakeup, sizeof(wakeup))); 82 } 83