View previous topic :: View next topic |
Author |
Message |
yagamiram n00b
Joined: 17 Feb 2015 Posts: 13
|
Posted: Wed Mar 04, 2015 9:40 pm Post subject: What is the signal name of 0 in Kill |
|
|
I seen a command as
when i typed it showed
what it is ? what it will do ? |
|
Back to top |
|
|
russK l33t
Joined: 27 Jun 2006 Posts: 665
|
Posted: Wed Mar 04, 2015 11:07 pm Post subject: |
|
|
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
Thanks for the question.
Cheers |
|
Back to top |
|
|
steveL Watchman
Joined: 13 Sep 2006 Posts: 5153 Location: The Peanut Gallery
|
Posted: Thu Mar 05, 2015 7:30 am Post subject: |
|
|
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 |
|
|
yagamiram n00b
Joined: 17 Feb 2015 Posts: 13
|
Posted: Fri Mar 06, 2015 9:53 pm Post subject: |
|
|
Thx for reply. Got it. |
|
Back to top |
|
|
|