Add proc-pgroup flog category

I'm not *super*-happy with this, because pgroups and terminal
ownership and such are quite entertwined.

But hey, if all fails just use `proc'*'`
This commit is contained in:
Fabian Homborg 2020-01-19 14:32:41 +01:00
parent 0c49f45028
commit 246882b52d
3 changed files with 4 additions and 3 deletions

View file

@ -74,6 +74,7 @@ class category_list_t {
L"Reaping internal (non-forked) processes"};
category_t proc_reap_external{L"proc-reap-external", L"Reaping external (forked) processes"};
category_t proc_pgroup{L"proc-pgroup", L"Process groups"};
category_t env_locale{L"env-locale", L"Changes to locale variables"};

View file

@ -124,7 +124,7 @@ bool set_child_group(job_t *j, pid_t child_pid) {
// ever leads to a terminal hang due if both this setpgid call AND posix_spawn's
// internal setpgid calls failed), write to the debug log so a future developer
// doesn't go crazy trying to track this down.
debug(2, "Error %d while calling setpgid for child %d (probably harmless)", errno,
FLOGF(proc_pgroup, "Error %d while calling setpgid for child %d (probably harmless)", errno,
child_pid);
}
}

View file

@ -798,7 +798,7 @@ pid_t terminal_acquire_before_builtin(int job_pgid) {
static bool terminal_return_from_job(job_t *j, int restore_attrs) {
errno = 0;
if (j->pgid == 0) {
debug(2, "terminal_return_from_job() returning early due to no process group");
FLOG(proc_pgroup, "terminal_return_from_job() returning early due to no process group");
return true;
}
@ -868,7 +868,7 @@ void job_t::continue_job(parser_t &parser, bool reclaim_foreground_pgrp, bool se
// signal individually. job_t::signal() does the same, but uses the shell's own pgroup
// to make that distinction.
if (!signal(SIGCONT)) {
debug(2, "Failed to send SIGCONT to any processes in pgroup %d!", pgid);
FLOGF(proc_pgroup, "Failed to send SIGCONT to any processes in pgroup %d!", pgid);
// This returns without bubbling up the error. Presumably that is OK.
return;
}