blob: 3169745eca10621dfcc1583cf188510725c851f2 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
|
--- src/sysinfo.cpp.orig Sat Feb 10 09:00:25 2007
+++ src/sysinfo.cpp Mon Feb 12 11:37:25 2007
@@ -14,11 +14,13 @@
#include <sys/wait.h>
#include <math.h>
#include <errno.h>
-
#include <string>
#include <vector>
#include <fstream>
#include <sstream>
+#ifdef __FreeBSD__
+#include <sys/utsname.h>
+#endif
#include "sysinfo.h"
#include "util.h"
@@ -240,6 +242,29 @@
}
};
+#ifdef __FreeBSD__
+ class UnameSysInfo
+ : public SysInfo
+ {
+ public:
+ UnameSysInfo()
+ {
+ this->load_uname_info();
+ }
+
+ private:
+
+ void load_uname_info()
+ {
+ struct utsname name;
+
+ uname(&name);
+
+ this->distro_name = name.sysname;
+ this->distro_release = name.release;
+ }
+ };
+#endif
SysInfo* get_sysinfo()
{
@@ -247,9 +272,12 @@
g_free(p);
return new LSBSysInfo;
}
+#ifdef __FreeBSD__
+ return new UnameSysInfo;
+#else
else if (g_file_test("/etc/release", G_FILE_TEST_EXISTS))
return new SolarisSysInfo;
-
+#endif
return new SysInfo(_("Unknown distribution"));
}
}
|