Add: Implement 2D map scrolling under SDL2 (#13167)
[openttd-github.git] / src / os / unix / survey_unix.cpp
blobd1f07d116f4aff11996a1f0b4af6957a397df45e
1 /*
2 * This file is part of OpenTTD.
3 * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
4 * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
5 * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
6 */
8 /** @file survey_unix.cpp Unix implementation of OS-specific survey information. */
10 #include "../../stdafx.h"
11 #include "../../survey.h"
13 #include <sys/utsname.h>
14 #include <thread>
15 #include <unistd.h>
17 #include "../../safeguards.h"
19 void SurveyOS(nlohmann::json &json)
21 struct utsname name;
22 if (uname(&name) < 0) {
23 json["os"] = "Unix";
24 return;
27 json["os"] = name.sysname;
28 json["release"] = name.release;
29 json["machine"] = name.machine;
30 json["version"] = name.version;
32 long pages = sysconf(_SC_PHYS_PAGES);
33 long page_size = sysconf(_SC_PAGE_SIZE);
34 json["memory"] = SurveyMemoryToText(pages * page_size);
35 json["hardware_concurrency"] = std::thread::hardware_concurrency();