7 /* Postfix master - master.cf file processing
11 /* void master_config(serv)
14 /* void master_refresh(serv)
17 /* Use master_config() to read the master.cf configuration file
18 /* during program initialization.
20 /* Use master_refresh() to re-read the master.cf configuration file
21 /* when the process is already running.
25 /* master_ent(3), configuration file programmatic interface.
29 /* The Secure Mailer license must be distributed with this software.
32 /* IBM T.J. Watson Research
34 /* Yorktown Heights, NY 10598, USA
37 /* System libraries. */
43 /* Utility library. */
48 /* Application-specific. */
52 /* master_refresh - re-read configuration table */
54 void master_refresh(void)
60 * Mark all existing services.
62 for (serv
= master_head
; serv
!= 0; serv
= serv
->next
)
63 serv
->flags
|= MASTER_FLAG_MARK
;
66 * Read the master.cf configuration file. The master_conf() routine
67 * unmarks services upon update. New services are born with the mark bit
68 * off. After this, anything with the mark bit on should be removed.
73 * Delete all services that are still marked - they disappeared from the
74 * configuration file and are therefore no longer needed.
76 for (servp
= &master_head
; (serv
= *servp
) != 0; /* void */ ) {
77 if ((serv
->flags
& MASTER_FLAG_MARK
) != 0) {
79 master_stop_service(serv
);
80 free_master_ent(serv
);
87 /* master_config - read config file */
89 void master_config(void)
94 #define STR_DIFF strcmp
95 #define STR_SAME !strcmp
96 #define SWAP(type,a,b) { type temp = a; a = b; b = temp; }
99 * A service is identified by its endpoint name AND by its transport
100 * type, not just by its name alone. The name is unique within its
101 * transport type. XXX Service privacy is encoded in the service name.
104 while ((entry
= get_master_ent()) != 0) {
106 print_master_ent(entry
);
107 for (serv
= master_head
; serv
!= 0; serv
= serv
->next
)
108 if (STR_SAME(serv
->name
, entry
->name
) && serv
->type
== entry
->type
)
112 * Add a new service entry. We do not really care in what order the
113 * service entries are kept in memory.
116 entry
->next
= master_head
;
118 master_start_service(entry
);
122 * Update an existing service entry. Make the current generation of
123 * child processes commit suicide whenever it is convenient. The next
124 * generation of child processes will run with the new configuration
128 serv
->flags
&= ~MASTER_FLAG_MARK
;
129 if (entry
->flags
& MASTER_FLAG_CONDWAKE
)
130 serv
->flags
|= MASTER_FLAG_CONDWAKE
;
132 serv
->flags
&= ~MASTER_FLAG_CONDWAKE
;
133 serv
->wakeup_time
= entry
->wakeup_time
;
134 serv
->max_proc
= entry
->max_proc
;
135 serv
->throttle_delay
= entry
->throttle_delay
;
136 SWAP(char *, serv
->ext_name
, entry
->ext_name
);
137 SWAP(char *, serv
->path
, entry
->path
);
138 SWAP(ARGV
*, serv
->args
, entry
->args
);
139 SWAP(char *, serv
->stress_param_val
, entry
->stress_param_val
);
140 master_restart_service(serv
);
141 free_master_ent(entry
);