-#ifndef _TIMESPEC_DECLARED
-#define _TIMESPEC_DECLARED
-struct timespec {
- time_t tv_sec; /* seconds */
- int32_t tv_nsec; /* and nanoseconds */
+#ifndef FD_SETSIZE
+#define FD_SETSIZE __DARWIN_FD_SETSIZE
+#endif /* FD_SETSIZE */
+#ifndef FD_SET
+#define FD_SET(n, p) __DARWIN_FD_SET(n, p)
+#endif /* FD_SET */
+#ifndef FD_CLR
+#define FD_CLR(n,p) __DARWIN_FD_CLR(n, p)
+#endif /* FD_CLR */
+#ifndef FD_ISSET
+#define FD_ISSET(n, p) __DARWIN_FD_ISSET(n, p)
+#endif /* FD_ISSET */
+#ifndef FD_ZERO
+#define FD_ZERO(p) __DARWIN_FD_ZERO(p)
+#endif /* FD_ZERO */
+
+#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
+
+#ifndef FD_COPY
+#define FD_COPY(f, t) __DARWIN_FD_COPY(f, t)
+#endif /* FD_COPY */
+
+#ifdef KERNEL
+#ifndef _USERTIMEVAL
+#define _USERTIMEVAL
+
+#include <machine/types.h> /* user_time_t */
+/*
+ * LP64 version of struct timeval. time_t is a long and must grow when
+ * we're dealing with a 64-bit process.
+ * WARNING - keep in sync with struct timeval
+ */
+
+struct user_timeval {
+ user_time_t tv_sec; /* seconds */
+ suseconds_t tv_usec __attribute((aligned(8))); /* and microseconds */
+};
+
+struct user_itimerval {
+ struct user_timeval it_interval; /* timer interval */
+ struct user_timeval it_value; /* current value */