path: root/hurd/porting
diff options
authorThomas Schwinge <>2016-12-04 13:20:31 +0100
committerThomas Schwinge <>2016-12-04 13:20:31 +0100
commit79677204760502b2fdd0e06958a999b1fad0f940 (patch)
treeb5c3eff1f13a9655ea13e9faba0c387a562fb278 /hurd/porting
parentaef463c050add77d72259c5c9b630adbfb0409bb (diff)
parent45e529318e9963a4df0a900bd7b5bd29a6412183 (diff)
Merge commit '45e529318e9963a4df0a900bd7b5bd29a6412183'
Diffstat (limited to 'hurd/porting')
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.