[vlc-commits] access_shm: use HAVE_SYS_SHM_H

Rémi Denis-Courmont git at videolan.org
Sun Jun 12 18:18:08 CEST 2011


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sun Jun 12 19:17:32 2011 +0300| [25214cb33cc0fdb196fe3f92568ce7c5ff4f9d09] | committer: Rémi Denis-Courmont

access_shm: use HAVE_SYS_SHM_H

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=25214cb33cc0fdb196fe3f92568ce7c5ff4f9d09
---

 modules/access/shm.c |   18 ++++++++++++++----
 1 files changed, 14 insertions(+), 4 deletions(-)

diff --git a/modules/access/shm.c b/modules/access/shm.c
index f98746d..97c5aca 100644
--- a/modules/access/shm.c
+++ b/modules/access/shm.c
@@ -26,8 +26,10 @@
 
 #include <stdarg.h>
 #include <fcntl.h>
-#include <sys/ipc.h>
-#include <sys/shm.h>
+#ifdef HAVE_SYS_SHM_H
+# include <sys/ipc.h>
+# include <sys/shm.h>
+#endif
 #include <sys/mman.h>
 
 #include <vlc_common.h>
@@ -105,16 +107,19 @@ vlc_module_begin ()
      * memory location via an unsafe variable rather than the URL. */
     add_string ("shm-file", NULL, FILE_TEXT, FILE_LONGTEXT, false)
         change_volatile ()
+#ifdef HAVE_SYS_SHM_H
     add_integer ("shm-id", (int64_t)IPC_PRIVATE, ID_TEXT, ID_LONGTEXT, false)
         change_volatile ()
-
+#endif
     add_shortcut ("shm")
 vlc_module_end ()
 
 static void Demux (void *);
 static int Control (demux_t *, int, va_list);
 static void map_detach (demux_sys_t *);
+#ifdef HAVE_SYS_SHM_H
 static void sysv_detach (demux_sys_t *);
+#endif
 static void no_detach (demux_sys_t *);
 
 struct demux_sys_t
@@ -198,6 +203,7 @@ static int Open (vlc_object_t *obj)
     }
     else
     {
+#ifdef HAVE_SYS_SHM_H
         int id = var_InheritInteger (demux, "shm-id");
         if (id == IPC_PRIVATE)
             goto error;
@@ -210,6 +216,9 @@ static int Open (vlc_object_t *obj)
         }
         sys->addr = mem;
         sys->detach = sysv_detach;
+#else
+        goto error;
+#endif
     }
 
     /* Initializes format */
@@ -274,11 +283,12 @@ static void map_detach (demux_sys_t *sys)
     munmap ((void *)sys->addr, sys->length);
 }
 
-
+#ifdef HAVE_SYS_SHM_H
 static void sysv_detach (demux_sys_t *sys)
 {
     shmdt (sys->addr);
 }
+#endif
 
 static void no_detach (demux_sys_t *sys)
 {



More information about the vlc-commits mailing list