Impala
Impalaistheopensource,nativeanalyticdatabaseforApacheHadoop.
Main Page
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
os-info.cc
Go to the documentation of this file.
1
// Copyright 2012 Cloudera Inc.
2
//
3
// Licensed under the Apache License, Version 2.0 (the "License");
4
// you may not use this file except in compliance with the License.
5
// You may obtain a copy of the License at
6
//
7
// http://www.apache.org/licenses/LICENSE-2.0
8
//
9
// Unless required by applicable law or agreed to in writing, software
10
// distributed under the License is distributed on an "AS IS" BASIS,
11
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
// See the License for the specific language governing permissions and
13
// limitations under the License.
14
15
#include "
util/os-info.h
"
16
17
#include <iostream>
18
#include <fstream>
19
#include <sstream>
20
#include <stdlib.h>
21
#include <string.h>
22
23
#include <unistd.h>
24
25
#include "
common/names.h
"
26
27
namespace
impala {
28
29
bool
OsInfo::initialized_
=
false
;
30
string
OsInfo::os_version_
=
"Unknown"
;
31
32
void
OsInfo::Init
() {
33
DCHECK(!
initialized_
);
34
// Read from /proc/version
35
ifstream version(
"/proc/version"
, ios::in);
36
if
(version.good()) getline(version,
os_version_
);
37
if
(version.is_open()) version.close();
38
initialized_
=
true
;
39
}
40
41
string
OsInfo::DebugString
() {
42
DCHECK(
initialized_
);
43
stringstream stream;
44
stream <<
"OS version: "
<<
os_version_
<< endl;
45
return
stream.str();
46
}
47
48
}
impala::OsInfo::Init
static void Init()
Initialize OsInfo.
Definition:
os-info.cc:32
impala::OsInfo::os_version_
static std::string os_version_
Definition:
os-info.h:38
impala::OsInfo::initialized_
static bool initialized_
Definition:
os-info.h:37
os-info.h
impala::OsInfo::DebugString
static std::string DebugString()
Definition:
os-info.cc:41
names.h
be
src
util
os-info.cc
Generated on Thu May 7 2015 16:10:37 for Impala by
1.8.6