pkgsrc/multimedia/kdemultimedia3/patches/patch-ad
joerg 9037217dd0 Rework broken thread detection:
- try libpthread
- fallback to ${PTHREAD_LDFLAGS} ${PTHREAD_LIBS}
Run the check only once, to avoid the second run overwriting the results
of the first.

Add DragonFly support. Fix errno.
2006-01-20 03:51:25 +00:00

60 lines
1.5 KiB
Text

$NetBSD: patch-ad,v 1.3 2006/01/20 03:51:25 joerg Exp $
--- kscd/libwm/plat_freebsd.c.orig 2005-10-05 13:22:14.000000000 +0000
+++ kscd/libwm/plat_freebsd.c
@@ -30,7 +30,7 @@
*
*/
-#if defined(__FreeBSD__) || defined(__FreeBSD) || defined(__NetBSD__) || defined (__NetBSD)
+#if defined(__FreeBSD__) || defined(__FreeBSD) || defined(__NetBSD__) || defined (__NetBSD) || defined(__DragonFly__)
#include <errno.h>
#include <stdio.h>
@@ -61,7 +61,7 @@
#else
# define LEFT_PORT 0
# define RIGHT_PORT 1
-# if __FreeBSD_version < 300000
+# if defined(__FreeBSD_version) && __FreeBSD_version < 300000
# include <scsi.h>
# endif
#endif
@@ -378,6 +378,14 @@ gen_stop( struct wm_drive *d)
return (ioctl(d->fd, CDIOCSTOP));
} /* gen_stop() */
+/* XXX */
+#ifdef __NetBSD__
+# include <sys/param.h>
+# if __NetBSD_Version__ >= 299000900 /* 2.99.9 */
+# define HAVE_SYS_STATVFS_H 1
+# endif
+#endif
+
/*----------------------------------------*
* Eject the current CD, if there is one.
*----------------------------------------*/
@@ -386,14 +394,22 @@ gen_eject( struct wm_drive *d )
{
/* On some systems, we can check to see if the CD is mounted. */
struct stat stbuf;
+#ifdef HAVE_SYS_STATVFS_H
+ struct statvfs buf;
+#else
struct statfs buf;
+#endif
int rval;
if (fstat(d->fd, &stbuf) != 0)
return (-2);
/* Is this a mounted filesystem? */
+#ifdef HAVE_SYS_STATVFS_H
+ if (fstatvfs(stbuf.st_rdev, &buf) == 0)
+#else
if (fstatfs(stbuf.st_rdev, &buf) == 0)
+#endif
return (-3);
rval = ioctl(d->fd, CDIOCALLOW);