Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to send signal from one program to another?

Tags:

linux

signals

i am using message queue as an ipc between 2 programs. Now i want to send data from one program to another using message queue and then intimate it through a signal SIGINT.

I dont know how to send a signal from one program to another . Can anybody pls provide a sample code if they have the solution.

like image 384
Chaithra Avatar asked Mar 12 '09 09:03

Chaithra


2 Answers

#include <sys/types.h>
#include <signal.h>
int kill(pid_t pid, int sig);
like image 184
vartec Avatar answered Sep 20 '22 12:09

vartec


Signal in linux can be send using kill system call just check this link for documentation of kill system call and example. you can see man -2 kill also. and it's not advisable to use SIGINT use SIGUSR1 or SIGUSR2

like image 32
serioys sam Avatar answered Sep 22 '22 12:09

serioys sam