lkml.org 
[lkml]   [2022]   [Sep]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: Syscall kill() can send signal to thread ID
From
Date

> On Sep 23, 2022, at 15:53, Florian Weimer <fweimer@redhat.com> wrote:
>
>> I don't quite understand what you mean, sorry. But if kill() returns
>> -ESRCH for tid which is not equal to tgid, kill() can only send signal
>> to thread group via main thread id, that is what BSD did and manual
>> said. It seems not odd?
>
> It's still odd because there's one TID per process that's valid for
> kill by accident. That's all.
>
> Thanks,
> Florian

As far as I know, there is no rule forbidding 'process ID'(TGID on Linux)
equals to main thread ID, is it right? If one wants to send signal to a
specific thread, tgkill() can do that. As far as I understand, the difference
between kill() and tgkill() is whether the signal is set on shared_pending,
whatever the ID is a process ID or a thread ID. For Linux, the main thread ID
just equals to the process ID. So the meaning of kill(main_tid, sig) is sending
signal to a process, of which the PID equals to the first argument. It's not odd,
I think.

Thanks,
Cambda

\
 
 \ /
  Last update: 2022-09-23 10:41    [W:0.050 / U:0.564 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site