Index: gensio.cpp
--- gensio.cpp.orig	2006-08-10 13:09:51 +0200
+++ gensio.cpp	2006-08-25 11:26:59 +0200
@@ -7,6 +7,9 @@
 #pragma implementation
 #endif
 
+#include <sys/types.h>
+#include <sys/stat.h>
+
 #if 0
 extern "C" int errno;
 /* OK: autodetect with autoconf */
@@ -16,7 +19,7 @@
 #else
 #undef __STRICT_ANSI__ /* for __MINGW32__ */
 #define _BSD_SOURCE 1 /* vsnprintf(); may be emulated with fixup_vsnprintf() */
-#ifndef __APPLE__ /* SUXX: Max OS X has #ifndef _POSIX_SOURCE around lstat() :-( */
+#if !defined(__APPLE__) and !defined(__FreeBSD__) /* SUXX: Max OS X has #ifndef _POSIX_SOURCE around lstat() :-( */
 #define _POSIX_SOURCE 1 /* also popen() */
 #endif
 #define _POSIX_C_SOURCE 2 /* also popen() */
@@ -24,9 +27,11 @@
 #ifndef _XPG4_2
 #define _XPG4_2 1 /* SunOS 5.7 lstat() */
 #endif
+#if !defined(__FreeBSD__)
 #undef  _XOPEN_SOURCE /* pacify gcc-3.1 */
 #define _XOPEN_SOURCE 1 /* popen() on Digital UNIX */
 #endif
+#endif
 
 #include "gensio.hpp"
 #include "error.hpp"
