MCPcopy Create free account
hub / github.com/acl-dev/acl / acl_master_status_init

Function acl_master_status_init

app/master/daemon/master/master_status.cpp:185–231  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

183/* acl_master_status_init - start status event processing for this service */
184
185void acl_master_status_init(ACL_MASTER_SERV *serv)
186{
187 const char *myname = "acl_master_status_init";
188
189 if (acl_msg_verbose) {
190 acl_msg_info("%s: %s", myname, serv->name);
191 }
192
193 if (serv->type == ACL_MASTER_SERV_TYPE_NONE) {
194 return;
195 }
196
197 /*
198 * Sanity checks.
199 */
200 if (serv->status_fd[0] >= 0 || serv->status_fd[1] >= 0) {
201 acl_msg_panic("%s: status events already enabled", myname);
202 }
203
204 /*
205 * Make the read end of this service's status pipe non-blocking so that
206 * we can detect partial writes on the child side. We use a duplex pipe
207 * so that the child side becomes readable when the master goes away.
208 */
209 if (acl_duplex_pipe(serv->status_fd) < 0) {
210 acl_msg_fatal("pipe: %s", strerror(errno));
211 }
212
213 acl_non_blocking(serv->status_fd[0], ACL_BLOCKING);
214 acl_close_on_exec(serv->status_fd[0], ACL_CLOSE_ON_EXEC);
215 acl_close_on_exec(serv->status_fd[1], ACL_CLOSE_ON_EXEC);
216
217 /* Must set io rw_timeout to 0 to avoiding blocking read which
218 * will blocking the main event loop.
219 */
220 serv->status_reader = acl_vstream_fdopen(serv->status_fd[0],
221 O_RDWR, acl_var_master_buf_size, 0, ACL_VSTREAM_TYPE_SOCK);
222
223 if (acl_msg_verbose) {
224 acl_msg_info("%s(%d)->%s: call acl_event_enable_read, "
225 "status_fd = %d", __FILE__, __LINE__,
226 myname, serv->status_fd[0]);
227 }
228
229 acl_event_enable_read(acl_var_master_global_event,
230 serv->status_reader, 0, master_status_event, serv);
231}
232
233/* acl_master_status_cleanup - stop status event processing for this service */
234

Callers 2

acl_master_service_startFunction · 0.85

Calls 7

acl_msg_infoFunction · 0.85
acl_msg_panicFunction · 0.85
acl_duplex_pipeFunction · 0.85
acl_msg_fatalFunction · 0.85
acl_non_blockingFunction · 0.85
acl_close_on_execFunction · 0.85
acl_event_enable_readFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…