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/>.
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>
17 #include "../../safeguards.h"
19 void SurveyOS(nlohmann::json
&json
)
22 if (uname(&name
) < 0) {
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();