diff options
Diffstat (limited to 'hurd/porting')
-rw-r--r-- | hurd/porting/guidelines.mdwn | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/hurd/porting/guidelines.mdwn b/hurd/porting/guidelines.mdwn index a76ffc8f..33888685 100644 --- a/hurd/porting/guidelines.mdwn +++ b/hurd/porting/guidelines.mdwn @@ -181,6 +181,19 @@ Fixed code: Replace with `getrlimit(RLIMIT_NOFILE,...)` +## <a name="mach_darwin"> `#ifdef __MACH__` </a> + +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__)` + +## <a name="mach_clock"> `mach/clock.h` </a> + +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. + ## <a name="GNU_specific_define_tt_"> </a> 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. |