From 14ada94682fd7857e81e8dc58a2b37c309879a04 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Wed, 11 Apr 2012 15:35:36 +0000 Subject: Fix the build under Debian GNU/Hurd. Thanks to Pino Toscano for the patch llvm-svn: 154500 --- llvm/lib/Support/Unix/Path.inc | 5 +++++ llvm/lib/Support/Unix/PathV2.inc | 10 ++++++++++ llvm/lib/Support/Unix/Process.inc | 4 ++-- 3 files changed, 17 insertions(+), 2 deletions(-) (limited to 'llvm/lib/Support/Unix') diff --git a/llvm/lib/Support/Unix/Path.inc b/llvm/lib/Support/Unix/Path.inc index b85b574ce38..ddc1e0f9cec 100644 --- a/llvm/lib/Support/Unix/Path.inc +++ b/llvm/lib/Support/Unix/Path.inc @@ -60,6 +60,11 @@ #include #endif +// For GNU Hurd +#if defined(__GNU__) && !defined(MAXPATHLEN) +# define MAXPATHLEN 4096 +#endif + // Put in a hack for Cygwin which falsely reports that the mkdtemp function // is available when it is not. #ifdef __CYGWIN__ diff --git a/llvm/lib/Support/Unix/PathV2.inc b/llvm/lib/Support/Unix/PathV2.inc index c2d7df66d9c..edb101efb0f 100644 --- a/llvm/lib/Support/Unix/PathV2.inc +++ b/llvm/lib/Support/Unix/PathV2.inc @@ -46,6 +46,11 @@ #include #endif +// For GNU Hurd +#if defined(__GNU__) && !defined(PATH_MAX) +# define PATH_MAX 4096 +#endif + using namespace llvm; namespace { @@ -96,7 +101,12 @@ namespace sys { namespace fs { error_code current_path(SmallVectorImpl &result) { +#ifdef MAXPATHLEN result.reserve(MAXPATHLEN); +#else +// For GNU Hurd + result.reserve(1024); +#endif while (true) { if (::getcwd(result.data(), result.capacity()) == 0) { diff --git a/llvm/lib/Support/Unix/Process.inc b/llvm/lib/Support/Unix/Process.inc index 5cdb11ccebc..2d7fd384e8b 100644 --- a/llvm/lib/Support/Unix/Process.inc +++ b/llvm/lib/Support/Unix/Process.inc @@ -136,7 +136,7 @@ int Process::GetCurrentGroupId() { return getgid(); } -#ifdef HAVE_MACH_MACH_H +#if defined(HAVE_MACH_MACH_H) && !defined(__GNU__) #include #endif @@ -150,7 +150,7 @@ void Process::PreventCoreFiles() { setrlimit(RLIMIT_CORE, &rlim); #endif -#ifdef HAVE_MACH_MACH_H +#if defined(HAVE_MACH_MACH_H) && !defined(__GNU__) // Disable crash reporting on Mac OS X 10.0-10.4 // get information about the original set of exception ports for the task -- cgit v1.2.3