-#endif /* ! _POSIX_SOURCE */
-#define ENOTSUP 45 /* Operation not supported */
-#ifndef _POSIX_SOURCE
-#define EOPNOTSUPP ENOTSUP /* Operation not supported */
+#endif /* ! _POSIX_C_SOURCE */
+#define ENOTSUP 45 /* Operation not supported */
+#if !__DARWIN_UNIX03 && !defined(KERNEL)
+/*
+ * This is the same for binary and source copmpatability, unless compiling
+ * the kernel itself, or compiling __DARWIN_UNIX03; if compiling for the
+ * kernel, the correct value will be returned. If compiling non-POSIX
+ * source, the kernel return value will be converted by a stub in libc, and
+ * if compiling source with __DARWIN_UNIX03, the conversion in libc is not
+ * done, and the caller gets the expected (discrete) value.
+ */
+#define EOPNOTSUPP ENOTSUP /* Operation not supported on socket */
+#endif /* !__DARWIN_UNIX03 && !KERNEL */
+
+#ifndef _POSIX_C_SOURCE