Merge remote-tracking branch 'mkbosmans/mingw32-build'

This commit is contained in:
Colin Guthrie 2011-02-25 09:24:07 +00:00
commit a3dbdb0446
67 changed files with 719 additions and 449 deletions

View file

@ -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);

View file

@ -25,7 +25,6 @@
#include <inttypes.h>
#include <sys/time.h>
#include <time.h>
#include <pulse/cdecl.h>
#include <pulse/sample.h>

View file

@ -24,7 +24,6 @@
***/
#include <sys/time.h>
#include <time.h>
#include <pulse/cdecl.h>
#include <pulse/sample.h>

View file

@ -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"

View file

@ -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;

View file

@ -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;

View file

@ -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) {

View file

@ -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