From de40e41446c1317104869d0b0cccb2068da3639b Mon Sep 17 00:00:00 2001 From: Diego Elio 'Flameeyes' Pettenò Date: Wed, 24 Jun 2009 22:08:41 +0200 Subject: Also alias MAP_ANONYMOUS to MAP_ANON in shm.c, for FreeBSD. --- src/pulsecore/shm.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/pulsecore') diff --git a/src/pulsecore/shm.c b/src/pulsecore/shm.c index fab2b3b6..6e428426 100644 --- a/src/pulsecore/shm.c +++ b/src/pulsecore/shm.c @@ -39,6 +39,11 @@ #include #endif +/* This is deprecated on glibc but is still used by FreeBSD */ +#if !defined(MAP_ANONYMOUS) && defined(MAP_ANON) +# define MAP_ANONYMOUS MAP_ANON +#endif + #include #include -- cgit From 9a2ac32dcd337cf3dc2293cac73756c66d7891b8 Mon Sep 17 00:00:00 2001 From: Diego Elio 'Flameeyes' Pettenò Date: Thu, 25 Jun 2009 11:50:10 +0200 Subject: Rename the wait parameter to wait_op, to avoid shadowing wait(). --- src/pulsecore/asyncq.c | 18 +++++++++--------- src/pulsecore/rtpoll.c | 8 ++++---- 2 files changed, 13 insertions(+), 13 deletions(-) (limited to 'src/pulsecore') diff --git a/src/pulsecore/asyncq.c b/src/pulsecore/asyncq.c index 67f661fe..072ef02c 100644 --- a/src/pulsecore/asyncq.c +++ b/src/pulsecore/asyncq.c @@ -131,7 +131,7 @@ void pa_asyncq_free(pa_asyncq *l, pa_free_cb_t free_cb) { pa_xfree(l); } -static int push(pa_asyncq*l, void *p, pa_bool_t wait) { +static int push(pa_asyncq*l, void *p, pa_bool_t wait_op) { unsigned idx; pa_atomic_ptr_t *cells; @@ -145,7 +145,7 @@ static int push(pa_asyncq*l, void *p, pa_bool_t wait) { if (!pa_atomic_ptr_cmpxchg(&cells[idx], NULL, p)) { - if (!wait) + if (!wait_op) return -1; /* pa_log("sleeping on push"); */ @@ -163,14 +163,14 @@ static int push(pa_asyncq*l, void *p, pa_bool_t wait) { return 0; } -static pa_bool_t flush_postq(pa_asyncq *l, pa_bool_t wait) { +static pa_bool_t flush_postq(pa_asyncq *l, pa_bool_t wait_op) { struct localq *q; pa_assert(l); while ((q = l->last_localq)) { - if (push(l, q->data, wait) < 0) + if (push(l, q->data, wait_op) < 0) return FALSE; l->last_localq = q->prev; @@ -184,13 +184,13 @@ static pa_bool_t flush_postq(pa_asyncq *l, pa_bool_t wait) { return TRUE; } -int pa_asyncq_push(pa_asyncq*l, void *p, pa_bool_t wait) { +int pa_asyncq_push(pa_asyncq*l, void *p, pa_bool_t wait_op) { pa_assert(l); - if (!flush_postq(l, wait)) + if (!flush_postq(l, wait_op)) return -1; - return push(l, p, wait); + return push(l, p, wait_op); } void pa_asyncq_post(pa_asyncq*l, void *p) { @@ -221,7 +221,7 @@ void pa_asyncq_post(pa_asyncq*l, void *p) { return; } -void* pa_asyncq_pop(pa_asyncq*l, pa_bool_t wait) { +void* pa_asyncq_pop(pa_asyncq*l, pa_bool_t wait_op) { unsigned idx; void *ret; pa_atomic_ptr_t *cells; @@ -235,7 +235,7 @@ void* pa_asyncq_pop(pa_asyncq*l, pa_bool_t wait) { if (!(ret = pa_atomic_ptr_load(&cells[idx]))) { - if (!wait) + if (!wait_op) return NULL; /* pa_log("sleeping on pop"); */ diff --git a/src/pulsecore/rtpoll.c b/src/pulsecore/rtpoll.c index 5cbec321..42708a8a 100644 --- a/src/pulsecore/rtpoll.c +++ b/src/pulsecore/rtpoll.c @@ -220,7 +220,7 @@ static void reset_all_revents(pa_rtpoll *p) { } } -int pa_rtpoll_run(pa_rtpoll *p, pa_bool_t wait) { +int pa_rtpoll_run(pa_rtpoll *p, pa_bool_t wait_op) { pa_rtpoll_item *i; int r = 0; struct timeval timeout; @@ -289,7 +289,7 @@ int pa_rtpoll_run(pa_rtpoll *p, pa_bool_t wait) { memset(&timeout, 0, sizeof(timeout)); /* Calculate timeout */ - if (wait && !p->quit && p->timer_enabled) { + if (wait_op && !p->quit && p->timer_enabled) { struct timeval now; pa_rtclock_get(&now); @@ -311,10 +311,10 @@ int pa_rtpoll_run(pa_rtpoll *p, pa_bool_t wait) { struct timespec ts; ts.tv_sec = timeout.tv_sec; ts.tv_nsec = timeout.tv_usec * 1000; - r = ppoll(p->pollfd, p->n_pollfd_used, (!wait || p->quit || p->timer_enabled) ? &ts : NULL, NULL); + r = ppoll(p->pollfd, p->n_pollfd_used, (!wait_op || p->quit || p->timer_enabled) ? &ts : NULL, NULL); } #else - r = poll(p->pollfd, p->n_pollfd_used, (!wait || p->quit || p->timer_enabled) ? (int) ((timeout.tv_sec*1000) + (timeout.tv_usec / 1000)) : -1); + r = poll(p->pollfd, p->n_pollfd_used, (!wait_op || p->quit || p->timer_enabled) ? (int) ((timeout.tv_sec*1000) + (timeout.tv_usec / 1000)) : -1); #endif #ifdef DEBUG_TIMING -- cgit From 6f447928066626e747df8f32485e71c393119a79 Mon Sep 17 00:00:00 2001 From: Diego Elio 'Flameeyes' Pettenò Date: Thu, 25 Jun 2009 12:07:12 +0200 Subject: Only declare saved_errno when it's going to be used (on Linux). --- src/pulsecore/core-util.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src/pulsecore') diff --git a/src/pulsecore/core-util.c b/src/pulsecore/core-util.c index 4550344f..6c94a71d 100644 --- a/src/pulsecore/core-util.c +++ b/src/pulsecore/core-util.c @@ -2238,10 +2238,9 @@ int pa_close_all(int except_fd, ...) { int pa_close_allv(const int except_fds[]) { struct rlimit rl; int maxfd, fd; - int saved_errno; #ifdef __linux__ - + int saved_errno; DIR *d; if ((d = opendir("/proc/self/fd"))) { -- cgit From bce211e41687f234f8c03fd6e4fd7490a0e0b7e2 Mon Sep 17 00:00:00 2001 From: Diego Elio 'Flameeyes' Pettenò Date: Thu, 25 Jun 2009 12:28:16 +0200 Subject: Rename the flock variable to f_lock. flock() is a function on FreeBSD, and the variable shadowed its definition. --- src/pulsecore/core-util.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'src/pulsecore') diff --git a/src/pulsecore/core-util.c b/src/pulsecore/core-util.c index 6c94a71d..95111420 100644 --- a/src/pulsecore/core-util.c +++ b/src/pulsecore/core-util.c @@ -1193,22 +1193,22 @@ int pa_check_in_group(gid_t g) { (advisory on UNIX, mandatory on Windows) */ int pa_lock_fd(int fd, int b) { #ifdef F_SETLKW - struct flock flock; + struct flock f_lock; /* Try a R/W lock first */ - flock.l_type = (short) (b ? F_WRLCK : F_UNLCK); - flock.l_whence = SEEK_SET; - flock.l_start = 0; - flock.l_len = 0; + f_lock.l_type = (short) (b ? F_WRLCK : F_UNLCK); + f_lock.l_whence = SEEK_SET; + f_lock.l_start = 0; + f_lock.l_len = 0; - if (fcntl(fd, F_SETLKW, &flock) >= 0) + if (fcntl(fd, F_SETLKW, &f_lock) >= 0) return 0; /* Perhaps the file descriptor qas opened for read only, than try again with a read lock. */ if (b && errno == EBADF) { - flock.l_type = F_RDLCK; - if (fcntl(fd, F_SETLKW, &flock) >= 0) + f_lock.l_type = F_RDLCK; + if (fcntl(fd, F_SETLKW, &f_lock) >= 0) return 0; } -- cgit From 1ca76031092ab07682843fd70607696f6af7216f Mon Sep 17 00:00:00 2001 From: Diego Elio 'Flameeyes' Pettenò Date: Thu, 25 Jun 2009 12:39:09 +0200 Subject: Add missing headers includes for FreeBSD. This removes the implicit declarations of send() and pthread_sigmask(). --- src/pulsecore/core-util.c | 1 + 1 file changed, 1 insertion(+) (limited to 'src/pulsecore') diff --git a/src/pulsecore/core-util.c b/src/pulsecore/core-util.c index 95111420..04e7eb24 100644 --- a/src/pulsecore/core-util.c +++ b/src/pulsecore/core-util.c @@ -43,6 +43,7 @@ #include #include #include +#include #ifdef HAVE_STRTOF_L #include -- cgit