On 13/12/2022 11:57, Beata Michalska wrote:
result = waitid(P_PID, pid, &wait_si, WUNTRACED | WCONTINUED, NULL);
The SIGSTOP / SIGCONT way is a smart way to approach this, I like it! Just one question regarding the flags, do we really need either?
we need smth ...
WUNTRACED means that a child stopping while being traced is ignored, and WCONTINUED means returning if the child receives SIGCONT. SIGSTOP causes waitid() to return by default.
switched to WSTOPPED instead.
Sorry, I misread the man page, I was looking at waitpid() instead of waitid(). So yes indeed WSTOPPED is the one we want. Confusingly WUNTRACED and WSTOPPED are really the same thing (looking at uapi/linux/wait.h), I'm not sure I understand how waitpid() and waitid() can have a different behaviour here as they are both handled by do_wait() eventually, but in any case I'm happy with doing what the man page says :)
Kevin