diff --git a/src/xpdev/conwrap.c b/src/xpdev/conwrap.c
index c7328808a9e762a90445e7831a78f07c790adb21..d377e03be819544eb9e50fee9e559158ffc3b093 100644
--- a/src/xpdev/conwrap.c
+++ b/src/xpdev/conwrap.c
@@ -42,10 +42,9 @@
 #include <unistd.h>
 #include <termios.h>
 
-/* Do the correct thing under BSD */
 #if defined(__FreeBSD__)
 	#include <sys/kbio.h>
-#else /* Linux and others */
+#elif defined(__linux__)
 	#include <sys/kd.h>
 #endif
 
diff --git a/src/xpdev/dirwrap.c b/src/xpdev/dirwrap.c
index c3846d4d4db7942ecb10382c323cbd64aebd3c18..3cfcb40d9756261299b3a0f2b025822ae469f5da 100644
--- a/src/xpdev/dirwrap.c
+++ b/src/xpdev/dirwrap.c
@@ -47,12 +47,14 @@
 	#include <unistd.h>		/* usleep */
 	#include <fcntl.h>		/* O_NOCCTY */
 	#include <ctype.h>		/* toupper */
+	#include <sys/param.h>
 
-	#if defined(__FreeBSD__)
-		#include <sys/param.h>
+	#if defined(BSD)
 		#include <sys/mount.h>
+	#if defined(__FreeBSD__)
 		#include <sys/kbio.h>
 	#endif
+	#endif
 
 	#include <sys/ioctl.h>	/* ioctl */
 
@@ -633,7 +635,7 @@ ulong DLLCALL getfreediskspace(const char* path)
 
 
 /* statfs is also used under FreeBSD */
-#elif defined(__GLIBC__) || defined(__FreeBSD__)
+#elif defined(__GLIBC__) || defined(BSD)
 
 	struct statfs fs;