Skip to Content [alt-c]
In reply to Remote SSH Commands and Broken Connections
Further to my above post, this is the equivalent function in FreeBSD:
#include <unistd.h> #include <signal.h> #include <sys/procctl.h>
int main (int argc, char **argv)
{ int signal_to_send = SIGTERM;
procctl (P_PID, 0, PROC_PDEATHSIG_CTL, &signal_to_send); execvp (argv[1], argv + 1); return 127; }
As an aside, I note that when using TCSH as a login shell (also maybe others) on the remote machine, you need to preface the "diewithparent" with "exec", as otherwise tcsh spawns a further process and so you'd need to then use die-with-grandparent. (this is how it appears here, anyway)
It doesn't seem to make any difference with bourne shell, so there is no harm always doing it.
Reply
Your comment will be public. To contact me privately, email me. Please keep your comment polite, on-topic, and comprehensible. Your comment may be held for moderation before being published.
Your Name: (Optional; will be published)
Your Email Address: (Optional; will not be published)
Your Website: (Optional; will be published)
>
monospaced
Post a Reply
Your comment will be public. To contact me privately, email me. Please keep your comment polite, on-topic, and comprehensible. Your comment may be held for moderation before being published.