Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp482866rwb; Thu, 22 Sep 2022 02:18:53 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5jd6o1eAtryC1LROHlAzBKK7tI5RLl9sZOVgjTNaBZFP0agt7x/FgQG1hCTyMgPupZ0QOx X-Received: by 2002:a17:90b:4a4f:b0:202:8d29:c188 with SMTP id lb15-20020a17090b4a4f00b002028d29c188mr2628941pjb.199.1663838333429; Thu, 22 Sep 2022 02:18:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1663838333; cv=none; d=google.com; s=arc-20160816; b=MvO6vbZ0i0nKpCBTk3hMeOLioAFFne+Bb11jQ7nQ8x30NFCU0L4G5g0q0qWqN1E/4k yfau4hguqhGFEvXcEx3aUzGCtBoao8JVG49Y3bd0+6wPiU0E5sO7jswN+DgwF+wJQFgK pTnr4IXpoaTiG5+HO/VM+qW6u1NcwQhDvBum8J4v6em1RylyOgMkFFkin2BZprshbM8u z0Fm9Qiy2kzUhmMqp1JevzO3D2WgPNQdguuPyuq/KjOHPD9X0o8nc5pIayqDxzMebCCI IFOLs3Z84sjuvePgx4nbya3h0j2BE+5mY+GErZXFSJOno8CjaAwPeyou8ZjH0PZzwdYr RIZA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:to:cc:date:message-id:subject:mime-version :content-transfer-encoding:from; bh=JObNVV5tRydN9yfTdMLrZ47EMyMHzhLp1ZlkCqxwI2s=; b=ZTTPk24WB8Q2Rd7LWiYlH1Is2SgaAamQhpHQTdlRm1LQ1ecMOdTk0KDZS+tu0p1X/7 hUbJDFBmMd5+ECRKM0uV7XnLRhTGD0BxtR6cSeUJCSHHwa7hK30oPuT4GXlnjAHMS29E P4++Rp+9kXJXz1eeo0B+rOT5I3e6VHPEhzNqOFUEDrjJYwz/K/JX2YuMPtCbNzzEqRKy hlOhjw1F26qcE318dy3HjiPSi5mNDMNOVFqSJXEeCyNqxaibPkV8mRdZH1/bdqKmQEf1 pVSFMLWCdXTRfTXdKDIeyJsDd/wQr5MoFeMTE9HlSDwJ3YIs3zrlT+zexYasshK9fQHJ hK9w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 27-20020a17090a195b00b001fde265fec2si5091839pjh.78.2022.09.22.02.18.42; Thu, 22 Sep 2022 02:18:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229971AbiIVJLT (ORCPT + 99 others); Thu, 22 Sep 2022 05:11:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49224 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229498AbiIVJLR (ORCPT ); Thu, 22 Sep 2022 05:11:17 -0400 Received: from out30-133.freemail.mail.aliyun.com (out30-133.freemail.mail.aliyun.com [115.124.30.133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 18A63B1BBB; Thu, 22 Sep 2022 02:11:15 -0700 (PDT) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R141e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018046059;MF=cambda@linux.alibaba.com;NM=1;PH=DS;RN=7;SR=0;TI=SMTPD_---0VQS1Tjf_1663837873; Received: from smtpclient.apple(mailfrom:cambda@linux.alibaba.com fp:SMTPD_---0VQS1Tjf_1663837873) by smtp.aliyun-inc.com; Thu, 22 Sep 2022 17:11:13 +0800 From: cambda@linux.alibaba.com Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3696.120.41.1.1\)) Subject: Syscall kill() can send signal to thread ID Message-Id: <69E17223-F0CA-4A4C-AAD7-065D6E6266D9@linux.alibaba.com> Date: Thu, 22 Sep 2022 17:11:12 +0800 Cc: linux-api@vger.kernel.org, Xuan Zhuo , Dust Li , Tony Lu , Cambda Zhu To: "Eric W. Biederman" , linux-kernel@vger.kernel.org X-Mailer: Apple Mail (2.3696.120.41.1.1) X-Spam-Status: No, score=-9.9 required=5.0 tests=BAYES_00, ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, UNPARSEABLE_RELAY,USER_IN_DEF_SPF_WL autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. Regards, Cambda