It's not even a tipi signal that you send, but that you do not understand how it all works ...
Here is what you write:
pid = fork(); if (pid < 0) { exit(EXIT_FAILURE); } if (pid > 0) { exit(EXIT_SUCCESS); }
Those. Your program ends when pid <0 and then when pid> 0. Only one value remains - zero. But this means that we are in a PARTICIPATION process! As a result, the team
kill(pid, SIGCONT);
sends a signal to the process with pid == 0. What are you talking about ?! If your child process wants to do a hari-kiri, then this is done using exit (0);
If you want to kill the child from the parent, then you need to send a signal in the branch, where pid> 0. And the signal can be, well, at least SIGINT ... It's the same thing, press Ctrl / C.
I answer the request in the comments: "answer the literal question in the title."
There is only ONE way to kill the process - to send him a signal that cannot be processed. A process (any) cannot process a signal if it has not created a handler for this signal, or this signal is not processed in the printer (-9).
In order to send a signal to a process, you need to know its PID. And here are two possible options: 1) You know his PID because you created it yourself using the fork operation. 2) This process is a properly written daemon and it honestly put its pid file in the / var / run directory, in which its pid is written. In this case, the file name must match the name of the running daemon and is easy to understand.
Thus, your child must write its pid to a pid file in the / ar / run directory. And your process that kills him must read this file, take a pid from it and call kill () with this pid.
Look like that's it...