Port to Windows. This is mostly glue layers for the poor POSIX support

on Windows. A few notes

 * Only sockets behave somewhat like file descriptors in UNIX.

 * There are no fixed paths. Closes thing is environment variables that point
   to system directories. We also figure out where the binary/dll is
   located and use that as configuration directory.


git-svn-id: file:///home/lennart/svn/public/pulseaudio/branches/ossman@418 fefdeb5f-60dc-0310-8127-8f9354f1896f
This commit is contained in:
Pierre Ossman 2006-01-05 22:51:37 +00:00
parent 2f74bb9d43
commit 19d9fcbda8
22 changed files with 712 additions and 58 deletions

View file

@ -32,6 +32,7 @@
#include <sys/stat.h>
#include <errno.h>
#include <signal.h>
#include <limits.h>
#ifdef HAVE_SYS_WAIT_H
#include <sys/wait.h>
@ -44,6 +45,13 @@
#include <netdb.h>
#endif
#ifdef HAVE_WINSOCK2_H
#include <winsock2.h>
#define ETIMEDOUT WSAETIMEDOUT
#define ECONNREFUSED WSAECONNREFUSED
#define EHOSTUNREACH WSAEHOSTUNREACH
#endif
#include "polyplib-internal.h"
#include "polyplib-context.h"
#include "native-common.h"
@ -382,6 +390,8 @@ finish:
static void on_connection(struct pa_socket_client *client, struct pa_iochannel*io, void *userdata);
#ifndef OS_IS_WIN32
static int context_connect_spawn(struct pa_context *c) {
pid_t pid;
int status, r;
@ -495,6 +505,8 @@ fail:
return -1;
}
#endif /* OS_IS_WIN32 */
static int try_next_connection(struct pa_context *c) {
char *u = NULL;
int r = -1;
@ -509,10 +521,12 @@ static int try_next_connection(struct pa_context *c) {
if (!u) {
#ifndef OS_IS_WIN32
if (c->do_autospawn) {
r = context_connect_spawn(c);
goto finish;
}
#endif
pa_context_fail(c, PA_ERROR_CONNECTIONREFUSED);
goto finish;