postfork: correct terminology from parent group to process group

This commit is contained in:
David Adam 2017-04-23 20:58:01 +10:00
parent c32032757e
commit b8bf567514

View file

@ -317,15 +317,15 @@ bool fork_actions_make_spawn_properties(posix_spawnattr_t *attr,
return false; return false;
} }
bool should_set_parent_group_id = false; bool should_set_process_group_id = false;
int desired_parent_group_id = 0; int desired_process_group_id = 0;
if (j->get_flag(JOB_CONTROL)) { if (j->get_flag(JOB_CONTROL)) {
should_set_parent_group_id = true; should_set_process_group_id = true;
// PCA: I'm quite fuzzy on process groups, but I believe that the default value of 0 means // PCA: I'm quite fuzzy on process groups, but I believe that the default value of 0 means
// that the process becomes its own group leader, which is what set_child_group did in this // that the process becomes its own group leader, which is what set_child_group did in this
// case. So we want this to be 0 if j->pgid is 0. // case. So we want this to be 0 if j->pgid is 0.
desired_parent_group_id = j->pgid; desired_process_group_id = j->pgid;
} }
// Set the handling for job control signals back to the default. // Set the handling for job control signals back to the default.
@ -338,13 +338,13 @@ bool fork_actions_make_spawn_properties(posix_spawnattr_t *attr,
short flags = 0; short flags = 0;
if (reset_signal_handlers) flags |= POSIX_SPAWN_SETSIGDEF; if (reset_signal_handlers) flags |= POSIX_SPAWN_SETSIGDEF;
if (reset_sigmask) flags |= POSIX_SPAWN_SETSIGMASK; if (reset_sigmask) flags |= POSIX_SPAWN_SETSIGMASK;
if (should_set_parent_group_id) flags |= POSIX_SPAWN_SETPGROUP; if (should_set_process_group_id) flags |= POSIX_SPAWN_SETPGROUP;
int err = 0; int err = 0;
if (!err) err = posix_spawnattr_setflags(attr, flags); if (!err) err = posix_spawnattr_setflags(attr, flags);
if (!err && should_set_parent_group_id) if (!err && should_set_process_group_id)
err = posix_spawnattr_setpgroup(attr, desired_parent_group_id); err = posix_spawnattr_setpgroup(attr, desired_process_group_id);
// Everybody gets default handlers. // Everybody gets default handlers.
if (!err && reset_signal_handlers) { if (!err && reset_signal_handlers) {