diff --git a/xtrn/sbl/smb2sbl.c b/xtrn/sbl/smb2sbl.c
index 4d33de6d03387169e20f1ef9d70f1ab752dd8b5d..0c0809a8397037805c8fedc2c7249743f298cc23 100644
--- a/xtrn/sbl/smb2sbl.c
+++ b/xtrn/sbl/smb2sbl.c
@@ -45,7 +45,7 @@
 #include <sys/stat.h>	/* S_IWRITE */
 #include <ctype.h>		/* isdigit */
 #include <stdlib.h>		/* atoi */
-#ifndef __FreeBSD__
+#ifndef __BSD
 	#include <malloc.h>
 #endif
 #include <string.h>
diff --git a/xtrn/sdk/xsdk.h b/xtrn/sdk/xsdk.h
index 7a62756812f0d0d59e704218f0a44c054c803443..265e20a2dcaf7cc35180b1e1ce92a26d21713600 100644
--- a/xtrn/sdk/xsdk.h
+++ b/xtrn/sdk/xsdk.h
@@ -61,7 +61,7 @@
 #include <string.h>
 #include <stdlib.h>
 #include <stdarg.h>
-#ifndef __FreeBSD__		/* FreeBSD uses stdlib.h for malloc() */
+#ifndef __BSD		/* FreeBSD uses stdlib.h for malloc() */
 	#include <malloc.h>
 #endif
 #include <sys/stat.h>
diff --git a/xtrn/sdk/xsdkinet.h b/xtrn/sdk/xsdkinet.h
index 5c2f75ab97a336c38d7a290ed5eca02619cdf9c9..cee0f6a7ec11be0fbe5b7a4dd629f555b408624a 100644
--- a/xtrn/sdk/xsdkinet.h
+++ b/xtrn/sdk/xsdkinet.h
@@ -52,7 +52,7 @@
 
 #elif defined __unix__	/* Unix-variant */
 
-#ifdef __FreeBSD__
+#ifdef __BSD
 #include <sys/types.h>	/* u_intXX_t */
 #endif
 
diff --git a/xtrn/sdk/xsdkwrap.c b/xtrn/sdk/xsdkwrap.c
index c929aa5a673239f7d61e9435ac05dbc169ed2db4..ef4cbc28153ce3f0629a4603e3482ba4e624b04c 100644
--- a/xtrn/sdk/xsdkwrap.c
+++ b/xtrn/sdk/xsdkwrap.c
@@ -49,8 +49,10 @@
 	#include <stdlib.h>
 	#include <unistd.h>
 	#include <termios.h>
-	#ifdef __FreeBSD__
+	#ifdef __BSD
+	#ifndef __OpenBSD__
 	#include <sys/kbio.h>
+	#endif
 	#else
 	#include <sys/kd.h>
 	#endif