From c5236a88a298f37e62974db4b3f449fc412c1990 Mon Sep 17 00:00:00 2001 From: Samuel Thibault Date: Sat, 12 Nov 2016 00:59:02 +0100 Subject: Comment on Darwin confusions --- hurd/porting/guidelines.mdwn | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'hurd/porting/guidelines.mdwn') diff --git a/hurd/porting/guidelines.mdwn b/hurd/porting/guidelines.mdwn index a76ffc8f..46a2bf22 100644 --- a/hurd/porting/guidelines.mdwn +++ b/hurd/porting/guidelines.mdwn @@ -181,6 +181,19 @@ Fixed code: Replace with `getrlimit(RLIMIT_NOFILE,...)` +## ifdef __MACH__ + +Some applications put Apple Darwin-specific code inside `#ifdef __MACH__` +guards. Such guard is clearly not enough, since not only Apple uses Mach as a +kernel. This should be replaced by `#if defined(__MACH__) && defined(__APPLE__)` + +## `mach/clock.h` + +Some applications unconditionally use Darwin-specific functions coming +from `mach/clock.h` to get the clock. This is unnecessarily unportable, +`clock_gettime` can simply be used instead, and the ifdef __MACH__ guard for the `mach/clock.h` +inclusion be fixed as explained above. + ## GNU specific `#define` If you need to include specific code for GNU/Hurd using `#if` ... `#endif`, then you can use the `__GNU__` symbol to do so. But think (at least) thrice! before doing so. In most situations, this is completely unnecessary and will create more problems than it may solve. Better ask on the mailing list how to do it right if you can't think of a better solution. -- cgit v1.2.3