Wording issue in kill(2) with sig=0

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello Amit,

Please CC the mailing list.  (I've added it now.)

On Tue, Feb 11, 2025 at 09:43:43PM +0200, Amit Pinhas wrote:
> Hello!
> My name is Amit, and I started getting deep into both linux kernel and user
> space programming in the last few years.
> During my journey, I stumbled upon a small mistake, or rather a misphrasing
> in `man 2 kill`.
> 
> At my scenario, I was looking to check an existence of a certain process,
> and so i have seen that kill will check it for me, as mentioned:
> ```
> 
> If *sig* is 0, then no signal is sent, but existence and permission
> checks are still performed; this can be used to check for the
> existence of a process ID...
> 
> ```
> Which is great! I was trying it and it worked just as I expected.
> When the process did exist, I would get 0 as a success, and if not, then
> the call failed, as I expected.
> 
> On the other hand, when I read the `RETURN VALUE` section, I saw a small
> misphrasing:
> ```
> 
> On success (at least one signal was sent), zero is returned.  On
> error, -1 is returned...
> 
> ```
> Which seemed rational.
> 
> But wait! How can I get 0 when providing sig=0, if no signal was actually
> sent, which is the criteria for success of this call???
> 
> If i understand correctly, there should be a disclaimer, something like:
> ```
> 
> On success (at least one signal was sent *or if sig=0 and the checks
> done were successful*), zero is returned.  On
> error, -1 is returned...

You're correct.  I'd maybe rephrase it differently:

	On success, zero is returned.  If signals were sent to a process
	group, success means that at least one signal was delivered.

	On error, -1 is returned...

This helps clarify what the sentence really meant.

> 
> ```
> 
> If you read my thoughts this far, thank you for your time! I love your work
> and keep it going!

Thanks!  :)

> I would like to know how and if I could fix the man page if needed :)

Sure, you can send a patch!  Here are the contributing guidelines:

<https://git.kernel.org/pub/scm/docs/man-pages/man-pages.git/tree/CONTRIBUTING>
<https://git.kernel.org/pub/scm/docs/man-pages/man-pages.git/tree/CONTRIBUTING.d/>

You'll first need to clone the repository with git(1), and edit the file
<man/man2/kill.2>.  Then do a commit.  Then format a patch, and then
send it.  Sending it is the most difficult part, if you're not used to
it, but we can help with that.  Feel free to ask if you have any doubts!
It may be difficult to write the first patch, so ask as much as you
need.

> Have a nice day guys!
> Much love from Israel :)

Have a lovely night!
Alex

-- 
<https://www.alejandro-colomar.es/>

Attachment: signature.asc
Description: PGP signature


[Index of Archives]     [Kernel Documentation]     [Netdev]     [Linux Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux