fsfw/src/fsfw_hal/linux/utility.cpp

24 lines
728 B
C++
Raw Normal View History

2021-08-02 20:58:56 +02:00
#include "fsfw_hal/linux/utility.h"
2021-07-15 19:06:40 +02:00
#include <cerrno>
#include <cstring>
2021-07-13 19:19:25 +02:00
2022-02-02 10:29:30 +01:00
#include "fsfw/FSFW.h"
#include "fsfw/serviceinterface/ServiceInterface.h"
2021-07-13 19:19:25 +02:00
void utility::handleIoctlError(const char* const customPrintout) {
#if FSFW_VERBOSE_LEVEL >= 1
#if FSFW_CPP_OSTREAM_ENABLED == 1
2022-02-02 10:29:30 +01:00
if (customPrintout != nullptr) {
sif::warning << customPrintout << std::endl;
}
sif::warning << "handleIoctlError: Error code " << errno << ", " << strerror(errno) << std::endl;
2021-07-13 19:19:25 +02:00
#else
2022-02-02 10:29:30 +01:00
if (customPrintout != nullptr) {
sif::printWarning("%s\n", customPrintout);
}
sif::printWarning("handleIoctlError: Error code %d, %s\n", errno, strerror(errno));
2021-07-13 19:19:25 +02:00
#endif /* FSFW_CPP_OSTREAM_ENABLED == 1 */
#endif /* FSFW_VERBOSE_LEVEL >= 1 */
}