Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Top Posters

Who's Online (1)

Powered by Vanilla. Made with Bootstrap.
communication in linux using signals
  • Here is the short introduction how linux is communicating with our program using signals.
    When we execute our program in linux then program library function got a job done by communicating with the linux OS. Thus the direction was from program to linux OS.. But the reverse of this direction, means communication from linux OS to the program is achieved by a mechanism called signals.. There are several signals that can be sent to a program
    A unique number is associated to with each signal. To avoid remembering these numbers,they been defined as macros like SIGINT, SIGCONT etc. in the signal.h.
    To understand it clearly let us take an example, lets write a program for infinite loop.
    Here is the code for infinite loop:-

    #include<stdio.h>
    void main()
    {
    while(1)
    printf(\"plz join iexploit.org\");
    }

    The program is fairly straight forward. We have used an infinite while loop to print the message.
    After running the program we can terminate it by pressing ctrl+c, the keyboard driver inform the linux kernel about pressing of this special key combination.
    the kernel reacts to this by sending a signal to our program, the default signal handler gets called, because we have done nothing to this signal.
    This default signal handler have code to terminate the program.
    Thus in this way our program and linux communicate with each other via signals...
    Hope this will help you guys to understand the special key combination and signals..