1 //===- llvm/System/Unix/Unix.h - Common Unix Include File -----*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file was developed by Reid Spencer and is distributed under the
6 // University of Illinois Open Source License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This file defines things specific to Unix implementations.
12 //===----------------------------------------------------------------------===//
14 //===----------------------------------------------------------------------===//
15 //=== WARNING: Implementation here must contain only generic UNIX code that
16 //=== is guaranteed to work on all UNIX variants.
17 //===----------------------------------------------------------------------===//
23 #include <sys/types.h>
24 #include <sys/param.h>
26 inline void ThrowErrno(const std::string& prefix) {
27 #if defined __USE_XOPEN2K || defined __USE_MISC
28 char buffer[MAXPATHLEN];
29 strerror_r(errno,buffer, MAXPATHLEN);
30 throw prefix + ": " + buffer;
32 throw prefix + ": " + strerror(errno);