Thread: How do I use signals sent from the kill() Linux call?

  1. #1
    Registered User
    Join Date
    May 2006
    Posts
    100

    Question How do I use signals sent from the kill() Linux call?

    Concerning programming something that makes system calls to Linux and that creates multiple process, I know how to send a message to another process using the method kill() (I think it's strange that a message-sending function is called something like that), but I don't understand how to make use of that message.

    More specifically from what I understand, the "signal" you send with that function is just any arbitrary number that means whatever you want it to mean. Then in the code, the child process should have an if statement or something checking some variable to see if a certain value has been stored there, and then it should react accordingly. What I do not understand (and the man -S2 kill documentation in Linux didn't help much with this) is what variable the information is stored in. Or if it's less of a variable and more of an event, how do I check for the event?

    Of course there is a little suspicion I have that I might be misunderstanding the signal argument of kill(). Since the documentation on kill() was lacking, I guess I should ask if in the library that you pull that function from, whether there are several predefined values that are intended to be passed as signals, such as SIGQUIT and SIGKILL, at which point Linux will take a certain appropriate course of action.

    Can anybody please clarify this for me? Thanks!

  2. #2
    Registered User
    Join Date
    Dec 2007
    Posts
    2,675
    Is this helpful? I got it from typing "man kill" in Google.

  3. #3
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,336
    Did you see at the bottom where it says "See Also"? Did you read those man pages too, like sigaction?

  4. #4
    Registered User
    Join Date
    May 2006
    Posts
    100
    Concerning the first reply, that gives a man page that deals with kill from the command line; man page 2 for kill deals with the c function, which is what I needed. Thanks anyway though.

    Concerning the second reply, I didn't notice the See Also section before reading your reply. I have since then researched it slightly, and that seems to be pretty much what I'm looking for. Thank you.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Thinking of upgrading to linux...
    By Yarin in forum General Discussions
    Replies: 37
    Last Post: 07-24-2009, 11:40 AM
  2. Replies: 8
    Last Post: 03-10-2008, 12:08 PM
  3. Troubleshooting Input Function
    By SiliconHobo in forum C Programming
    Replies: 14
    Last Post: 12-05-2007, 07:18 AM
  4. Linux Linux why Linux??
    By afreedboy in forum Tech Board
    Replies: 146
    Last Post: 01-21-2004, 06:27 PM
  5. queued signals problem, C programming related
    By Unregistered in forum Linux Programming
    Replies: 3
    Last Post: 01-22-2002, 12:30 AM