diff options
author | bloodstalker <thabogre@gmail.com> | 2017-03-06 09:49:35 +0000 |
---|---|---|
committer | bloodstalker <thabogre@gmail.com> | 2017-03-06 09:49:35 +0000 |
commit | 48c379d6fff43896215602f4e3c6a532a15881b2 (patch) | |
tree | c4539367d6625b6c3808c4bff0c0de6ead5b5e2a /daemon | |
parent | updated some commnets (diff) | |
download | mutator-48c379d6fff43896215602f4e3c6a532a15881b2.tar.gz mutator-48c379d6fff43896215602f4e3c6a532a15881b2.zip |
now actually does something and that is running the server.
Diffstat (limited to '')
-rw-r--r-- | daemon/mutatord.c | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/daemon/mutatord.c b/daemon/mutatord.c index 980207b..a0db5ba 100644 --- a/daemon/mutatord.c +++ b/daemon/mutatord.c @@ -1,7 +1,6 @@ /***************************************************Project Mutator****************************************************/ /*first line intentionally left blank.*/ -/*the source code for the static checks(Misra-C,...)*/ /*Copyright (C) 2017 Farzad Sadeghi This source file contains mutator's daemon. @@ -19,8 +18,15 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.*/ /**********************************************************************************************************************/ +/*macros*/ +#define __DBG +#if 0 +#undef __DBG +#endif +/**********************************************************************************************************************/ /*inclusion directives*/ #include "mutatord.h" +#include "daemon_aux.h" /*library headers*/ #include <errno.h> #include <fcntl.h> @@ -54,6 +60,8 @@ int main(void) /*getting a session ID*/ pid_t sid; + int server_exit_code; + FILE *mut_log; mut_log = fopen("mutatord-log", "w"); @@ -64,6 +72,9 @@ int main(void) /*fork off the parent process*/ pid = fork(); + fprintf(mut_log, "%s", "child forked on "); + time_n_date(mut_log); + if (pid < 0) { //fprintf(mut_log, "%s", "failed to get a pid.\n"); @@ -81,6 +92,7 @@ int main(void) /*create a new session ID for the child process*/ sid = setsid(); + if (sid < 0) { fprintf(mut_log, "%s", "failed to get an sid.\n"); @@ -111,13 +123,15 @@ int main(void) /*deamon loop*/ while(1) { - fprintf(mut_log, "%s", "mutatord is running fine.\n"); - sleep(1); + fprintf(mut_log, "%s", "running server...\n"); + //sleep(1); + server_exit_code = mutator_server(); + fprintf(mut_log, "%s%d", "server terminated with exit code ", server_exit_code); } + /*these obviously will never run. theyre just a reminder that i need to handle the gracefull shutdown*/ fclose(mut_log); exit(EXIT_SUCCESS); - } /*last line intentionally left blank*/ |