summaryrefslogtreecommitdiffstats
path: root/src/pulse
diff options
context:
space:
mode:
authorColin Guthrie <cguthrie@mandriva.org>2011-02-25 09:24:07 +0000
committerColin Guthrie <cguthrie@mandriva.org>2011-02-25 09:24:07 +0000
commita3dbdb044656e2f3ab9c7ae54fe74b9669155f2d (patch)
treed033464ab41e36f04763235160f1024afa0438b7 /src/pulse
parentf51889c6f64f11221caba3615bf779fc19d0dd15 (diff)
parent821562b9bc8d1a9033daaae0fd5373498a085054 (diff)
Merge remote-tracking branch 'mkbosmans/mingw32-build'
Diffstat (limited to 'src/pulse')
-rw-r--r--src/pulse/context.c12
-rw-r--r--src/pulse/def.h1
-rw-r--r--src/pulse/mainloop-api.h1
-rw-r--r--src/pulse/mainloop.c2
-rw-r--r--src/pulse/rtclock.c2
-rw-r--r--src/pulse/thread-mainloop.c9
-rw-r--r--src/pulse/timeval.c16
-rw-r--r--src/pulse/util.c30
8 files changed, 31 insertions, 42 deletions
diff --git a/src/pulse/context.c b/src/pulse/context.c
index 7a539b4d..8f632b5d 100644
--- a/src/pulse/context.c
+++ b/src/pulse/context.c
@@ -39,9 +39,6 @@
#include <sys/wait.h>
#endif
-#ifdef HAVE_SYS_SOCKET_H
-#include <sys/socket.h>
-#endif
#ifdef HAVE_SYS_UN_H
#include <sys/un.h>
#endif
@@ -57,9 +54,7 @@
#include <pulse/mainloop.h>
#include <pulse/timeval.h>
-#include <pulsecore/winsock.h>
#include <pulsecore/core-error.h>
-
#include <pulsecore/native-common.h>
#include <pulsecore/pdispatch.h>
#include <pulsecore/pstream.h>
@@ -69,6 +64,7 @@
#include <pulsecore/core-rtclock.h>
#include <pulsecore/core-util.h>
#include <pulsecore/log.h>
+#include <pulsecore/socket.h>
#include <pulsecore/socket-util.h>
#include <pulsecore/creds.h>
#include <pulsecore/macro.h>
@@ -589,10 +585,12 @@ static char *get_old_legacy_runtime_dir(void) {
return NULL;
}
+#ifdef HAVE_GETUID
if (st.st_uid != getuid()) {
pa_xfree(p);
return NULL;
}
+#endif
return p;
}
@@ -611,10 +609,12 @@ static char *get_very_old_legacy_runtime_dir(void) {
return NULL;
}
+#ifdef HAVE_GETUID
if (st.st_uid != getuid()) {
pa_xfree(p);
return NULL;
}
+#endif
return p;
}
@@ -1001,6 +1001,7 @@ int pa_context_connect(
/* Set up autospawning */
if (!(flags & PA_CONTEXT_NOAUTOSPAWN) && c->conf->autospawn) {
+#ifdef HAVE_GETUID
if (getuid() == 0)
pa_log_debug("Not doing autospawn since we are root.");
else {
@@ -1009,6 +1010,7 @@ int pa_context_connect(
if (api)
c->spawn_api = *api;
}
+#endif
}
pa_context_set_state(c, PA_CONTEXT_CONNECTING);
diff --git a/src/pulse/def.h b/src/pulse/def.h
index 4a8da137..ac4ae538 100644
--- a/src/pulse/def.h
+++ b/src/pulse/def.h
@@ -25,7 +25,6 @@
#include <inttypes.h>
#include <sys/time.h>
-#include <time.h>
#include <pulse/cdecl.h>
#include <pulse/sample.h>
diff --git a/src/pulse/mainloop-api.h b/src/pulse/mainloop-api.h
index aa0d5e73..0ce2219b 100644
--- a/src/pulse/mainloop-api.h
+++ b/src/pulse/mainloop-api.h
@@ -24,7 +24,6 @@
***/
#include <sys/time.h>
-#include <time.h>
#include <pulse/cdecl.h>
#include <pulse/sample.h>
diff --git a/src/pulse/mainloop.c b/src/pulse/mainloop.c
index 8f743ec7..8c261381 100644
--- a/src/pulse/mainloop.c
+++ b/src/pulse/mainloop.c
@@ -47,7 +47,7 @@
#include <pulsecore/llist.h>
#include <pulsecore/log.h>
#include <pulsecore/core-error.h>
-#include <pulsecore/winsock.h>
+#include <pulsecore/socket.h>
#include <pulsecore/macro.h>
#include "mainloop.h"
diff --git a/src/pulse/rtclock.c b/src/pulse/rtclock.c
index 49ff6aae..baa0f3a5 100644
--- a/src/pulse/rtclock.c
+++ b/src/pulse/rtclock.c
@@ -23,10 +23,10 @@
#include <config.h>
#endif
+#include <pulse/timeval.h>
#include <pulsecore/core-rtclock.h>
#include "rtclock.h"
-#include "timeval.h"
pa_usec_t pa_rtclock_now(void) {
struct timeval tv;
diff --git a/src/pulse/thread-mainloop.c b/src/pulse/thread-mainloop.c
index c3cf49c4..ef4ef56e 100644
--- a/src/pulse/thread-mainloop.c
+++ b/src/pulse/thread-mainloop.c
@@ -31,12 +31,6 @@
#include <signal.h>
#include <stdio.h>
-#ifdef HAVE_POLL_H
-#include <poll.h>
-#else
-#include <pulsecore/poll.h>
-#endif
-
#include <pulse/xmalloc.h>
#include <pulse/mainloop.h>
#include <pulse/i18n.h>
@@ -46,6 +40,7 @@
#include <pulsecore/thread.h>
#include <pulsecore/mutex.h>
#include <pulsecore/macro.h>
+#include <pulsecore/poll.h>
#include "thread-mainloop.h"
@@ -72,7 +67,7 @@ static int poll_func(struct pollfd *ufds, unsigned long nfds, int timeout, void
* avahi_simple_poll_quit() can succeed from another thread. */
pa_mutex_unlock(mutex);
- r = poll(ufds, nfds, timeout);
+ r = pa_poll(ufds, nfds, timeout);
pa_mutex_lock(mutex);
return r;
diff --git a/src/pulse/timeval.c b/src/pulse/timeval.c
index cde4417c..10ba322f 100644
--- a/src/pulse/timeval.c
+++ b/src/pulse/timeval.c
@@ -31,36 +31,28 @@
#include <windows.h>
#endif
-#include <pulsecore/winsock.h>
#include <pulsecore/macro.h>
#include <pulsecore/core-util.h>
#include "timeval.h"
struct timeval *pa_gettimeofday(struct timeval *tv) {
-#ifdef HAVE_GETTIMEOFDAY
pa_assert(tv);
- pa_assert_se(gettimeofday(tv, NULL) == 0);
- return tv;
-#elif defined(OS_IS_WIN32)
+#if defined(OS_IS_WIN32)
/*
* Copied from implementation by Steven Edwards (LGPL).
* Found on wine mailing list.
*/
-
#if defined(_MSC_VER) || defined(__BORLANDC__)
#define EPOCHFILETIME (116444736000000000i64)
#else
#define EPOCHFILETIME (116444736000000000LL)
#endif
-
FILETIME ft;
LARGE_INTEGER li;
int64_t t;
- pa_assert(tv);
-
GetSystemTimeAsFileTime(&ft);
li.LowPart = ft.dwLowDateTime;
li.HighPart = ft.dwHighDateTime;
@@ -69,11 +61,13 @@ struct timeval *pa_gettimeofday(struct timeval *tv) {
t /= 10; /* In microseconds */
tv->tv_sec = (time_t) (t / PA_USEC_PER_SEC);
tv->tv_usec = (suseconds_t) (t % PA_USEC_PER_SEC);
-
- return tv;
+#elif defined(HAVE_GETTIMEOFDAY)
+ pa_assert_se(gettimeofday(tv, NULL) == 0);
#else
#error "Platform lacks gettimeofday() or equivalent function."
#endif
+
+ return tv;
}
pa_usec_t pa_timeval_diff(const struct timeval *a, const struct timeval *b) {
diff --git a/src/pulse/util.c b/src/pulse/util.c
index ca766dab..c5cfc8ca 100644
--- a/src/pulse/util.c
+++ b/src/pulse/util.c
@@ -37,10 +37,6 @@
#include <pwd.h>
#endif
-#ifdef HAVE_SYS_SOCKET_H
-#include <sys/socket.h>
-#endif
-
#ifdef HAVE_NETDB_H
#include <netdb.h>
#endif
@@ -56,7 +52,7 @@
#include <pulse/xmalloc.h>
#include <pulse/timeval.h>
-#include <pulsecore/winsock.h>
+#include <pulsecore/socket.h>
#include <pulsecore/core-error.h>
#include <pulsecore/log.h>
#include <pulsecore/core-util.h>
@@ -79,11 +75,15 @@ char *pa_get_user_name(char *s, size_t l) {
pa_assert(s);
pa_assert(l > 0);
- if ((p = (getuid() == 0 ? "root" : NULL)) ||
- (p = getenv("USER")) ||
- (p = getenv("LOGNAME")) ||
- (p = getenv("USERNAME")))
- {
+ p = NULL;
+#ifdef HAVE_GETUID
+ p = getuid() == 0 ? "root" : NULL;
+#endif
+ if (!p) p = getenv("USER");
+ if (!p) p = getenv("LOGNAME");
+ if (!p) p = getenv("USERNAME");
+
+ if (p) {
name = pa_strlcpy(s, p, l);
} else {
#ifdef HAVE_PWD_H
@@ -195,11 +195,11 @@ char *pa_get_binary_name(char *s, size_t l) {
{
char *rp;
- if ((rp = pa_readlink("/proc/curproc/file"))) {
- pa_strlcpy(s, pa_path_get_filename(rp), l);
- pa_xfree(rp);
- return s;
- }
+ if ((rp = pa_readlink("/proc/curproc/file"))) {
+ pa_strlcpy(s, pa_path_get_filename(rp), l);
+ pa_xfree(rp);
+ return s;
+ }
}
#endif