[pulseaudio-commits] r2430 - in /branches/glitch-free/src/pulsecore: shm.c shm.h

svnmailer-noreply at 0pointer.de svnmailer-noreply at 0pointer.de
Thu May 15 13:38:30 PDT 2008


Author: lennart
Date: Thu May 15 22:38:29 2008
New Revision: 2430

URL: http://0pointer.de/cgi-bin/viewcvs.cgi?rev=2430&root=pulseaudio&view=rev
Log:
increase shm size limit, modernizations

Modified:
    branches/glitch-free/src/pulsecore/shm.c
    branches/glitch-free/src/pulsecore/shm.h

Modified: branches/glitch-free/src/pulsecore/shm.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/branches/glitch-free/src/pulsecore/shm.c?rev=2430&root=pulseaudio&r1=2429&r2=2430&view=diff
==============================================================================
--- branches/glitch-free/src/pulsecore/shm.c (original)
+++ branches/glitch-free/src/pulsecore/shm.c Thu May 15 22:38:29 2008
@@ -57,7 +57,7 @@
 #define MADV_REMOVE 9
 #endif
 
-#define MAX_SHM_SIZE (PA_ALIGN(1024*1024*20))
+#define MAX_SHM_SIZE (PA_ALIGN(1024*1024*64))
 
 #ifdef __linux__
 /* On Linux we know that the shared memory blocks are files in
@@ -86,13 +86,13 @@
     return fn;
 }
 
-int pa_shm_create_rw(pa_shm *m, size_t size, int shared, mode_t mode) {
+int pa_shm_create_rw(pa_shm *m, size_t size, pa_bool_t shared, mode_t mode) {
     char fn[32];
     int fd = -1;
 
     pa_assert(m);
     pa_assert(size > 0);
-    pa_assert(size < MAX_SHM_SIZE);
+    pa_assert(size <= MAX_SHM_SIZE);
     pa_assert(mode >= 0600);
 
     /* Each time we create a new SHM area, let's first drop all stale
@@ -124,7 +124,7 @@
         m->ptr = pa_xmalloc(m->size);
 #endif
 
-        m->do_unlink = 0;
+        m->do_unlink = FALSE;
 
     } else {
 #ifdef HAVE_SHM_OPEN
@@ -157,7 +157,7 @@
         pa_atomic_store(&marker->marker, SHM_MARKER);
 
         pa_assert_se(close(fd) == 0);
-        m->do_unlink = 1;
+        m->do_unlink = TRUE;
 #else
         return -1;
 #endif
@@ -375,7 +375,7 @@
         /* Ok, the owner of this shms segment is dead, so, let's remove the segment */
         segment_name(fn, sizeof(fn), id);
 
-        if (shm_unlink(fn) < 0 && errno != EACCES)
+        if (shm_unlink(fn) < 0 && errno != EACCES && errno != ENOENT)
             pa_log_warn("Failed to remove SHM segment %s: %s\n", fn, pa_cstrerror(errno));
     }
 

Modified: branches/glitch-free/src/pulsecore/shm.h
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/branches/glitch-free/src/pulsecore/shm.h?rev=2430&root=pulseaudio&r1=2429&r2=2430&view=diff
==============================================================================
--- branches/glitch-free/src/pulsecore/shm.h (original)
+++ branches/glitch-free/src/pulsecore/shm.h Thu May 15 22:38:29 2008
@@ -26,15 +26,17 @@
 
 #include <sys/types.h>
 
+#include <pulsecore/macro.h>
+
 typedef struct pa_shm {
     unsigned id;
     void *ptr;
     size_t size;
-    int do_unlink;
-    int shared;
+    pa_bool_t do_unlink:1;
+    pa_bool_t shared:1;
 } pa_shm;
 
-int pa_shm_create_rw(pa_shm *m, size_t size, int shared, mode_t mode);
+int pa_shm_create_rw(pa_shm *m, size_t size, pa_bool_t shared, mode_t mode);
 int pa_shm_attach_ro(pa_shm *m, unsigned id);
 
 void pa_shm_punch(pa_shm *m, size_t offset, size_t size);




More information about the pulseaudio-commits mailing list