[LEDE-DEV,libubox,2/2] uloop: Enable utracing of multi-threaded programs

Message ID 20170912111250.31576-3-sojkam1@fel.cvut.cz
State Rejected
Delegated to: Yousong Zhou
Headers show
Series
  • Untitled series #2668
Related show

Commit Message

Michal Sojka Sept. 12, 2017, 11:12 a.m.
This is needed for Linux < 4.7 or < 4.4.13 to report ptrace events in
threads.

Signed-off-by: Michal Sojka <sojkam1@fel.cvut.cz>
---
 uloop.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Yousong Zhou Sept. 14, 2017, 3:38 a.m. | #1
On 12 September 2017 at 19:12, Michal Sojka <sojkam1@fel.cvut.cz> wrote:
> This is needed for Linux < 4.7 or < 4.4.13 to report ptrace events in
> threads.
>
> Signed-off-by: Michal Sojka <sojkam1@fel.cvut.cz>
> ---
>  uloop.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/uloop.c b/uloop.c
> index 3813e18..e6d77df 100644
> --- a/uloop.c
> +++ b/uloop.c
> @@ -369,7 +369,7 @@ static void uloop_handle_processes(void)
>         do_sigchld = false;
>
>         while (1) {
> -               pid = waitpid(-1, &ret, WNOHANG);
> +               pid = waitpid(-1, &ret, WNOHANG|__WALL);
>                 if (pid < 0 && errno == EINTR)
>                         continue;
>

NACK because this changes the current behaviour of only handling
termination of child processes notified via SIGCHLD signal.  It may
break existing users of the library.

                yousong
Michal Sojka Sept. 14, 2017, 9:41 a.m. | #2
On Thu, Sep 14 2017, Yousong Zhou wrote:
> On 12 September 2017 at 19:12, Michal Sojka <sojkam1@fel.cvut.cz> wrote:
>> This is needed for Linux < 4.7 or < 4.4.13 to report ptrace events in
>> threads.
>>
>> Signed-off-by: Michal Sojka <sojkam1@fel.cvut.cz>
>> ---
>>  uloop.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/uloop.c b/uloop.c
>> index 3813e18..e6d77df 100644
>> --- a/uloop.c
>> +++ b/uloop.c
>> @@ -369,7 +369,7 @@ static void uloop_handle_processes(void)
>>         do_sigchld = false;
>>
>>         while (1) {
>> -               pid = waitpid(-1, &ret, WNOHANG);
>> +               pid = waitpid(-1, &ret, WNOHANG|__WALL);
>>                 if (pid < 0 && errno == EINTR)
>>                         continue;
>>
>
> NACK because this changes the current behaviour of only handling
> termination of child processes notified via SIGCHLD signal.  It may
> break existing users of the library.

OK. It should not influence the rest of the patch series, because LEDE
seems to ship newer kernel versions than those needing this patch.

-Michal

Patch

diff --git a/uloop.c b/uloop.c
index 3813e18..e6d77df 100644
--- a/uloop.c
+++ b/uloop.c
@@ -369,7 +369,7 @@  static void uloop_handle_processes(void)
 	do_sigchld = false;
 
 	while (1) {
-		pid = waitpid(-1, &ret, WNOHANG);
+		pid = waitpid(-1, &ret, WNOHANG|__WALL);
 		if (pid < 0 && errno == EINTR)
 			continue;