Postfix3.3.1
master_service.c
[詳解]
1 /*++
2 /* NAME
3 /* master_service 3
4 /* SUMMARY
5 /* Postfix master - start/stop services
6 /* SYNOPSIS
7 /* #include "master.h"
8 /*
9 /* void master_start_service(serv)
10 /* MASTER_SERV *serv;
11 /*
12 /* void master_stop_service(serv)
13 /* MASTER_SERV *serv;
14 /*
15 /* void master_restart_service(serv, conf_reload)
16 /* MASTER_SERV *serv;
17 /* int conf_reload;
18 /* DESCRIPTION
19 /* master_start_service() enables the named service.
20 /*
21 /* master_stop_service() disables named service.
22 /*
23 /* master_restart_service() requests all running child processes to
24 /* commit suicide. The conf_reload argument is either DO_CONF_RELOAD
25 /* (configuration files were reloaded, re-evaluate the child process
26 /* creation policy) or NO_CONF_RELOAD.
27 /* DIAGNOSTICS
28 /* BUGS
29 /* SEE ALSO
30 /* master_avail(3), process creation policy
31 /* master_wakeup(3), service automatic wakeup
32 /* master_status(3), child status reports
33 /* master_listen(3), unix/inet listeners
34 /* LICENSE
35 /* .ad
36 /* .fi
37 /* The Secure Mailer license must be distributed with this software.
38 /* AUTHOR(S)
39 /* Wietse Venema
40 /* IBM T.J. Watson Research
41 /* P.O. Box 704
42 /* Yorktown Heights, NY 10598, USA
43 /*--*/
44 
45 /* System libraries. */
46 
47 #include <sys_defs.h>
48 #include <string.h>
49 #include <unistd.h>
50 
51 /* Utility library. */
52 
53 #include <msg.h>
54 #include <mymalloc.h>
55 
56 /* Application-specific. */
57 
58 #include "master.h"
59 
61 
62 /* master_start_service - activate service */
63 
65 {
66 
67  /*
68  * Enable connection requests, wakeup timers, and status updates from
69  * child processes.
70  */
71  master_listen_init(serv);
72  master_avail_listen(serv);
73  master_status_init(serv);
74  master_wakeup_init(serv);
75 }
76 
77 /* master_stop_service - deactivate service */
78 
80 {
81 
82  /*
83  * Undo the things that master_start_service() did.
84  */
89 }
90 
91 /* master_restart_service - restart service after configuration reload */
92 
93 void master_restart_service(MASTER_SERV *serv, int conf_reload)
94 {
95 
96  /*
97  * Undo some of the things that master_start_service() did.
98  */
100  master_status_cleanup(serv);
101 
102  /*
103  * Now undo the undone.
104  */
105  master_status_init(serv);
106  master_wakeup_init(serv);
107 
108  /*
109  * Respond to configuration change.
110  */
111  if (conf_reload)
112  master_avail_listen(serv);
113 }
void master_listen_init(MASTER_SERV *)
Definition: master_listen.c:72
void master_status_cleanup(MASTER_SERV *)
void master_status_init(MASTER_SERV *)
void master_listen_cleanup(MASTER_SERV *)
void master_restart_service(MASTER_SERV *serv, int conf_reload)
void master_stop_service(MASTER_SERV *serv)
void master_wakeup_cleanup(MASTER_SERV *)
void master_start_service(MASTER_SERV *serv)
void master_avail_cleanup(MASTER_SERV *)
Definition: master_avail.c:183
void master_wakeup_init(MASTER_SERV *)
MASTER_SERV * master_head
void master_avail_listen(MASTER_SERV *)
Definition: master_avail.c:124