mirror of
https://github.com/Stichting-MINIX-Research-Foundation/pkgsrc-ng.git
synced 2025-08-03 17:59:07 -04:00
131 lines
3.5 KiB
Plaintext
131 lines
3.5 KiB
Plaintext
$NetBSD: patch-aa,v 1.14 2013/11/25 10:14:37 wiz Exp $
|
|
|
|
ioctl() takes u_long argument on NetBSD.
|
|
On NetBSD<6 and 6.99.0-6.99.7, use third parameter in ioctl instead of varargs.
|
|
stat() system call has been versioned, use latest version when dlopen()ing.
|
|
Try more typical device names.
|
|
SOUND_PCM_* is not available on SunOS.
|
|
|
|
--- src/utils/padsp.c.orig 2012-07-16 11:37:55.000000000 +0000
|
|
+++ src/utils/padsp.c
|
|
@@ -49,6 +49,9 @@
|
|
#ifdef __linux__
|
|
#include <linux/sockios.h>
|
|
#endif
|
|
+#ifdef __NetBSD__
|
|
+#include <sys/param.h>
|
|
+#endif
|
|
|
|
#include <pulse/pulseaudio.h>
|
|
#include <pulse/gccmacro.h>
|
|
@@ -115,7 +118,11 @@ static pthread_mutex_t func_mutex = PTHR
|
|
|
|
static PA_LLIST_HEAD(fd_info, fd_infos) = NULL;
|
|
|
|
+#ifdef __NetBSD__
|
|
+static int (*_ioctl)(int, u_long, void *) = NULL;
|
|
+#else
|
|
static int (*_ioctl)(int, int, void*) = NULL;
|
|
+#endif
|
|
static int (*_close)(int) = NULL;
|
|
static int (*_open)(const char *, int, mode_t) = NULL;
|
|
static int (*___open_2)(const char *, int) = NULL;
|
|
@@ -143,6 +150,15 @@ static inline fnptr dlsym_fn(void *handl
|
|
return (fnptr) (long) dlsym(handle, symbol);
|
|
}
|
|
|
|
+#ifdef __NetBSD__
|
|
+#define LOAD_IOCTL_FUNC() \
|
|
+do { \
|
|
+ pthread_mutex_lock(&func_mutex); \
|
|
+ if (!_ioctl) \
|
|
+ _ioctl = (int (*)(int, u_long, void*)) dlsym_fn(RTLD_NEXT, "ioctl"); \
|
|
+ pthread_mutex_unlock(&func_mutex); \
|
|
+} while(0)
|
|
+#else
|
|
#define LOAD_IOCTL_FUNC() \
|
|
do { \
|
|
pthread_mutex_lock(&func_mutex); \
|
|
@@ -150,6 +166,7 @@ do { \
|
|
_ioctl = (int (*)(int, int, void*)) dlsym_fn(RTLD_NEXT, "ioctl"); \
|
|
pthread_mutex_unlock(&func_mutex); \
|
|
} while(0)
|
|
+#endif
|
|
|
|
#define LOAD_OPEN_FUNC() \
|
|
do { \
|
|
@@ -199,11 +216,20 @@ do { \
|
|
pthread_mutex_unlock(&func_mutex); \
|
|
} while(0)
|
|
|
|
+#ifdef __NetBSD__
|
|
+#if (__NetBSD_Version__ < 600000000)
|
|
+#define STAT_FUNC "__stat30"
|
|
+#else
|
|
+#define STAT_FUNC "__stat50"
|
|
+#endif
|
|
+#else
|
|
+#define STAT_FUNC "stat"
|
|
+#endif
|
|
#define LOAD_STAT_FUNC() \
|
|
do { \
|
|
pthread_mutex_lock(&func_mutex); \
|
|
if (!_stat) \
|
|
- _stat = (int (*)(const char *, struct stat *)) dlsym_fn(RTLD_NEXT, "stat"); \
|
|
+ _stat = (int (*)(const char *, struct stat *)) dlsym_fn(RTLD_NEXT, STAT_FUNC); \
|
|
pthread_mutex_unlock(&func_mutex); \
|
|
} while(0)
|
|
|
|
@@ -2264,6 +2290,7 @@ static int dsp_ioctl(fd_info *i, unsigne
|
|
break;
|
|
}
|
|
|
|
+#ifndef __sun
|
|
case SOUND_PCM_READ_RATE:
|
|
debug(DEBUG_LEVEL_NORMAL, __FILE__": SOUND_PCM_READ_RATE\n");
|
|
|
|
@@ -2288,6 +2315,7 @@ static int dsp_ioctl(fd_info *i, unsigne
|
|
pa_threaded_mainloop_unlock(i->mainloop);
|
|
break;
|
|
|
|
+#endif
|
|
case SNDCTL_DSP_GETOPTR: {
|
|
count_info *info;
|
|
|
|
@@ -2357,21 +2385,35 @@ fail:
|
|
return ret;
|
|
}
|
|
|
|
+/* NetBSD < 6 and 6.99.0 - 6.99.6 used a different ioctl() definition */
|
|
+#if defined(__NetBSD__) && (__NetBSD_Version__ < 600000000 || \
|
|
+ (__NetBSD_Version__ > 699000000 && __NetBSD_Version__ < 699000700) )
|
|
+# define OLD_NETBSD_IOCTL_CALL
|
|
+#endif
|
|
+
|
|
#ifdef sun
|
|
int ioctl(int fd, int request, ...) {
|
|
+#elif defined(OLD_NETBSD_IOCTL_CALL)
|
|
+int ioctl(int fd, u_long request, void *_argp) {
|
|
#else
|
|
int ioctl(int fd, unsigned long request, ...) {
|
|
#endif
|
|
fd_info *i;
|
|
+#if !defined(OLD_NETBSD_IOCTL_CALL)
|
|
va_list args;
|
|
+#endif
|
|
void *argp;
|
|
int r, _errno = 0;
|
|
|
|
debug(DEBUG_LEVEL_VERBOSE, __FILE__": ioctl()\n");
|
|
|
|
+#if defined(OLD_NETBSD_IOCTL_CALL)
|
|
+ argp = _argp;
|
|
+#else
|
|
va_start(args, request);
|
|
argp = va_arg(args, void *);
|
|
va_end(args);
|
|
+#endif
|
|
|
|
if (!function_enter()) {
|
|
LOAD_IOCTL_FUNC();
|