summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/pulsecore/shm.c12
-rw-r--r--src/pulsecore/shm.h8
2 files changed, 11 insertions, 9 deletions
diff --git a/src/pulsecore/shm.c b/src/pulsecore/shm.c
index a1bbf609..a6843819 100644
--- a/src/pulsecore/shm.c
+++ b/src/pulsecore/shm.c
@@ -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 @@ static char *segment_name(char *fn, size_t l, unsigned id) {
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 @@ int pa_shm_create_rw(pa_shm *m, size_t size, int shared, mode_t mode) {
m->ptr = pa_xmalloc(m->size);
#endif
- m->do_unlink = 0;
+ m->do_unlink = FALSE;
} else {
#ifdef HAVE_SHM_OPEN
@@ -157,7 +157,7 @@ int pa_shm_create_rw(pa_shm *m, size_t size, int shared, mode_t mode) {
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 @@ int pa_shm_cleanup(void) {
/* 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));
}
diff --git a/src/pulsecore/shm.h b/src/pulsecore/shm.h
index 270591de..60bc355f 100644
--- a/src/pulsecore/shm.h
+++ b/src/pulsecore/shm.h
@@ -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);