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 = atoi(argv[1]);
00047 int arg = argc;
00048 int ret;
00049 printf("*********************In the raiseSignal***********************\n");
00050 printf("\nThis process sends a SIGTERM signal to the sigtermSignal process.\n");
00051 printf("\nPress Enter to send the SIGTERM signal\n");
00052 getchar();
00053
00054
00055 ret = kill(id, SIGTERM);
00056 if(ret)
00057 {
00058 printf("Kill() failed, errno=%d", errno);
00059 }
00060 PressKey();
00061 return EXIT_SUCCESS;
00062 }