[streaming] MiniSAPserver port to Solaris 10

Saso Kiselkov <[email protected]> Sat, 28 Feb 2009 13:25:10 +0100
Newsgroups gmane.comp.video.videolan.vls.general
Message-ID <[email protected]>
Hi all,

I've created a port of minisapserver-0.3.6 to Solaris 10 (patch file 
attached). I've tested it quickly (on a sparc-sun-solaris2.10 system) 
and it appears to be functional. Unfortunatelly, since I lack detailed 
knowledge of autoconf/automake I'd like to ask somebody more skilled on 
this mailing list to do the build configuration changes. What's needed 
for a proper build on Solaris is:

 - add an AC_CHECK_HEADERS for "sys/sockio.h" (for the Solaris 
definition of SIOCGIFADDR)
 - add an AC_CHECK_FUNCTIONS for the "daemon" function (to activate the 
workaround code in sapserver.cpp on SYSV)
 - add the linker flags "-lsocket -lrt -lnsl"

I'll happily test any changes.

Cheers
--
Saso

_______________________________________________
streaming mailing list
To unsubscribe or modify your subscription options:
http://mailman.videolan.org/listinfo/streaming
sapserver-0.3.6-solaris.patch (text/x-patch, 1.7 KB)
diff -rc minisapserver-0.3.6/broadcast.cpp minisapserver-0.3.6-new/broadcast.cpp
*** minisapserver-0.3.6/broadcast.cpp	Wed Sep  3 17:08:07 2008
--- minisapserver-0.3.6-new/broadcast.cpp	Sat Feb 28 12:00:49 2009
***************
*** 25,30 ****
--- 25,33 ----
  
  #include <sys/types.h>
  #include <sys/socket.h>
+ #ifdef HAVE_SYS_SOCKIO_H
+ # include <sys/sockio.h>    /* Needed on Solaris for SIOCGIFADDR */
+ #endif
  #include <net/if.h>
  #include <netinet/in.h>
  #include <arpa/inet.h>
diff -rc minisapserver-0.3.6/sapserver.cpp minisapserver-0.3.6-new/sapserver.cpp
*** minisapserver-0.3.6/sapserver.cpp	Mon Jun 30 19:06:06 2008
--- minisapserver-0.3.6-new/sapserver.cpp	Sat Feb 28 12:02:43 2009
***************
*** 27,32 ****
--- 27,33 ----
  #ifdef HAVE_CONFIG_H
  # include "config.h"
  #endif
+ #include <fcntl.h>
  #include <inttypes.h>
  #include <sys/types.h>
  #include <sys/socket.h>
***************
*** 56,61 ****
--- 57,98 ----
      #include "lslp.h"
  #endif
  
+ #ifndef HAVE_DAEMON
+ /* daemon() is a BSD-specific function which SYSV doesn't have */
+ static int
+ daemon (int nochdir, int noclose)
+ {
+     switch (fork ())
+     {
+         case -1:
+              return -1;
+         case 0:
+              break;
+         default:
+              _exit (0);
+     }
+ 
+     if (setsid () == -1)
+         return -1;
+ 
+     if (!nochdir)
+     {
+         chdir ("/");
+     }
+ 
+     if (!noclose)
+     {
+         int nullfile = open ("/dev/null", O_RDWR);
+ 
+         dup2 (nullfile, 0);
+         dup2 (nullfile, 1);
+         dup2 (nullfile, 2);
+ 
+         close (nullfile);
+     }
+ }
+ #endif
+ 
  /*************************************************
   * Signal handler
   *************************************************/