tech-toolchain archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

fix to darwin xcompile by including unistd.h in nbcompat getmode.c compile

Does anyone mind if I commit the following patch?  This fixes compile
problems on darwin by including the header file that declares setmode(3)
on darwin (and netbsd)

The issue is that darwin uses tricks to version the setmode symbol
(appending $UNIX2003), while netbsd's compat_defs.h renames that same
token to __nbcompat_setmode.  In my case, xinstall.c sees the
versioned darwin header, but the compat definition does not, and
therefore sees a definition that does not get the darwin modification,
resulting in a linker failure in src/tools/binstall.

The following change includes the header file which defines setmode
so that the symbol gets the same rename for our compat library as in the
program that invokes it.

Does anyone think this will break compile on any other platforms?


Index: getmode.c
RCS file: /cvsroot/src/tools/compat/getmode.c,v
retrieving revision 1.7
diff -u -r1.7 getmode.c
--- getmode.c   28 Apr 2008 20:24:12 -0000      1.7
+++ getmode.c   9 Jun 2008 04:37:19 -0000
@@ -31,6 +31,7 @@
 #include "nbtool_config.h"
 #include <stdlib.h>
+#include <unistd.h>
 void *
 setmode(const char *str)

Home | Main Index | Thread Index | Old Index