]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
compat: consolidate definitions of osx and freebsd
authorKefu Chai <kchai@redhat.com>
Sun, 10 Sep 2017 18:00:44 +0000 (02:00 +0800)
committerKefu Chai <kchai@redhat.com>
Sat, 16 Sep 2017 02:43:32 +0000 (10:43 +0800)
on osx, ENODATA = 96, so we need to fix it. also define
CLOCK_MONOTONIC_COARSE and CLOCK_REALTIME_COARSE for osx, ceph_time.h
defines this also, but i don't want to include compat.h in ceph_time.h
at this moment.

and silence the warning of
 #warning ENODATA already defined to a value different from 87 (ENOATRR), refining to fix
because it is fired everywhere on osx when "compat.h" is included.

Signed-off-by: Kefu Chai <kchai@redhat.com>
src/include/compat.h

index d4120478c88ead29a932704e25c5bd8a33849a13..0dad0ea02064a10010b87fee47302e9843a8bdf8 100644 (file)
 // And all compatibility stuff is standard mounted on this 
 #define PROCPREFIX "/compat/linux"
 
+#ifndef MSG_MORE
+#define MSG_MORE 0
+#endif
+
+#ifndef O_DSYNC
+#define O_DSYNC O_SYNC
+#endif
+
+/* And include the extra required include file */
+#include <pthread_np.h>
+
+#endif /* __FreeBSD__ */
+
+#if defined(__APPLE__) || defined(__FreeBSD__)
 /* Make sure that ENODATA is defined in the correct way */
-#ifndef ENODATA
-#define        ENODATA ENOATTR
-#else
+#ifdef ENODATA
 #if (ENODATA == 9919)
 // #warning ENODATA already defined to be 9919, redefining to fix
 // Silencing this warning because it fires at all files where compat.h
 // at the location of usage and report a possible confict.
 // This is left up to a future improvement
 #elif (ENODATA != 87)
-#warning ENODATA already defined to a value different from 87 (ENOATRR), refining to fix
+// #warning ENODATA already defined to a value different from 87 (ENOATRR), refining to fix
 #endif
 #undef ENODATA
-#define ENODATA ENOATTR
-#endif
-#ifndef MSG_MORE
-#define        MSG_MORE 0
-#endif
-
-#ifndef O_DSYNC
-#define O_DSYNC O_SYNC
 #endif
+#define ENODATA ENOATTR
 
 // Fix clock accuracy
 #if !defined(CLOCK_MONOTONIC_COARSE)
 #endif
 #endif
 
-/* And include the extra required include file */
-#include <pthread_np.h>
-
-#endif /* !__FreeBSD__ */
-
-#if defined(__APPLE__) || defined(__FreeBSD__)
 /* get PATH_MAX */
 #include <limits.h>