LLVM API Documentation
00001 //===- llvm/System/Unix/Host.inc --------------------------------*- C++ -*-===// 00002 // 00003 // The LLVM Compiler Infrastructure 00004 // 00005 // This file is distributed under the University of Illinois Open Source 00006 // License. See LICENSE.TXT for details. 00007 // 00008 //===----------------------------------------------------------------------===// 00009 // 00010 // This file implements the UNIX Host support. 00011 // 00012 //===----------------------------------------------------------------------===// 00013 00014 //===----------------------------------------------------------------------===// 00015 //=== WARNING: Implementation here must contain only generic UNIX code that 00016 //=== is guaranteed to work on *all* UNIX variants. 00017 //===----------------------------------------------------------------------===// 00018 00019 #include <llvm/Config/config.h> 00020 #include "Unix.h" 00021 #include <sys/utsname.h> 00022 #include <string> 00023 00024 using namespace llvm; 00025 00026 std::string llvm::sys::getOSName() { 00027 struct utsname info; 00028 00029 if (uname(&info)) 00030 return ""; 00031 00032 return info.sysname; 00033 } 00034 00035 std::string llvm::sys::getOSVersion() { 00036 struct utsname info; 00037 00038 if (uname(&info)) 00039 return ""; 00040 00041 return info.release; 00042 }