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