gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r8090 - GNUnet/src/server


From: gnunet
Subject: [GNUnet-SVN] r8090 - GNUnet/src/server
Date: Wed, 7 Jan 2009 06:25:58 -0700 (MST)

Author: holindho
Date: 2009-01-07 06:25:57 -0700 (Wed, 07 Jan 2009)
New Revision: 8090

Modified:
   GNUnet/src/server/gnunetd.c
Log:
add no-daemonize option


Modified: GNUnet/src/server/gnunetd.c
===================================================================
--- GNUnet/src/server/gnunetd.c 2009-01-04 22:03:58 UTC (rev 8089)
+++ GNUnet/src/server/gnunetd.c 2009-01-07 13:25:57 UTC (rev 8090)
@@ -47,6 +47,8 @@
 
 static char *cfgFilename = GNUNET_DEFAULT_DAEMON_CONFIG_FILE;
 
+static int no_daemonize_flag;
+
 static int debug_flag;
 
 static int loud_flag;
@@ -98,15 +100,15 @@
   struct GNUNET_SignalHandlerContext *shc_hup;
   int filedes[2];               /* pipe between client and parent */
 
-  if ((GNUNET_NO == debug_flag)
+  if ((GNUNET_NO == debug_flag) && (GNUNET_NO == no_daemonize_flag)
       && (GNUNET_OK != GNUNET_terminal_detach (ectx, cfg, filedes,
                                                PIDFILE_DATA)))
     return GNUNET_SYSERR;
-  if (GNUNET_NO != debug_flag)
+  if ((GNUNET_NO != debug_flag) || (GNUNET_NO != no_daemonize_flag))
     GNUNET_pid_file_write (ectx, cfg, (unsigned int) getpid (), PIDFILE_DATA);
   if (NULL == (mon = GNUNET_network_monitor_create (ectx, cfg)))
     {
-      if (GNUNET_NO == debug_flag)
+      if ((GNUNET_NO == debug_flag) && (GNUNET_NO == no_daemonize_flag))
         GNUNET_terminal_detach_complete (ectx, filedes, GNUNET_NO);
       else
         GNUNET_pid_file_delete (ectx, cfg, PIDFILE_DATA);
@@ -128,7 +130,7 @@
 #ifndef WINDOWS
       GNUNET_signal_handler_uninstall (SIGHUP, &reread_config, shc_hup);
 #endif
-      if (GNUNET_NO == debug_flag)
+      if ((GNUNET_NO == debug_flag) && (GNUNET_NO == no_daemonize_flag))
         GNUNET_terminal_detach_complete (ectx, filedes, GNUNET_NO);
       return GNUNET_SYSERR;
     }
@@ -138,7 +140,7 @@
 
   GNUNET_CORE_connection_init (ectx, cfg, mon, cron);
   GNUNET_CORE_load_application_modules ();
-  if (GNUNET_NO == debug_flag)
+  if ((GNUNET_NO == debug_flag) && (GNUNET_NO == no_daemonize_flag))
     GNUNET_terminal_detach_complete (ectx, filedes, GNUNET_YES);
   GNUNET_cron_start (cron);
   GNUNET_CORE_p2p_enable_processing ();
@@ -175,6 +177,9 @@
   GNUNET_COMMAND_LINE_OPTION_CFG_FILE (&cfgFilename),   /* -c */
   {'@', "win-service", NULL, "", 0,
    &GNUNET_getopt_configure_set_option, "GNUNETD:WINSERVICE"},
+  {'n', "no-daemonize", NULL,
+   gettext_noop ("do not daemonize (run gnunetd as a foreground process)"),
+   0, &GNUNET_getopt_configure_set_one, &no_daemonize_flag},
   {'d', "debug", NULL,
    gettext_noop ("run in debug mode; gnunetd will "
                  "not daemonize and error messages will "





reply via email to

[Prev in Thread] Current Thread [Next in Thread]