Commit 98970485 authored by jan.koester's avatar jan.koester
Browse files

mac os comp

parent 2a7f005b
Loading
Loading
Loading
Loading
+3 −0
Changes for plugins/nodeinfo/icons/macos.h: 3 added lines, 0 removed lines.
Original line number Diff line number Diff line
const std::string sysicon="<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 256 315\" width=\"256\" height=\"315\">\
<path d=\"M213.803 167.03c.442 47.58 41.74 63.413 42.197 63.615-.35 1.116-6.599 22.563-21.757 44.716-13.104 19.153-26.705 38.235-48.13 38.63-21.05.388-27.82-12.483-51.888-12.483-24.061 0-31.582 12.088-51.51 12.871-20.68.783-36.428-20.71-49.64-39.793-27-39.033-47.633-110.3-19.928-158.406 13.763-23.89 38.36-39.017 65.056-39.405 20.307-.388 39.475 13.662 51.889 13.662 12.406 0 35.699-16.895 60.186-14.414 10.25.427 39.026 4.14 57.503 31.186-1.49.923-34.335 20.044-33.978 59.821M174.24 50.199c10.98-13.29 18.369-31.79 16.353-50.199-15.826.636-34.962 10.546-46.314 23.828-10.173 11.763-19.082 30.589-16.678 48.633 17.64 1.365 35.66-8.964 46.639-22.262\" fill=\"#555555\"/>\
</svg>";
+27 −0
Changes for plugins/nodeinfo/nodeinfo.cpp: 27 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -42,6 +42,11 @@
    #include <sys/sysctl.h>
#endif

#ifdef __APPLE__
    #include <sys/sysctl.h>
    #include <mach/mach.h>
#endif


#include <dbpp/database.h>

@@ -61,6 +66,10 @@
#include "icons/freebsd.h"
#endif

#if defined(__APPLE__) && !defined(FreeBSD)
#include "icons/macos.h"
#endif

#define RELEASEFILE "/etc/os-release"

namespace blogi {
@@ -389,6 +398,24 @@ namespace blogi {
                    snprintf(ab, 512, "%ld/%ld MB", free_mb, total_mb);
                    htmltable << (libhtmlpp::HtmlTable::Row() << tr(_lang,"Memory:").c_str() << ab);
            }
#elif defined(__APPLE__)
            {
                int64_t total_mem = 0;
                size_t len = sizeof(total_mem);
                sysctlbyname("hw.memsize", &total_mem, &len, NULL, 0);

                mach_port_t host = mach_host_self();
                vm_statistics64_data_t vmstat;
                mach_msg_type_number_t count = HOST_VM_INFO64_COUNT;
                host_statistics64(host, HOST_VM_INFO64, (host_info64_t)&vmstat, &count);

                long page_size = sysconf(_SC_PAGESIZE);
                long free_mem = (long)(vmstat.free_count + vmstat.inactive_count) * page_size;

                char ab[512];
                snprintf(ab, 512, "%ld/%ld MB", free_mem / 1048576, (long)(total_mem / 1048576));
                htmltable << (libhtmlpp::HtmlTable::Row() << tr(_lang,"Memory:").c_str() << ab);
            }
#else // Fallback for generic Unix/Unknown
            // Use the generic POSIX sysconf if Linux/FreeBSD aren't defined,
            // though this might fail as seen previously.