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

Function acl_master_spawn

app/master/daemon/master/master_spawn.cpp:241–348  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

239}
240
241void acl_master_spawn(ACL_MASTER_SERV *serv)
242{
243 const char *myname = "acl_master_spawn";
244 ACL_MASTER_PROC *proc;
245 ACL_MASTER_PID pid;
246
247 if (env_gen == 0) {
248 env_gen = acl_vstring_alloc(100);
249 }
250
251 /*
252 * Sanity checks. The master_avail module is supposed
253 * to know what it is doing.
254 */
255
256 if (!(serv->flags & ACL_MASTER_FLAG_RELOADING)) {
257 if (!ACL_MASTER_LIMIT_OK(serv->max_proc, serv->total_proc)) {
258 acl_msg_warn("%s(%d)->%s: at process limit %d",
259 __FILE__, __LINE__, myname, serv->total_proc);
260 }
261
262 if (serv->avail_proc > 0 && (serv->prefork_proc <= 0
263 || serv->avail_proc > serv->prefork_proc)) {
264
265 acl_msg_warn("%s(%d)->%s: processes available: %d, "
266 "processes prefork: %d", __FILE__, __LINE__,
267 myname, serv->avail_proc, serv->prefork_proc);
268 }
269 }
270
271 /* Delete ACL_MASTER_FLAG_RELOADING set in acl_master_restart_service */
272 else {
273 serv->flags &= ~ACL_MASTER_FLAG_RELOADING;
274 }
275
276 if (serv->flags & ACL_MASTER_FLAG_THROTTLE) {
277 acl_msg_warn("%s(%d)-%s: throttled service: %s",
278 __FILE__, __LINE__, myname, serv->path);
279 }
280
281 /*
282 * Create a child process and connect parent and
283 * child via the status pipe.
284 */
285 master_generation += 1;
286 switch (pid = fork()) {
287
288 /*
289 * Error. We're out of some essential resource. Best recourse is to
290 * try again later.
291 */
292 case -1:
293 acl_msg_warn("%s: fork: %s -- throttling", myname, strerror(errno));
294 master_throttle(serv);
295 break;
296
297 /*
298 * Child process. Redirect child stdin/stdout to the parent-child

Callers 2

master_preforkFunction · 0.85
master_avail_eventFunction · 0.85

Calls 11

acl_vstring_allocFunction · 0.85
acl_msg_warnFunction · 0.85
master_throttleFunction · 0.85
acl_msg_closeFunction · 0.85
acl_msg_openFunction · 0.85
start_childFunction · 0.85
acl_msg_infoFunction · 0.85
acl_binhash_enterFunction · 0.85
acl_ring_prependFunction · 0.85
acl_master_avail_moreFunction · 0.85
acl_master_wakeup_initFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…