00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 
00018 #include <stdio.h>
00019 #include <stdlib.h>
00020 #include <signal.h>
00021 #include <unistd.h>
00022 
00027 void PressKey()
00028     {
00029     int ch;
00030     printf("Press 'e'+Enter to exit\n");
00031     while((ch = getchar()) != 'e')
00032         {
00033         if(ch == '\n')
00034             continue;
00035         else
00036             printf("wrong option inserted, try again!!!\n");
00037         }
00038     }
00039 
00044 int main(int argc,char **argv)
00045     {
00046     pid_t id;
00047     int ret;
00048     if(argc < 2)
00049         {
00050         printf("Please pass the correct arguments\n");
00051         return EXIT_FAILURE;
00052         }
00053     id = atoi(argv[1]);
00054         
00055     printf("*********************In the raiseSignal***********************\n");
00056     printf("\nThis process sends a SIGTERM signal to the sigtermSignal process.\n");
00057     printf("\nPress Enter to send the SIGTERM signal\n");
00058     getchar();
00059     
00060     
00061     ret = kill(id, SIGTERM);
00062     if(ret)
00063         {
00064         printf("Kill() failed, errno=%d", errno);
00065         } 
00066     PressKey();
00067     return EXIT_SUCCESS;
00068     }