#ifdef __linux__
# include <asm/types.h>
-# include <asm/timex.h>
+# if defined(__powerpc__) && !defined(__KERNEL__)
+# define __KERNEL__
+# include <asm/timex.h>
+# undef __KERNEL__
+# else
+# include <asm/timex.h>
+# endif
#else
# include <sys/types.h>
typedef u_int32_t __u32;
# include <linux/time.h>
#else
# include <sys/time.h>
-# define do_gettimeofday(tv) gettimeofday(tv, NULL)
+# define do_gettimeofday(tv) gettimeofday(tv, NULL);
#endif
#include <portals/errno.h>