[xiph-cvs] cvs commit: ices/conf ices-live.xml ices-playlist.xml

Karl Heyes karl at xiph.org
Sun Dec 28 13:49:23 PST 2003



karl        03/12/28 16:49:23

  Modified:    src      ices.c
               conf     ices-live.xml ices-playlist.xml
  Log:
  ices goes into the background if enabled in the XML config. Some minor
  cleanups in the sample XML files.

Revision  Changes    Path
1.15      +32 -11    ices/src/ices.c

Index: ices.c
===================================================================
RCS file: /usr/local/cvsroot/ices/src/ices.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- ices.c	22 Dec 2003 14:01:09 -0000	1.14
+++ ices.c	28 Dec 2003 21:49:22 -0000	1.15
@@ -1,7 +1,7 @@
 /* ices.c
  * - Main startup, thread launching, and cleanup code.
  *
- * $Id: ices.c,v 1.14 2003/12/22 14:01:09 karl Exp $
+ * $Id: ices.c,v 1.15 2003/12/28 21:49:22 karl Exp $
  *
  * Copyright (c) 2001-2002 Michael Smith <msmith at labyrinth.net.au>
  *
@@ -46,23 +46,44 @@
         return 1;
     }
 
-    log_initialize();
-    thread_initialize();
     config_initialize();
-    shout_init();
-    encode_init();
-
-    signals_setup();
 
-    /* right now you must have a config file, but we should probably
-    ** make it so you can specify all parameters on the commandline
-    ** too.
-    */
     if (config_read(argv[1]) <= 0) 
     {
         fprintf(stderr, "Failed to read config file \"%s\"\n", argv[1]);
         goto fail;
     }
+    if (ices_config->background)
+    {
+        int ret = 0;
+        /* Start up new session, to lose old session and process group */
+        switch (fork())
+        {
+        case 0: break; /* child continues */
+        case -1: perror ("fork"); ret = -1;
+        default:
+            exit (ret);
+        }
+
+        /* Disassociate process group and controlling terminal */ 
+        setsid();
+
+        /* Become a NON-session leader so that a */
+        /* control terminal can't be reacquired */
+        switch (fork())
+        {
+        case 0: break; /* child continues */
+        case -1: perror ("fork"); ret = -1;
+        default:
+            exit (ret);
+        }
+    }
+    
+    log_initialize();
+    thread_initialize();
+    shout_init();
+    encode_init();
+    signals_setup();
 
     snprintf(logpath, FILENAME_MAX, "%s/%s", ices_config->logpath, 
             ices_config->logfile);

<p><p>1.8       +2 -2      ices/conf/ices-live.xml

Index: ices-live.xml
===================================================================
RCS file: /usr/local/cvsroot/ices/conf/ices-live.xml,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- ices-live.xml	21 Dec 2003 03:38:54 -0000	1.7
+++ ices-live.xml	28 Dec 2003 21:49:23 -0000	1.8
@@ -1,11 +1,11 @@
 <?xml version="1.0"?>
 <ices>
 
-	<background>0</background> <!-- run in background? (unimplemented) -->
+	<background>0</background> <!-- run in background  -->
         <logpath>/tmp</logpath> <!-- where logs, etc go. -->
         <logfile>ices.log</logfile>
         <loglevel>4</loglevel> <!-- 1=error,2=warn,3=info,4=debug -->
-    <consolelog>1</consolelog> <!-- logfile is ignored if this is set to 1 -->
+    <consolelog>0</consolelog> <!-- logfile is ignored if this is set to 1 -->
 
     <!-- optional filename to write process id to -->
     <!-- <pidfile>/home/ices/ices.pid</pidfile> -->

<p><p>1.6       +2 -2      ices/conf/ices-playlist.xml

Index: ices-playlist.xml
===================================================================
RCS file: /usr/local/cvsroot/ices/conf/ices-playlist.xml,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- ices-playlist.xml	21 Dec 2003 03:38:54 -0000	1.5
+++ ices-playlist.xml	28 Dec 2003 21:49:23 -0000	1.6
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <ices>
 
-	<background>0</background> <!-- run in background? (unimplemented) -->
+	<background>0</background> <!-- run in background -->
         <logpath>/tmp</logpath> <!-- where logs, etc go. -->
         <logfile>ices.log</logfile>
         <loglevel>4</loglevel> <!-- 1=error,2=warn,3=info,4=debug -->
@@ -28,7 +28,7 @@
                 -->
                 <input>
                         <module>playlist</module>
-			<param name="type">basic</param><!-- Only 'basic' implemented -->
+			<param name="type">basic</param>
                         <param name="file">playlist.txt</param> <!-- be sure this exists -->
                         <param name="random">0</param> <!-- random play -->
                         <param name="once">0</param> <!-- if set to 1 , plays once through,

<p><p>--- >8 ----
List archives:  http://www.xiph.org/archives/
Ogg project homepage: http://www.xiph.org/ogg/
To unsubscribe from this list, send a message to 'cvs-request at xiph.org'
containing only the word 'unsubscribe' in the body.  No subject is needed.
Unsubscribe messages sent to the list will be ignored/filtered.



More information about the commits mailing list