I'm registering in the main an handler for the SIGTERM like this:
signal(SIGTERM, sigterm_handler);
And the handler is a simple:
void sigterm_handler()
{ exit(1); }
What if I need to pass to the handler a few arguments like a 2 pointers or anything else? How do I register the handler in the signal function? Or at least... is there anyway to achieve that?
Notice: the process is killed by a third party process, not by itself. But before closing I need to manually free some structures and write them on files.