mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-04 13:29:59 -05:00
Handle when the platform doesn't have UNIX sockets.
git-svn-id: file:///home/lennart/svn/public/pulseaudio/branches/ossman@377 fefdeb5f-60dc-0310-8127-8f9354f1896f
This commit is contained in:
parent
3a3b4aff37
commit
13496bb73e
3 changed files with 47 additions and 3 deletions
|
|
@ -31,10 +31,14 @@
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <sys/un.h>
|
|
||||||
#include <netinet/in.h>
|
#include <netinet/in.h>
|
||||||
#include <arpa/inet.h>
|
#include <arpa/inet.h>
|
||||||
#include <netdb.h>
|
#include <netdb.h>
|
||||||
|
|
||||||
|
#ifdef HAVE_SYS_UN_H
|
||||||
|
#include <sys/un.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_LIBASYNCNS
|
#ifdef HAVE_LIBASYNCNS
|
||||||
#include <asyncns.h>
|
#include <asyncns.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -198,6 +202,8 @@ struct pa_socket_client* pa_socket_client_new_ipv4(struct pa_mainloop_api *m, ui
|
||||||
return pa_socket_client_new_sockaddr(m, (struct sockaddr*) &sa, sizeof(sa));
|
return pa_socket_client_new_sockaddr(m, (struct sockaddr*) &sa, sizeof(sa));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef HAVE_SYS_UN_H
|
||||||
|
|
||||||
struct pa_socket_client* pa_socket_client_new_unix(struct pa_mainloop_api *m, const char *filename) {
|
struct pa_socket_client* pa_socket_client_new_unix(struct pa_mainloop_api *m, const char *filename) {
|
||||||
struct sockaddr_un sa;
|
struct sockaddr_un sa;
|
||||||
assert(m && filename);
|
assert(m && filename);
|
||||||
|
|
@ -210,6 +216,14 @@ struct pa_socket_client* pa_socket_client_new_unix(struct pa_mainloop_api *m, co
|
||||||
return pa_socket_client_new_sockaddr(m, (struct sockaddr*) &sa, sizeof(sa));
|
return pa_socket_client_new_sockaddr(m, (struct sockaddr*) &sa, sizeof(sa));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#else /* HAVE_SYS_UN_H */
|
||||||
|
|
||||||
|
struct pa_socket_client* pa_socket_client_new_unix(struct pa_mainloop_api *m, const char *filename) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* HAVE_SYS_UN_H */
|
||||||
|
|
||||||
static int sockaddr_prepare(struct pa_socket_client *c, const struct sockaddr *sa, size_t salen) {
|
static int sockaddr_prepare(struct pa_socket_client *c, const struct sockaddr *sa, size_t salen) {
|
||||||
assert(c);
|
assert(c);
|
||||||
assert(sa);
|
assert(sa);
|
||||||
|
|
|
||||||
|
|
@ -31,10 +31,13 @@
|
||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <sys/un.h>
|
|
||||||
#include <netinet/in.h>
|
#include <netinet/in.h>
|
||||||
#include <arpa/inet.h>
|
#include <arpa/inet.h>
|
||||||
|
|
||||||
|
#ifdef HAVE_SYS_UN_H
|
||||||
|
#include <sys/un.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_LIBWRAP
|
#ifdef HAVE_LIBWRAP
|
||||||
#include <tcpd.h>
|
#include <tcpd.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -137,6 +140,8 @@ struct pa_socket_server* pa_socket_server_ref(struct pa_socket_server *s) {
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef HAVE_SYS_UN_H
|
||||||
|
|
||||||
struct pa_socket_server* pa_socket_server_new_unix(struct pa_mainloop_api *m, const char *filename) {
|
struct pa_socket_server* pa_socket_server_new_unix(struct pa_mainloop_api *m, const char *filename) {
|
||||||
int fd = -1;
|
int fd = -1;
|
||||||
struct sockaddr_un sa;
|
struct sockaddr_un sa;
|
||||||
|
|
@ -182,6 +187,14 @@ fail:
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#else /* HAVE_SYS_UN_H */
|
||||||
|
|
||||||
|
struct pa_socket_server* pa_socket_server_new_unix(struct pa_mainloop_api *m, const char *filename) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* HAVE_SYS_UN_H */
|
||||||
|
|
||||||
struct pa_socket_server* pa_socket_server_new_ipv4(struct pa_mainloop_api *m, uint32_t address, uint16_t port, const char *tcpwrap_service) {
|
struct pa_socket_server* pa_socket_server_new_ipv4(struct pa_mainloop_api *m, uint32_t address, uint16_t port, const char *tcpwrap_service) {
|
||||||
struct pa_socket_server *ss;
|
struct pa_socket_server *ss;
|
||||||
int fd = -1;
|
int fd = -1;
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,6 @@
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/un.h>
|
|
||||||
#include <netinet/in.h>
|
#include <netinet/in.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
@ -42,6 +41,10 @@
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <netdb.h>
|
#include <netdb.h>
|
||||||
|
|
||||||
|
#ifdef HAVE_SYS_UN_H
|
||||||
|
#include <sys/un.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "socket-util.h"
|
#include "socket-util.h"
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
#include "xmalloc.h"
|
#include "xmalloc.h"
|
||||||
|
|
@ -161,6 +164,8 @@ int pa_socket_set_sndbuf(int fd, size_t l) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef HAVE_SYS_UN_H
|
||||||
|
|
||||||
int pa_unix_socket_is_stale(const char *fn) {
|
int pa_unix_socket_is_stale(const char *fn) {
|
||||||
struct sockaddr_un sa;
|
struct sockaddr_un sa;
|
||||||
int fd = -1, ret = -1;
|
int fd = -1, ret = -1;
|
||||||
|
|
@ -202,3 +207,15 @@ int pa_unix_socket_remove_stale(const char *fn) {
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#else /* HAVE_SYS_UN_H */
|
||||||
|
|
||||||
|
int pa_unix_socket_is_stale(const char *fn) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
int pa_unix_socket_remove_stale(const char *fn) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* HAVE_SYS_UN_H */
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue