summaryrefslogtreecommitdiffstats
path: root/sysutils/gnome-system-monitor/files/patch-src_sysinfo.cpp
blob: 85d231bb29e7c97b37d2f428b869001ee431369b (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
--- sysinfo.cpp.orig    Fri Nov 24 02:41:14 2006
+++ sysinfo.cpp Fri Nov 24 02:54:59 2006
@@ -11,6 +11,9 @@
 #include <unistd.h>
 #include <netdb.h>
 #include <sys/socket.h>
+#ifdef __FreeBSD__
+#include <sys/utsname.h>
+#endif
 
 #include <string>
 #include <vector>
@@ -140,16 +143,39 @@ namespace {
     }
   };
 
+  class FreeBSDSysInfo
+    : public SysInfo
+  {
+  public:
+    FreeBSDSysInfo()
+      : SysInfo("FreeBSD")
+    {
+      this->load_freebsd_info();
+    }
+
+  private:
+    void load_freebsd_info()
+    {
+   struct utsname name;
+
+   uname(&name);
+
+   this->distro_version = name.release;
+    }
+  };
 
   SysInfo* get_sysinfo()
   {
     if (g_file_test("/etc/debian_version", G_FILE_TEST_EXISTS))
       return new DebianSysInfo;
     else
+#ifdef __FreeBSD__
+      return new FreeBSDSysInfo;
+#else
       return new SysInfo(_("Unknown distro"));
+#endif
   }
 }
-
 
 GtkWidget *
 procman_create_sysinfo_view(void)