Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
What is the signal name of 0 in Kill
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo
View previous topic :: View next topic  
Author Message
yagamiram
n00b
n00b


Joined: 17 Feb 2015
Posts: 13

PostPosted: Wed Mar 04, 2015 9:40 pm    Post subject: What is the signal name of 0 in Kill Reply with quote

I seen a command as
Code:
kill -0 pid


when i typed
Code:
kill -l 0
it showed
Code:
T


what it is ? what it will do ?
Back to top
View user's profile Send private message
russK
l33t
l33t


Joined: 27 Jun 2006
Posts: 665

PostPosted: Wed Mar 04, 2015 11:07 pm    Post subject: Reply with quote

I love these kinds of questions, although not strictly gentoo.

'kill -l' with no args of course gives you all the names in a nice table. Hmm. You would think the man page is a little off. But maybe bash is playing tricks on us. Try again with the full path '/bin/kill -l 0'

Code:
$ /bin/kill -l 0
HUP INT QUIT ILL TRAP ABRT BUS FPE KILL USR1 SEGV USR2 PIPE ALRM TERM STKFLT
CHLD CONT STOP TSTP TTIN TTOU URG XCPU XFSZ VTALRM PROF WINCH POLL PWR SYS


Also
Code:
$ /bin/kill -L
 1 HUP      2 INT      3 QUIT     4 ILL      5 TRAP     6 ABRT     7 BUS
 8 FPE      9 KILL    10 USR1    11 SEGV    12 USR2    13 PIPE    14 ALRM
15 TERM    16 STKFLT  17 CHLD    18 CONT    19 STOP    20 TSTP    21 TTIN
22 TTOU    23 URG     24 XCPU    25 XFSZ    26 VTALRM  27 PROF    28 WINCH
29 POLL    30 PWR     31 SYS     


So then take a look at 'man 2 kill', while it does not tell us the name of '0', it does kindof suggest the underlying system call does almost nothing except some error checking, like whether or not the pid exists.

So bash is nice enough to report 'kill -0 <nonexistent-pid>' : 'No such process', and 'kill -0 <not-my-pid>': 'Operation not permitted'

Perhaps /bin/kill is posixly correct, I'll leave that exercise to the reader :D

Thanks for the question.

Cheers
Back to top
View user's profile Send private message
steveL
Watchman
Watchman


Joined: 13 Sep 2006
Posts: 5153
Location: The Peanut Gallery

PostPosted: Thu Mar 05, 2015 7:30 am    Post subject: Reply with quote

As russK kind of got to, kill -0 is a test for pid existence, and permission to signal it. Note both are required for you to know the pid is running, and that does not mean it is the same program.
Back to top
View user's profile Send private message
yagamiram
n00b
n00b


Joined: 17 Feb 2015
Posts: 13

PostPosted: Fri Mar 06, 2015 9:53 pm    Post subject: Reply with quote

Thx for reply. Got it.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum