diff --git a/xf86drmMode.c b/xf86drmMode.c
index c3920b913fa351fba53f878035e382b17451b40b..0106954be00d52142e5e33e7cfbee9bee28d46f8 100644
--- a/xf86drmMode.c
+++ b/xf86drmMode.c
@@ -38,6 +38,9 @@
 #include <stdlib.h>
 #include <sys/ioctl.h>
 #if HAVE_SYS_SYSCTL_H
+#ifdef __FreeBSD__
+#include <sys/types.h>
+#endif
 #include <sys/sysctl.h>
 #endif
 #include <stdio.h>