From: "Eric W. Biederman" <ebiederm@xmission.com>
To: cambda@linux.alibaba.com
Cc: linux-kernel@vger.kernel.org, linux-api@vger.kernel.org,
Xuan Zhuo <xuanzhuo@linux.alibaba.com>,
Dust Li <dust.li@linux.alibaba.com>,
Tony Lu <tonylu@linux.alibaba.com>
Subject: Re: Syscall kill() can send signal to thread ID
Date: Thu, 22 Sep 2022 10:33:20 -0500 [thread overview]
Message-ID: <87k05v5sqn.fsf@email.froward.int.ebiederm.org> (raw)
In-Reply-To: <69E17223-F0CA-4A4C-AAD7-065D6E6266D9@linux.alibaba.com> (cambda@linux.alibaba.com's message of "Thu, 22 Sep 2022 17:11:12 +0800")
cambda@linux.alibaba.com writes:
> I found syscall kill() can send signal to a thread id, which is
> not the TGID. But the Linux manual page kill(2) said:
>
> "The kill() system call can be used to send any signal to any
> process group or process."
>
> And the Linux manual page tkill(2) said:
>
> "tgkill() sends the signal sig to the thread with the thread ID
> tid in the thread group tgid. (By contrast, kill(2) can be used
> to send a signal only to a process (i.e., thread group) as a
> whole, and the signal will be delivered to an arbitrary thread
> within that process.)"
>
> I don't know whether the meaning of this 'process' should be
> the TGID? Because I found kill(tid, 0) will return ESRCH on FreeBSD,
> while Linux sends signal to the thread group that the thread belongs
> to.
>
> If this is as expected, should we add a notice to the Linux manual
> page? Because it's a syscall and the pids not equal to tgid are not
> listed under /proc. This may be a little confusing, I guess.
How did you come across this? Were you just experimenting?
I am wondering if you were tracking a bug, or a portability problem
or something else. If the current behavior is causing problems in
some way instead of just being a detail that no one really cares about
either way it would be worth considering if we want to maintain the
current behavior.
Eric
next prev parent reply other threads:[~2022-09-22 15:33 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-22 9:11 Syscall kill() can send signal to thread ID cambda
2022-09-22 15:09 ` Eric W. Biederman
2022-09-23 5:31 ` Florian Weimer
2022-09-23 6:25 ` cambda
2022-09-23 7:53 ` Florian Weimer
2022-09-23 8:40 ` Cambda Zhu
2022-09-23 21:15 ` Eric W. Biederman
2022-09-22 15:33 ` Eric W. Biederman [this message]
2022-09-23 3:56 ` cambda
2022-09-23 11:24 ` David Laight
2022-09-23 21:21 ` Eric W. Biederman
2022-09-24 3:16 ` Cambda Zhu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87k05v5sqn.fsf@email.froward.int.ebiederm.org \
--to=ebiederm@xmission.com \
--cc=cambda@linux.alibaba.com \
--cc=dust.li@linux.alibaba.com \
--cc=linux-api@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=tonylu@linux.alibaba.com \
--cc=xuanzhuo@linux.alibaba.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).