| 1 | /* |
| 2 | * Copyright (C) 2023 Jérémie Galarneau <jeremie.galarneau@efficios.com> |
| 3 | * |
| 4 | * SPDX-License-Identifier: LGPL-2.1-only |
| 5 | * |
| 6 | */ |
| 7 | |
| 8 | #include <common/logging-utils.hpp> |
| 9 | |
| 10 | #include <sys/utsname.h> |
| 11 | |
| 12 | /* Output system information as logging statements. */ |
| 13 | void lttng::logging::log_system_information(lttng_error_level error_level) |
| 14 | { |
| 15 | struct utsname name = {}; |
| 16 | const int ret = uname(&name); |
| 17 | |
| 18 | if (ret) { |
| 19 | PERROR("Failed to get system information using uname()") |
| 20 | return; |
| 21 | } |
| 22 | |
| 23 | LOG(error_level, "System information:"); |
| 24 | LOG(error_level, "\tsysname: `%s`", name.sysname); |
| 25 | LOG(error_level, "\tnodename: `%s`", name.nodename); |
| 26 | LOG(error_level, "\trelease: `%s`", name.release); |
| 27 | LOG(error_level, "\tversion: `%s`", name.version); |
| 28 | LOG(error_level, "\tmachine: `%s`", name.machine); |
| 29 | } |