[pulseaudio-commits] [Git][pulseaudio/pulseaudio][master] 7 commits: win32: Handle (WSA)EWOULDBLOCK as EAGAIN.
PulseAudio Marge Bot
gitlab at gitlab.freedesktop.org
Wed Dec 16 23:58:04 UTC 2020
PulseAudio Marge Bot pushed to branch master at PulseAudio / pulseaudio
Commits:
9c774c62 by Edward Lee at 2020-12-16T11:05:28-05:00
win32: Handle (WSA)EWOULDBLOCK as EAGAIN.
Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/360>
- - - - -
68cb06b5 by Edward Lee at 2020-12-16T11:05:28-05:00
win32: Fix (interim) esound paths in module-protocol-stub.c
Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/360>
- - - - -
4e5786ff by Edward Lee at 2020-12-16T11:05:28-05:00
win32: Check WSAGetLastError() in pa_is_unix_socket_stale.
Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/360>
- - - - -
4b3cc2df by Edward Lee at 2020-12-16T11:05:28-05:00
win32: (Temporarily) Add sockaddr_un definition from <afunix.h>
This is a temporary addition, until <afunix.h> ships with the
MinGW toolchain.
Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/360>
- - - - -
3c51930b by Edward Lee at 2020-12-16T11:05:28-05:00
win32: Add support for Unix sockets in autoconf build.
Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/360>
- - - - -
7bc559fe by Edward Lee at 2020-12-16T11:05:28-05:00
win32: Change linkage of lt_preloaded_symbols to match definition in libtool in daemon/main.c.
Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/360>
- - - - -
b892e327 by Edward Lee at 2020-12-16T11:05:28-05:00
win32: Fix meson build system for Windows.
Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/360>
- - - - -
14 changed files:
- configure.ac
- meson.build
- src/Makefile.am
- src/daemon/main.c
- src/daemon/meson.build
- src/meson.build
- src/modules/meson.build
- src/modules/module-protocol-stub.c
- src/pulse/meson.build
- src/pulsecore/core-util.c
- src/pulsecore/meson.build
- src/pulsecore/socket-util.c
- src/pulsecore/socket.h
- src/utils/meson.build
Changes:
=====================================
configure.ac
=====================================
@@ -434,6 +434,9 @@ AC_CHECK_HEADERS([netinet/ip.h], [], [],
AC_CHECK_HEADERS([sys/resource.h], [HAVE_SYS_RESOURCE_H=1], [HAVE_SYS_RESOURCE_H=0])
AC_SUBST(HAVE_SYS_RESOURCE_H)
AC_CHECK_HEADERS([sys/un.h], [HAVE_AF_UNIX=1], [HAVE_AF_UNIX=0])
+# In principle we would test for <afunix.h>, but that doesn't ship (yet) with the
+# MinGW headers.
+AC_CHECK_HEADERS([winsock2.h], [HAVE_AF_UNIX=1], [])
AM_CONDITIONAL(HAVE_AF_UNIX, test "x$HAVE_AF_UNIX" = "x1")
AC_SUBST(HAVE_AF_UNIX)
=====================================
meson.build
=====================================
@@ -158,6 +158,10 @@ cdata.set('top_srcdir', meson.source_root())
# First some defaults to keep config file generation happy
cdata.set('HAVE_COREAUDIO', 0)
cdata.set('HAVE_WAVEOUT', 0)
+
+platform_socket_dep = []
+platform_dep = []
+
# FIXME: This was not tested. Maybe some flags should better be CFLAGS,
# rather than ending up in the config.h file?
if host_machine.system() == 'darwin'
@@ -165,7 +169,20 @@ if host_machine.system() == 'darwin'
cdata.set('_DARWIN_C_SOURCE', '200112L') # Needed to get NSIG on Mac OS
elif host_machine.system() == 'windows'
cdata.set('OS_IS_WIN32', 1)
+ cdata.set('HAVE_WINDOWS_H', 1)
+ cdata.set('HAVE_WAVEOUT', 1)
+ cdata.set('HAVE_WINSOCK2_H', 1)
+ cdata.set('HAVE_WS2TCPIP_H', 1)
cdata.set('WIN32_LEAN_AND_MEAN', 1) # Needed to avoid including unnecessary headers on Windows
+ cdata.set('gid_t', 'int')
+ cdata.set('uid_t', 'int')
+ ws2_32_dep = meson.get_compiler('c').find_library('ws2_32')
+ winsock_dep = meson.get_compiler('c').find_library('wsock32')
+ ole32_dep = meson.get_compiler('c').find_library('ole32')
+ ssp_dep = meson.get_compiler('c').find_library('ssp')
+ pcreposix_dep = meson.get_compiler('c').find_library('pcreposix')
+ platform_socket_dep = [ws2_32_dep, winsock_dep]
+ platform_dep = [ole32_dep, ssp_dep, pcreposix_dep]
#elif host_machine.system() == 'solaris'
# # Apparently meson has no solaris support?
# # Needed to get declarations for msg_control and msg_controllen on Solaris
@@ -236,8 +253,10 @@ if cc.has_header('valgrind/memcheck.h', required: get_option('valgrind'))
endif
# FIXME: move this to the above set
-if cc.has_header('pthread.h')
- cdata.set('HAVE_PTHREAD', 1)
+if host_machine.system() != 'windows'
+ if cc.has_header('pthread.h')
+ cdata.set('HAVE_PTHREAD', 1)
+ endif
endif
if cc.has_header_symbol('pthread.h', 'PTHREAD_PRIO_INHERIT')
@@ -297,7 +316,16 @@ check_functions = [
foreach f : check_functions
if cc.has_function(f)
define = 'HAVE_' + f.underscorify().to_upper()
- cdata.set(define, 1)
+
+ if f == 'posix_memalign' and host_machine.system() == 'windows'
+ message('Win32/mingw32 does not properly define posix_memalign.')
+ elif f == 'fork' and host_machine.system() == 'windows'
+ # __builtin_fork is defined and compiles properly, but calling __builtin_fork() does not.
+ # This causes Meson to think that Windows has a fork() which causes a link error...
+ message('Win32/mingw32 does not properly define fork.')
+ else
+ cdata.set(define, 1)
+ endif
endif
endforeach
@@ -306,7 +334,11 @@ if cc.has_header_symbol('sys/syscall.h', 'SYS_memfd_create')
endif
if cc.has_function('dgettext')
- libintl_dep = []
+ if host_machine.system() != 'windows'
+ libintl_dep = []
+ else
+ libintl_dep = cc.find_library('intl')
+ endif
else
libintl_dep = cc.find_library('intl')
endif
@@ -357,7 +389,12 @@ cdata.set('MESON_BUILD', 1)
# On ELF systems we don't want the libraries to be unloaded since we don't clean them up properly,
# so we request the nodelete flag to be enabled.
# On other systems, we don't really know how to do that, but it's welcome if somebody can tell.
-nodelete_link_args = ['-Wl,-z,nodelete']
+# Windows doesn't support this flag.
+if host_machine.system() != 'windows'
+ nodelete_link_args = ['-Wl,-z,nodelete']
+else
+ nodelete_link_args = []
+endif
# Code coverage
=====================================
src/Makefile.am
=====================================
@@ -206,8 +206,11 @@ bin_PROGRAMS += pasuspender
endif
if HAVE_AF_UNIX
+if !OS_IS_WIN32
+# pacmd relies on Unix signals, which are not present on Windows.
bin_PROGRAMS += pacmd
endif
+endif
if HAVE_X11
bin_PROGRAMS += pax11publish
=====================================
src/daemon/main.c
=====================================
@@ -101,7 +101,7 @@
#ifdef DISABLE_LIBTOOL_PRELOAD
/* FIXME: work around a libtool bug by making sure we have 2 elements. Bug has
* been reported: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=29576 */
-const lt_dlsymlist lt_preloaded_symbols[] = {
+LT_DLSYM_CONST lt_dlsymlist lt_preloaded_symbols[] = {
{ "@PROGRAM@", NULL },
{ NULL, NULL }
};
=====================================
src/daemon/meson.build
=====================================
@@ -31,7 +31,7 @@ executable('pulseaudio',
include_directories : [configinc, topinc],
link_args : ['-ffast-math'],
link_with : [libpulsecore, libpulsecommon, libpulse],
- dependencies : [ltdl_dep, cap_dep, dbus_dep, libsystemd_dep, dl_dep, libintl_dep],
+ dependencies : [ltdl_dep, cap_dep, dbus_dep, libsystemd_dep, dl_dep, libintl_dep, platform_dep, platform_socket_dep],
c_args : pa_c_args,
)
=====================================
src/meson.build
=====================================
@@ -39,7 +39,6 @@ libpulsecommon_sources = [
'pulsecore/memblock.c',
'pulsecore/memblockq.c',
'pulsecore/memchunk.c',
- 'pulsecore/mutex-posix.c',
'pulsecore/native-common.c',
'pulsecore/once.c',
'pulsecore/packet.c',
@@ -56,7 +55,6 @@ libpulsecommon_sources = [
'pulsecore/random.c',
'pulsecore/srbchannel.c',
'pulsecore/sample-util.c',
- 'pulsecore/semaphore-posix.c',
'pulsecore/shm.c',
'pulsecore/bitset.c',
'pulsecore/socket-client.c',
@@ -65,7 +63,6 @@ libpulsecommon_sources = [
'pulsecore/strbuf.c',
'pulsecore/strlist.c',
'pulsecore/tagstruct.c',
- 'pulsecore/thread-posix.c',
'pulsecore/time-smoother.c',
'pulsecore/tokenizer.c',
'pulsecore/usergroup.c',
@@ -177,6 +174,20 @@ if x11_dep.found()
endif
# FIXME: Do non-POSIX thread things
+if host_machine.system() == 'windows'
+ libpulsecommon_sources += [
+ 'pulsecore/mutex-win32.c',
+ 'pulsecore/poll-win32.c',
+ 'pulsecore/semaphore-win32.c',
+ 'pulsecore/thread-win32.c',
+ ]
+else
+ libpulsecommon_sources += [
+ 'pulsecore/mutex-posix.c',
+ 'pulsecore/semaphore-posix.c',
+ 'pulsecore/thread-posix.c'
+ ]
+endif
# FIXME: Do SIMD things
libpulsecommon = shared_library('pulsecommon-' + pa_version_major_minor,
@@ -190,6 +201,7 @@ libpulsecommon = shared_library('pulsecommon-' + pa_version_major_minor,
dependencies : [
libm_dep, thread_dep, dl_dep, shm_dep, iconv_dep, sndfile_dep, dbus_dep,
x11_dep, libsystemd_dep, glib_dep, gtk_dep, asyncns_dep, libintl_dep,
+ platform_dep, platform_socket_dep,
],
implicit_include_directories : false)
=====================================
src/modules/meson.build
=====================================
@@ -1,4 +1,6 @@
-subdir('rtp')
+if host_machine.system() != 'windows'
+ subdir('rtp')
+endif
# module name, sources, [headers, extra flags, extra deps, extra libs]
all_modules = [
@@ -44,8 +46,6 @@ all_modules = [
[ 'module-rescue-streams', 'module-rescue-streams.c' ],
[ 'module-role-cork', ['module-role-cork.c', 'stream-interaction.c'], 'stream-interaction.h' ],
[ 'module-role-ducking', ['module-role-ducking.c', 'stream-interaction.c'], 'stream-interaction.h' ],
- [ 'module-rtp-recv', 'rtp/module-rtp-recv.c', [], [], [], librtp ],
- [ 'module-rtp-send', 'rtp/module-rtp-send.c' , [], [], [], librtp ],
[ 'module-simple-protocol-tcp', 'module-protocol-stub.c', [], ['-DUSE_PROTOCOL_SIMPLE', '-DUSE_TCP_SOCKETS'], [], libprotocol_simple ],
[ 'module-simple-protocol-unix', 'module-protocol-stub.c', [], ['-DUSE_PROTOCOL_SIMPLE', '-DUSE_UNIX_SOCKETS'], [], libprotocol_simple ],
[ 'module-sine', 'module-sine.c' ],
@@ -62,9 +62,23 @@ all_modules = [
[ 'module-virtual-sink', 'module-virtual-sink.c' ],
[ 'module-virtual-source', 'module-virtual-source.c' ],
[ 'module-volume-restore', 'module-volume-restore.c' ],
-# [ 'module-waveout', 'module-waveout.c' ],
]
+if host_machine.system() == 'windows'
+ winmm_dep = meson.get_compiler('c').find_library('winmm')
+ ksuser_dep = meson.get_compiler('c').find_library('ksuser')
+ all_modules += [
+ [ 'module-waveout', 'module-waveout.c', [], [], [winmm_dep, ksuser_dep] ],
+ ]
+endif
+
+if host_machine.system() != 'windows'
+ all_modules += [
+ [ 'module-rtp-recv', 'rtp/module-rtp-recv.c', [], [], [], librtp ],
+ [ 'module-rtp-send', 'rtp/module-rtp-send.c' , [], [], [], librtp ],
+ ]
+endif
+
# Modules enabled by headers
if cc.has_header('linux/input.h')
@@ -176,10 +190,13 @@ if lirc_dep.found()
endif
if openssl_dep.found()
- subdir('raop')
- all_modules += [
- [ 'module-raop-sink', 'raop/module-raop-sink.c', [], [], [], libraop ],
- ]
+ if host_machine.system() != 'windows'
+ subdir('raop')
+ all_modules += [
+ [ 'module-raop-sink', 'raop/module-raop-sink.c', [], [], [], libraop ],
+ ]
+ endif
+
if avahi_dep.found()
all_modules += [
[ 'module-raop-discover', 'raop/module-raop-discover.c', [], [], [avahi_dep], libavahi_wrap ],
@@ -289,7 +306,7 @@ foreach m : all_modules
install : true,
install_rpath : rpath_dirs,
install_dir : modlibexecdir,
- dependencies : [thread_dep, libpulse_dep, libpulsecommon_dep, libpulsecore_dep, libintl_dep] + extra_deps,
+ dependencies : [thread_dep, libpulse_dep, libpulsecommon_dep, libpulsecore_dep, libintl_dep, platform_dep, platform_socket_dep] + extra_deps,
link_args : [nodelete_link_args, '-Wl,--no-undefined' ],
link_with : extra_libs,
name_prefix : '',
=====================================
src/modules/module-protocol-stub.c
=====================================
@@ -300,7 +300,9 @@ int pa__init(pa_module*m) {
# if defined(USE_PROTOCOL_ESOUND)
-# if defined(USE_PER_USER_ESOUND_SOCKET)
+ /* Windows doesn't support getuid(), so we ignore the per-user Esound socket compile flag.
+ * Moreover, Esound Unix sockets haven't been supported on Windows historically. */
+# if defined(USE_PER_USER_ESOUND_SOCKET) && !defined(OS_IS_WIN32)
u->socket_path = pa_sprintf_malloc("/tmp/.esd-%lu/socket", (unsigned long) getuid());
# else
u->socket_path = pa_xstrdup("/tmp/.esd/socket");
=====================================
src/pulse/meson.build
=====================================
@@ -83,7 +83,7 @@ libpulse = shared_library('pulse',
link_args : [nodelete_link_args, versioning_link_args],
install : true,
install_rpath : privlibdir,
- dependencies : [libm_dep, thread_dep, libpulsecommon_dep, dbus_dep, dl_dep, iconv_dep, libintl_dep],
+ dependencies : [libm_dep, thread_dep, libpulsecommon_dep, dbus_dep, dl_dep, iconv_dep, libintl_dep, platform_dep, platform_socket_dep],
implicit_include_directories : false)
libpulse_dep = declare_dependency(link_with: libpulse)
=====================================
src/pulsecore/core-util.c
=====================================
@@ -407,6 +407,8 @@ ssize_t pa_read(int fd, void *buf, size_t count, int *type) {
if (WSAGetLastError() != WSAENOTSOCK) {
errno = WSAGetLastError();
+ if (errno == WSAEWOULDBLOCK)
+ errno = EAGAIN;
return r;
}
@@ -448,6 +450,8 @@ ssize_t pa_write(int fd, const void *buf, size_t count, int *type) {
#ifdef OS_IS_WIN32
if (WSAGetLastError() != WSAENOTSOCK) {
errno = WSAGetLastError();
+ if (errno == WSAEWOULDBLOCK)
+ errno = EAGAIN;
return r;
}
#else
=====================================
src/pulsecore/meson.build
=====================================
@@ -182,11 +182,13 @@ libpulsecore_simd = simd.check('libpulsecore_simd',
libpulsecore_simd_lib = libpulsecore_simd[0]
cdata.merge_from(libpulsecore_simd[1])
-# FIXME: Implement Windows support
-#'mutex-win32.c',
-#'poll-win32.c',
-#'semaphore-win32.c',
-#'thread-win32.c',
+if host_machine.system() == 'windows'
+ libpulsecore_sources += ['mutex-win32.c',
+ 'poll-win32.c',
+ 'semaphore-win32.c',
+ 'thread-win32.c',
+ ]
+endif
libpulsecore = shared_library('pulsecore-' + pa_version_major_minor,
libpulsecore_sources, libpulsecore_headers,
@@ -198,7 +200,7 @@ libpulsecore = shared_library('pulsecore-' + pa_version_major_minor,
install_rpath : privlibdir,
install_dir : privlibdir,
link_with : libpulsecore_simd_lib,
- dependencies : [libm_dep, libpulsecommon_dep, ltdl_dep, shm_dep, sndfile_dep, database_dep, dbus_dep, libatomic_ops_dep, orc_dep, samplerate_dep, soxr_dep, speex_dep, x11_dep, libintl_dep],
+ dependencies : [libm_dep, libpulsecommon_dep, ltdl_dep, shm_dep, sndfile_dep, database_dep, dbus_dep, libatomic_ops_dep, orc_dep, samplerate_dep, soxr_dep, speex_dep, x11_dep, libintl_dep, platform_dep, platform_socket_dep,],
implicit_include_directories : false)
libpulsecore_dep = declare_dependency(link_with: libpulsecore)
=====================================
src/pulsecore/socket-util.c
=====================================
@@ -239,8 +239,13 @@ int pa_unix_socket_is_stale(const char *fn) {
sa.sun_path[sizeof(sa.sun_path) - 1] = 0;
if (connect(fd, (struct sockaddr*) &sa, sizeof(sa)) < 0) {
+#if !defined(OS_IS_WIN32)
if (errno == ECONNREFUSED)
ret = 1;
+#else
+ if (WSAGetLastError() == WSAECONNREFUSED)
+ ret = 1;
+#endif
} else
ret = 0;
=====================================
src/pulsecore/socket.h
=====================================
@@ -11,6 +11,31 @@
typedef long suseconds_t;
+/** Windows 10 supports AF_UNIX as of build 17603, with
+ support provided in the header file <afunix.h>. However,
+ only the latest Windows SDK provides this file; older SDKs and
+ MinGW do not.
+
+ Hence we define SOCKADDR_UN here. We do not expect this definition to change
+ as Windows has some pretty good binary backwards-compatibility guarantees.
+
+ This shouldn't pose a problem for older versions of Windows; we expect them to
+ fail with an error whenever we try to make a socket of type AF_UNIX. */
+#define UNIX_PATH_MAX 108
+
+typedef struct sockaddr_un
+{
+ ADDRESS_FAMILY sun_family; /* AF_UNIX */
+ char sun_path[UNIX_PATH_MAX]; /* pathname */
+} SOCKADDR_UN, *PSOCKADDR_UN;
+
+#ifndef SUN_LEN
+#define SUN_LEN(ptr) \
+ ((size_t)(((struct sockaddr_un *) 0)->sun_path) + strlen((ptr)->sun_path))
+#endif
+
+#define HAVE_SYS_UN_H
+
#endif
#ifdef HAVE_WS2TCPIP_H
=====================================
src/utils/meson.build
=====================================
@@ -19,12 +19,14 @@ executable('pacat',
c_args : pa_c_args,
)
-foreach alias : pacat_aliases
- # FIXME How to handle extension (.exe on windows)?
- dst = join_paths(bindir, alias)
- cmd = 'ln -fs @0@ $DESTDIR at 1@'.format('pacat', dst)
- meson.add_install_script('sh', '-c', cmd)
-endforeach
+# Windows doesn't support symbolic links.
+if host_machine.system() != 'windows'
+ foreach alias : pacat_aliases
+ dst = join_paths(bindir, alias)
+ cmd = 'ln -fs @0@ $DESTDIR at 1@'.format('pacat', dst)
+ meson.add_install_script('sh', '-c', cmd)
+ endforeach
+endif
pactl_sources = [
'pactl.c',
@@ -40,33 +42,35 @@ executable('pactl',
c_args : pa_c_args,
)
-pasuspender_sources = [
- 'pasuspender.c',
-]
+if host_machine.system() != 'windows'
+ pasuspender_sources = [
+ 'pasuspender.c',
+ ]
-executable('pasuspender',
- pasuspender_sources,
- install: true,
- install_rpath : privlibdir,
- include_directories : [configinc, topinc],
- link_with : [libpulsecommon, libpulse],
- dependencies: [libintl_dep],
- c_args : pa_c_args,
-)
+ executable('pasuspender',
+ pasuspender_sources,
+ install: true,
+ install_rpath : privlibdir,
+ include_directories : [configinc, topinc],
+ link_with : [libpulsecommon, libpulse],
+ dependencies: [libintl_dep],
+ c_args : pa_c_args,
+ )
-pacmd_sources = [
- 'pacmd.c',
-]
+ pacmd_sources = [
+ 'pacmd.c',
+ ]
-executable('pacmd',
- pacmd_sources,
- install: true,
- install_rpath : privlibdir,
- include_directories : [configinc, topinc],
- link_with : [libpulsecommon, libpulse],
- dependencies: [libintl_dep],
- c_args : pa_c_args,
-)
+ executable('pacmd',
+ pacmd_sources,
+ install: true,
+ install_rpath : privlibdir,
+ include_directories : [configinc, topinc],
+ link_with : [libpulsecommon, libpulse],
+ dependencies: [libintl_dep],
+ c_args : pa_c_args,
+ )
+endif
if x11_dep.found()
pax11publish_sources = [
View it on GitLab: https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/compare/4552fe15b3578219d7e21cb77018a5f9425cd593...b892e327a960e46ac4a377a95d274a5dc75cdf99
--
View it on GitLab: https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/compare/4552fe15b3578219d7e21cb77018a5f9425cd593...b892e327a960e46ac4a377a95d274a5dc75cdf99
You're receiving this email because of your account on gitlab.freedesktop.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/pulseaudio-commits/attachments/20201216/e70b7ddb/attachment-0001.htm>
More information about the pulseaudio-commits
mailing list