forumforme123 Posted April 22, 2010 Share Posted April 22, 2010 Hi, I am trying to kill my process via pid with the function posix_kill. However, I am not sure what is an int $sig for the second parameter? I'm putting various number in it, from 0 - 3, and it still works, I think. Coz I'm not getting any error back. Any light on this is appreciated. Thanks Quote Link to comment https://forums.phpfreaks.com/topic/199359-what-is-sig-in-posix_kill/ Share on other sites More sharing options...
oni-kun Posted April 22, 2010 Share Posted April 22, 2010 http://linux.die.net/man/7/signal How is this a PHP question? Quote Link to comment https://forums.phpfreaks.com/topic/199359-what-is-sig-in-posix_kill/#findComment-1046283 Share on other sites More sharing options...
forumforme123 Posted April 22, 2010 Author Share Posted April 22, 2010 posix_kill() is a php function. Link: http://php.net/manual/en/function.posix-kill.php but I don't get what int $sig (the 2nd parameter) is. Quote Link to comment https://forums.phpfreaks.com/topic/199359-what-is-sig-in-posix_kill/#findComment-1046284 Share on other sites More sharing options...
forumforme123 Posted April 22, 2010 Author Share Posted April 22, 2010 Ah, nvm. I think I got it. The int $sig refers to the type of signal. Thanks for the link. Can anyone confirm? Quote Link to comment https://forums.phpfreaks.com/topic/199359-what-is-sig-in-posix_kill/#findComment-1046285 Share on other sites More sharing options...
oni-kun Posted April 22, 2010 Share Posted April 22, 2010 I can confirm as a linux developer, but, As it seems you're learning, lets read the documentation you linked to before you require further information: pid: The process identifier. sig: One of the PCNTL signals constants. Wasn't that hard? And no, POSIX is not a PHP question (Only POSIX related structures within the languages, such as POSIX Regular expressions which are deprecated in trunk) which are part of the framework. It's the same answer you'll get when asking how to use system on a foreign command. Quote Link to comment https://forums.phpfreaks.com/topic/199359-what-is-sig-in-posix_kill/#findComment-1046293 Share on other sites More sharing options...
forumforme123 Posted April 22, 2010 Author Share Posted April 22, 2010 pid: The process identifier. sig: One of the PCNTL signals constants. That's the one about the sig that I didn't understand. Yes, it was that hard for me. Thanks for your explanation. I really appreciate it. Now I just hope I can successfully kill a process. Quote Link to comment https://forums.phpfreaks.com/topic/199359-what-is-sig-in-posix_kill/#findComment-1046298 Share on other sites More sharing options...
oni-kun Posted April 22, 2010 Share Posted April 22, 2010 Alright. If you're not aware of how *nix commands its processes, you can look at these: http://en.wikipedia.org/wiki/SIGKILL http://en.wikipedia.org/wiki/SIGTERM For example SIGTERM will be constant 15, So you should use it with your POSIX command. On a linux kernel the command "top" would allow you to view processes, You can choose to kill, terminate, or deprecate a open/halted/zombie process and basically it's a just level of command. Terminating will "tell" the command to quit, killing it will force it to terminate no matter what it's doing. This question is off topic, There's no need to answer further. Quote Link to comment https://forums.phpfreaks.com/topic/199359-what-is-sig-in-posix_kill/#findComment-1046299 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.