17ec681f3Smrg/*
27ec681f3Smrg * Copyright © 2020 Collabora, Ltd.
37ec681f3Smrg * Author: Antonio Caggiano <antonio.caggiano@collabora.com>
47ec681f3Smrg *
57ec681f3Smrg * SPDX-License-Identifier: MIT
67ec681f3Smrg */
77ec681f3Smrg
87ec681f3Smrg#include "pps.h"
97ec681f3Smrg
107ec681f3Smrg#include <cerrno>
117ec681f3Smrg#include <cstring>
127ec681f3Smrg
137ec681f3Smrgnamespace pps
147ec681f3Smrg{
157ec681f3Smrgbool check(int res, const char *msg)
167ec681f3Smrg{
177ec681f3Smrg   if (res < 0) {
187ec681f3Smrg      char *err_msg = std::strerror(errno);
197ec681f3Smrg      PERFETTO_ELOG("%s: %s", msg, err_msg);
207ec681f3Smrg      return false;
217ec681f3Smrg   }
227ec681f3Smrg
237ec681f3Smrg   return true;
247ec681f3Smrg}
257ec681f3Smrg
267ec681f3Smrg} // namespace pps
27