=== modified file 'src/WinSvc.cc'
--- src/WinSvc.cc	2014-01-24 01:57:15 +0000
+++ src/WinSvc.cc	2014-02-14 11:28:40 +0000
@@ -944,7 +944,7 @@
     } else {
         WIN32_run_mode = _WIN_SQUID_RUN_MODE_INTERACTIVE;
         opt_no_daemon = 1;
-
+        opt_daemon_type = 1; // always foreground interactive services.
         return SquidMain(argc, argv);
     }
 

=== modified file 'src/globals.h'
--- src/globals.h	2014-01-24 01:57:15 +0000
+++ src/globals.h	2014-02-14 11:29:03 +0000
@@ -142,6 +142,7 @@
 extern const char *external_acl_message;      /* NULL */
 extern int opt_send_signal;	/* -1 */
 extern int opt_no_daemon; /* 0 */
+extern int opt_daemon_type; /* 0 */
 extern int opt_parse_cfg_only; /* 0 */
 
 /// current Squid process number (e.g., 4).

=== modified file 'src/ipc.cc'
--- src/ipc.cc	2013-10-25 00:13:46 +0000
+++ src/ipc.cc	2014-02-14 11:29:34 +0000
@@ -399,7 +399,7 @@
         close(x);
 
 #if HAVE_SETSID
-    if (opt_no_daemon)
+    if (opt_daemon_type == 1)
         setsid();
 #endif
 

=== modified file 'src/main.cc'
--- src/main.cc	2014-01-24 01:57:15 +0000
+++ src/main.cc	2014-02-14 11:55:14 +0000
@@ -281,7 +281,7 @@
 usage(void)
 {
     fprintf(stderr,
-            "Usage: %s [-cdhvzCFNRVYX] [-n name] [-s | -l facility] [-f config-file] [-[au] port] [-k signal]"
+            "Usage: %s [-cdhvzCFNRVYX] [-M mode] [-n name] [-s | -l facility] [-f config-file] [-[au] port] [-k signal]"
 #if USE_WIN32_SERVICE
             "[-ir] [-O CommandLine]"
 #endif
@@ -310,7 +310,14 @@
             "       -C        Do not catch fatal signals.\n"
             "       -D        OBSOLETE. Scheduled for removal.\n"
             "       -F        Don't serve any requests until store is rebuilt.\n"
-            "       -N        No daemon mode.\n"
+            "       -M mode   Operational mode for the service daemon.\n"
+            "                 Modes:\n"
+            "                   background - run as a background service with a\n"
+            "                                master process for auto-restart.\n"
+            "                                This is the default mode.\n"
+            "                   foreground - run in foreground. Rely on calling process\n"
+            "                                for error recovery on process failures.\n"
+            "       -N        Deprecated. Disables SMP support and implies '-M foreground'.\n"
 #if USE_WIN32_SERVICE
             "       -O options\n"
             "                 Set Windows Service Command line options in Registry.\n"
@@ -336,9 +343,9 @@
     int c;
 
 #if USE_WIN32_SERVICE
-    while ((c = getopt(argc, argv, "CDFNO:RSVYXa:d:f:hik:m::n:rsl:u:vz?")) != -1)
+    while ((c = getopt(argc, argv, "CDFM:NO:RSVYXa:d:f:hik:m::n:rsl:u:vz?")) != -1)
 #else
-    while ((c = getopt(argc, argv, "CDFNRSYXa:d:f:hk:m::n:sl:u:vz?")) != -1)
+    while ((c = getopt(argc, argv, "CDFM:NRSYXa:d:f:hk:m::n:sl:u:vz?")) != -1)
 #endif
     {
 
@@ -362,10 +369,26 @@
             opt_foreground_rebuild = 1;
             break;
 
+        case 'M':
+            /** \par M
+             * Set global option for daemon to run in foreground or background mode.
+             * opt_daemon_type = 0  - fork into background process
+             * opt_daemon_type = 1  - run in foreground, with SMP support.
+             */
+            if (!strcmp(optarg, "foreground"))
+                opt_daemon_type = 1;
+            else if (!strcmp(optarg, "background")) // not really needed, but accept.
+                opt_daemon_type = 0;
+            else
+                debugs(1, DBG_CRITICAL, "WARNING: Unknown commmand option '-M " << optarg << "'.");
+            break;
+
         case 'N':
             /** \par N
-             * Set global option for 'no_daemon' mode. opt_no_daemon */
+             * Set global option for 'no_daemon' mode. Disables SMP support. opt_no_daemon */
             opt_no_daemon = 1;
+            opt_daemon_type = 1;
+            debugs(1, DBG_CRITICAL, "WARNING: -N command is deprecated. Use '-M foreground' instead.");
             break;
 
 #if USE_WIN32_SERVICE
@@ -1448,7 +1471,7 @@
     ActivateRegistered(rrAfterConfig);
     enter_suid();
 
-    if (!opt_no_daemon && Config.workers > 0)
+    if (opt_daemon_type != 1 && Config.workers > 0)
         watch_child(argv);
 
     if (opt_create_swap_dirs) {
@@ -1472,6 +1495,7 @@
     comm_init();
 
     if (opt_no_daemon) {
+        // TODO: move from opt_no_daemon to a debug option.
         /* we have to init fdstat here. */
         fd_open(0, FD_LOG, "stdin");
         fd_open(1, FD_LOG, "stdout");
@@ -1924,6 +1948,7 @@
 #if !XMALLOC_TRACE
 
     if (opt_no_daemon) {
+        // TODO: move from opt_no_daemon to a debug option
         file_close(0);
         file_close(1);
         file_close(2);

=== modified file 'src/tools.cc'
--- src/tools.cc	2013-10-25 00:13:46 +0000
+++ src/tools.cc	2014-02-14 11:30:51 +0000
@@ -769,7 +769,7 @@
 bool
 InDaemonMode()
 {
-    return !opt_no_daemon && Config.workers > 0;
+    return opt_daemon_type != 1 && Config.workers > 0;
 }
 
 bool


