diff options
| author | Reid Spencer <rspencer@reidspencer.com> | 2004-08-15 08:14:33 +0000 |
|---|---|---|
| committer | Reid Spencer <rspencer@reidspencer.com> | 2004-08-15 08:14:33 +0000 |
| commit | bc51b928d6355590b7fb7e7553541193e1cf762a (patch) | |
| tree | 213762cbd96537c0ca0b780b166ead5d7fb41595 /llvm/lib/System/linux/ErrorCode.cpp | |
| parent | b708529d80b00be2fccb22ecb34e816245028784 (diff) | |
| download | bcm5719-llvm-bc51b928d6355590b7fb7e7553541193e1cf762a.tar.gz bcm5719-llvm-bc51b928d6355590b7fb7e7553541193e1cf762a.zip | |
Initial implementations of the ErrorCode and Path concepts for Linux.
llvm-svn: 15763
Diffstat (limited to 'llvm/lib/System/linux/ErrorCode.cpp')
| -rw-r--r-- | llvm/lib/System/linux/ErrorCode.cpp | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/llvm/lib/System/linux/ErrorCode.cpp b/llvm/lib/System/linux/ErrorCode.cpp new file mode 100644 index 00000000000..193964a939e --- /dev/null +++ b/llvm/lib/System/linux/ErrorCode.cpp @@ -0,0 +1,57 @@ +//===- ErrorCode.cpp - Define the ErrorCode class ---------------*- C++ -*-===// +// +// Copyright (C) 2004 eXtensible Systems, Inc. All Rights Reserved. +// +// This program is open source software; you can redistribute it and/or modify +// it under the terms of the University of Illinois Open Source License. See +// LICENSE.TXT (distributed with this software) for details. +// +// This program is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +// or FITNESS FOR A PARTICULAR PURPOSE. +// +//===----------------------------------------------------------------------===// +// +// This file defines the linux specific members of the llvm::sys::ErrorCode +// class. +// +//===----------------------------------------------------------------------===// +/// @file lib/System/ErrorCode.h +/// @author Reid Spencer <raspencer@x10sys.com> (original author) +/// @version \verbatim $Id$ \endverbatim +/// @date 2004/08/14 +/// @since 1.4 +/// @brief Declares the linux specific methods of llvm::sys::ErrorCode class. +//===----------------------------------------------------------------------===// + +namespace llvm { +namespace sys { + +std::string +ErrorCode::description() const throw() +{ + switch (domain()) { + case OSDomain: + char buffer[1024]; + if (0 != strerror_r(index(),buffer,1024) ) + return "<Error Message Unavalabile>"; + return buffer; + + case SystemDomain: + switch (index()) { + case ERR_SYS_INVALID_ARG: + return "Invalid argument to lib/System call"; + default: + return "Unknown lib/System Error"; + } + break; + + default: + return "Unknown Error"; + } +} + +} +} + +// vim: sw=2 smartindent smarttab tw=80 autoindent expandtab |

