Daniel Dunbar | f56039e | 2008-10-02 01:17:28 +0000 | [diff] [blame^] | 1 | //===- llvm/System/Unix/Host.inc --------------------------------*- C++ -*-===// |
| 2 | // |
| 3 | // The LLVM Compiler Infrastructure |
| 4 | // |
| 5 | // This file is distributed under the University of Illinois Open Source |
| 6 | // License. See LICENSE.TXT for details. |
| 7 | // |
| 8 | //===----------------------------------------------------------------------===// |
| 9 | // |
| 10 | // This file implements the UNIX Host support. |
| 11 | // |
| 12 | //===----------------------------------------------------------------------===// |
| 13 | |
| 14 | //===----------------------------------------------------------------------===// |
| 15 | //=== WARNING: Implementation here must contain only generic UNIX code that |
| 16 | //=== is guaranteed to work on *all* UNIX variants. |
| 17 | //===----------------------------------------------------------------------===// |
| 18 | |
| 19 | #include <llvm/Config/config.h> |
| 20 | #include "Unix.h" |
| 21 | #include <sys/utsname.h> |
| 22 | #include <string> |
| 23 | |
| 24 | using namespace llvm; |
| 25 | |
| 26 | std::string llvm::sys::osName() { |
| 27 | struct utsname info; |
| 28 | |
| 29 | if (uname(&info)) |
| 30 | return ""; |
| 31 | |
| 32 | return info.sysname; |
| 33 | } |
| 34 | |
| 35 | std::string llvm::sys::osVersion() { |
| 36 | struct utsname info; |
| 37 | |
| 38 | if (uname(&info)) |
| 39 | return ""; |
| 40 | |
| 41 | return info.release; |
| 42 | } |