From 8cc97cf664496924abd371a90341d1d1308d84b3 Mon Sep 17 00:00:00 2001 From: gumartinm Date: Wed, 18 Jan 2012 07:58:29 +0100 Subject: [PATCH] SIGTERM handler for Java fork process. --- JavaFork/Daemon/javafork | Bin 22009 -> 22839 bytes JavaFork/Daemon/javafork.c | 30 ++++++++++++++++++++- JavaFork/Daemon/javafork.h | 1 + .../src/main/java/de/fork/java/MainJavaFork.java | 2 +- 4 files changed, 31 insertions(+), 2 deletions(-) diff --git a/JavaFork/Daemon/javafork b/JavaFork/Daemon/javafork index 6ad921297f574f913c3ba6f301a8c73dfd5e5f51..7277198a27261ffd239c9af74f50b817dffd38d2 100755 GIT binary patch literal 22839 zcmcJ13zSsFxo&kg1I=ruVR#LoG%!39W(Gt=gV+d-jSe^gyuoKr&veg2d%7pn-3TfH z9Y$>@m?6j9F#v zehE;Iz8=@<$LH5e+|WDe5JIn}Mvv}MPb}aGVL`nlh91<88EVSMvhkRy%Qw><07pJR zBG$?C5Tz_b-HCLR@s@d#1r5lEp|uJYh8n#uLr?mt)Bh`C{H%_*Hmq1)9gi-Fw zmh4!$V#$i-RjFjvGU>k$hFHW)HeDf2n);Xsj(JbQ!75|=GmrePE`QI(_skph`u(dP z>;2U~Y&r5ci*XK)={T0+(AAHa3R5*52YNOR$}ht)3&&YFnEw(Si*Qup7>lC{M>UQb z9J6tJ5eI|0Rv0hEF^v%f*2@=gun8CAU?^9laMsNz%VNM$CZg$R3vVu4LSrmAqvLT* z#xVuQ1RN%?uB@R1jA;kIC1H*wJ{R!{%`en+1}N*k3ek_<9FBe{{ez4t73vkZ*9nw>a4O2M76f z2l;Cq@KFxJj8y1g}85KYD6O@jG|NMmEHT^UQZ#}WmJXe=FR zY$>p@9mt4T(-Jfrw~N$HxYZ`XOaeF98$>wV+?Gs)Q|U-YIvi$c8d;7NB9&~sAqM@H zwq}r)bTWZ*w0E>7(oLehwH-dUv_(*mSVu>)L!?@p6OlNv#&jH3kWGSIG%cXcVzee= z>2N#D(201mS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n`jwBU z?}ph?)41w$U-mR~7__e)lY;`wVTbvD9y_AGfU5MST2W8t{mqEdhKu_v9~dF<~1 T$WcfAd&90M_l@n4YNr1Slu6Pj diff --git a/JavaFork/Daemon/javafork.c b/JavaFork/Daemon/javafork.c index 6d78c0c..3ad2346 100644 --- a/JavaFork/Daemon/javafork.c +++ b/JavaFork/Daemon/javafork.c @@ -17,12 +17,22 @@ #include #include #include +#include #include "javafork.h" +pid_t currentPID; +int sockfd; + int main (int argc, char *argv[]) { pid_t pid; + if (signal(SIGTERM, sigterm_handler) == SIG_ERR) + { + perror ("\nerror signal handler"); + return -1; + } + if ((pid = fork()) == -1) { perror("fork: "); return -1; @@ -30,6 +40,7 @@ int main (int argc, char *argv[]) { else { if (pid == 0) { /*child process*/ + currentPID = getpid(); main_child(argc, argv); } } @@ -42,7 +53,6 @@ int main_child (int argc, char *argv[]) { struct protoent *protocol; struct sockaddr_in addr_server; struct sockaddr_in addr_client; - int sockfd; int sockclient; pthread_t idThread; int clilen; @@ -137,6 +147,7 @@ void *serverThread (void * arg) { } close(sockclient); + /*FIXME: dunno why, but after finishing connection from client we have TIME_WAIT in this socket*/ pthread_exit(0); } @@ -345,3 +356,20 @@ int fork_system(int socket, char *command) { return 0; } + + +void sigterm_handler(int sig) +{ + if (currentPID != getpid()) { + //Do nothing + return; + } + if (signal (SIGTERM, SIG_IGN) == SIG_ERR) + { + syslog (LOG_ERR, "signal desactivation failed"); + } + + close (sockfd); + /*TODO: kill child processes and release allocate memory*/ + exit (0); +} diff --git a/JavaFork/Daemon/javafork.h b/JavaFork/Daemon/javafork.h index d6321a0..7f03332 100644 --- a/JavaFork/Daemon/javafork.h +++ b/JavaFork/Daemon/javafork.h @@ -5,3 +5,4 @@ void *serverThread (void *arg); int daemonize(const char *pname, int facility, int option); int main_child (int argc, char *argv[]); int fork_system(int socket, char *command); +void sigterm_handler(); diff --git a/JavaFork/JavaExample/javafork-example/src/main/java/de/fork/java/MainJavaFork.java b/JavaFork/JavaExample/javafork-example/src/main/java/de/fork/java/MainJavaFork.java index bed6b6a..a422cdd 100644 --- a/JavaFork/JavaExample/javafork-example/src/main/java/de/fork/java/MainJavaFork.java +++ b/JavaFork/JavaExample/javafork-example/src/main/java/de/fork/java/MainJavaFork.java @@ -21,7 +21,7 @@ public class MainJavaFork { final ByteArrayOutputStream stdoutByteOut = new ByteArrayOutputStream(); final PrintStream stdout = new PrintStream(stdoutByteOut); - final String command = "ls -lah; ls -lah bbb aaa ccc; ls -lah"; + final String command = "/home/gustavo/github/JavaForFun/JavaFork/Daemon/script.sh"; final ByteArrayOutputStream stderrByteOut = new ByteArrayOutputStream(); final PrintStream stderr = new PrintStream(stderrByteOut); int result; -- 2.1.4