1bf215546Sopenharmony_ci/* 2bf215546Sopenharmony_ci * Copyright © 2020 Collabora, Ltd. 3bf215546Sopenharmony_ci * Author: Antonio Caggiano <antonio.caggiano@collabora.com> 4bf215546Sopenharmony_ci * 5bf215546Sopenharmony_ci * SPDX-License-Identifier: MIT 6bf215546Sopenharmony_ci */ 7bf215546Sopenharmony_ci 8bf215546Sopenharmony_ci#include "pps.h" 9bf215546Sopenharmony_ci 10bf215546Sopenharmony_ci#include <cerrno> 11bf215546Sopenharmony_ci#include <cstring> 12bf215546Sopenharmony_ci 13bf215546Sopenharmony_cinamespace pps 14bf215546Sopenharmony_ci{ 15bf215546Sopenharmony_cibool check(int res, const char *msg) 16bf215546Sopenharmony_ci{ 17bf215546Sopenharmony_ci if (res < 0) { 18bf215546Sopenharmony_ci char *err_msg = std::strerror(errno); 19bf215546Sopenharmony_ci PERFETTO_ELOG("%s: %s", msg, err_msg); 20bf215546Sopenharmony_ci return false; 21bf215546Sopenharmony_ci } 22bf215546Sopenharmony_ci 23bf215546Sopenharmony_ci return true; 24bf215546Sopenharmony_ci} 25bf215546Sopenharmony_ci 26bf215546Sopenharmony_ci} // namespace pps 27